Dear all
I have a question about creating integer variables and equations with
special features in GAMS.
Consider the following optimization problem:
Min(z=-5x1-7x2-6x3+y1+2y2+8y3)
yi is integer 0=<yi=<10
xi is integer xi=0 or 10
xi=<yi
Is there anyway to define xi as a two-state variable in GAMS while the
programming remains linear?
(When we use the following codes the accepted domain for xi will be
all integers between 0 and 10 rather than 0 and 10 themselves:
integer variable x;
x.lo(i)=0;
x.up(i)=0;)
As a trick, I tried to declare the optimization in a nonlinear form,
using binary variables qi:
Min(z=-5x1-7x2-6x3+y1+2y2+8y3)
yi is integer 0=<yi=<10
xi is integer 0=<xi=<10
qi is binary
xi=qi*yi
xi=<yi
I tried to solve this programming by MIQCP. In GAMS’ output all
variables turned out to be zero. However it is easy to track that the
following solution is better than the solution with all variables
zero:
x1=10;
x2=10;
x3=0;
y1=10;
y2=10;
y3=0;
z=90;
Is there a better way to solve this quadratic problem? (For example by
changing the problem types or solvers )?
THNAKS A LOT
\
Dear Milad
Replace variable X by term Y1 + 2.Y2 + 4.Y3 + 8.Y4 and add the
following constraints:
Y1 + 2.Y2 + 4.Y3 + 8 Y4 wrote:
Dear all
I have a question about creating integer variables and equations with
special features in GAMS.
Consider the following optimization problem:
Min(z=-5x1-7x2-6x3+y1+2y2+8y3)
yi is integer 0= > xi is integer xi=0 or 10
xi= > Is there anyway to define xi as a two-state variable in GAMS while the
programming remains linear?
(When we use the following codes the accepted domain for xi will be
all integers between 0 and 10 rather than 0 and 10 themselves:
integer variable x;
x.lo(i)=0;
x.up(i)=0;)
As a trick, I tried to declare the optimization in a nonlinear form,
using binary variables qi:
Min(z=-5x1-7x2-6x3+y1+2y2+8y3)
yi is integer 0= > xi is integer 0= > qi is binary
xi=qi*yi
xi= > I tried to solve this programming by MIQCP. In GAMS’ output all
variables turned out to be zero. However it is easy to track that the
following solution is better than the solution with all variables
zero:
x1=10;
x2=10;
x3=0;
y1=10;
y2=10;
y3=0;
z=90;
Is there a better way to solve this quadratic problem? (For example by
changing the problem types or solvers )?
THNAKS A LOT
\
Dear Milad,
The following model is a good way to solve your problem (GAMS code):
- Min(z=-5x1-7x2-6x3+y1+2y2+8y3)
- yi is integer 0=<yi=<10
- xi is integer xi=0 or 10
- xi=<yi
binary variables x1,x2,x3; integer variables y1,y2,y3; variable z;
equation obj,le1,le2,le3;
obj… z =e= -50x1-70x2-60x3+y1+2y2+8*y3;
le1… 10x1 =l= y1; le2… 10x2 =l= y2; le3… 10*x3 =l= y3;
y1.up=10;y2.up=10;y3.up=10;
model m / all / solve m us mip min z;
Regards,
Timo
\
2011/4/30 milad ziai
Dear all
I have a question about creating integer variables and equations with
special features in GAMS.
Consider the following optimization problem:
Min(z=-5x1-7x2-6x3+y1+2y2+8y3)
yi is integer 0=<yi=<10
xi is integer xi=0 or 10
xi=<yi
Is there anyway to define xi as a two-state variable in GAMS while the
programming remains linear?
(When we use the following codes the accepted domain for xi will be
all integers between 0 and 10 rather than 0 and 10 themselves:
integer variable x;
x.lo(i)=0;
x.up(i)=0;)
As a trick, I tried to declare the optimization in a nonlinear form,
using binary variables qi:
Min(z=-5x1-7x2-6x3+y1+2y2+8y3)
yi is integer 0=<yi=<10
xi is integer 0=<xi=<10
qi is binary
xi=qi*yi
xi=<yi
I tried to solve this programming by MIQCP. In GAMS’ output all
variables turned out to be zero. However it is easy to track that the
following solution is better than the solution with all variables
zero:
x1=10;
x2=10;
x3=0;
y1=10;
y2=10;
y3=0;
z=90;
Is there a better way to solve this quadratic problem? (For example by
changing the problem types or solvers )?
THNAKS A LOT
To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.