avatar
help on GAMS! thx!!# Programming - 葵花宝典
i*c
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
avatar
X*r
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

avatar
i*c
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

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。