由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - help on GAMS! thx!!
相关主题
J 语言 --最短的语言?c/c++/java的对象/结构输入
HTML print an imagetypedef basic_string string;
[合集] &x[1]和x+1是一回事吧?不管c还是c++?想读双学位 求意见 (转载)
一道c++的考古题algorithm problem
3sum problem初始化列表问题
[合集] reinterpret_cast a 4 byte unsigned char to integerI like this one.
[合集] vector的push_back读文件会不会大大降低速度?how to get client locale inside the running application?
[合集] 看了一段时间haskell,感觉被骗了C++怎么写任意重重循环?
相关话题的讨论汇总
话题: gams话题: ij话题: bag话题: weight话题: balls
进入Programming版参与讨论
1 (共1页)
i********c
发帖数: 54
1
is it possible to solve the optimization problem if the objective function
cannot be described directly as f(x)?
i.e.,
there are 6 balls (1,2, 3, 4, 5, 6) whose weight are 10, 10, 20, 20, 30, 30,
kg. the objective is to put them into 3 bags such that the balls in each bag
has the same weight. The solution is obvious: put 1&2 in bag A, 3&4 in bag B,
5&6 in bag C. Is it possible to do so in GAMS?
define
W(i) = /1, 1, 2, 2, 3, 3/ (weight of each ball)
WAvg(j) = average weight of balls in the
X****r
发帖数: 3557
2
I don't know the GAMS at all, but the easy way to model this
kind of problem is using an assigment matrix x_{ij},
with x_{ij} = 1 if the ball i is in bag j, 0 otherwise.
so we have constraints:
x_{ij} >= 0
x_{ij} <= 1
\sum_j x{ij} = 1
Denote the weight for ball i is w_i.
For all j, we want w_i be the same for all i that x_{ij}=1,
i.e. w_i*x_{ij} and x_{ij} linearly dependent. if we define
o_j = (\sum_i (w_i^2*x_{ij}^2))(\sum_i x_{ij}^2) - (\sum_i (w_i*x_{ij}^2))^2
then using Cauchy-Schwarz inequ

【在 i********c 的大作中提到】
: is it possible to solve the optimization problem if the objective function
: cannot be described directly as f(x)?
: i.e.,
: there are 6 balls (1,2, 3, 4, 5, 6) whose weight are 10, 10, 20, 20, 30, 30,
: kg. the objective is to put them into 3 bags such that the balls in each bag
: has the same weight. The solution is obvious: put 1&2 in bag A, 3&4 in bag B,
: 5&6 in bag C. Is it possible to do so in GAMS?
: define
: W(i) = /1, 1, 2, 2, 3, 3/ (weight of each ball)
: WAvg(j) = average weight of balls in the

i********c
发帖数: 54
3
Thanks Xentar for comments.
The original problem is simplified to some extent. In general, it might not be
quadratic objective function. It is the reason that I want to use GAMS, which
is supposed to be powerful for NLP, MINLP, etc.
However, it seems GAMS is quite limited on this type of problem ...

optimization
30,
bag
B,

【在 X****r 的大作中提到】
: I don't know the GAMS at all, but the easy way to model this
: kind of problem is using an assigment matrix x_{ij},
: with x_{ij} = 1 if the ball i is in bag j, 0 otherwise.
: so we have constraints:
: x_{ij} >= 0
: x_{ij} <= 1
: \sum_j x{ij} = 1
: Denote the weight for ball i is w_i.
: For all j, we want w_i be the same for all i that x_{ij}=1,
: i.e. w_i*x_{ij} and x_{ij} linearly dependent. if we define

1 (共1页)
进入Programming版参与讨论
相关主题
C++怎么写任意重重循环?3sum problem
What is the output of the following code?[合集] reinterpret_cast a 4 byte unsigned char to integer
a c++ question.[合集] vector的push_back读文件会不会大大降低速度?
请教如何使用qsort() to sort string.[合集] 看了一段时间haskell,感觉被骗了
J 语言 --最短的语言?c/c++/java的对象/结构输入
HTML print an imagetypedef basic_string string;
[合集] &x[1]和x+1是一回事吧?不管c还是c++?想读双学位 求意见 (转载)
一道c++的考古题algorithm problem
相关话题的讨论汇总
话题: gams话题: ij话题: bag话题: weight话题: balls