Subsets of variables

1,015 views
Skip to first unread message

Fabián Mancilla

unread,
Dec 21, 2010, 3:54:57 PM12/21/10
to gams...@googlegroups.com
Hello everyone! I have a problem with sets and subsets definitions in a MIP formulation. I have 2 025; the firsts 225 are continue variables and the rest are binary variables. 

Because of this I write: 

k variables of the instance /k1*k2025/
l(k) binary variables(0 <= x <= 1) /k226*k2025/

And then I write:

VARIABLES    
z objetive
x(k) variables;

BINARY VARIABLES
x(l) variables binarias;

But gams give me: Error 184 - Domain list redefined

How I can fix this?

the complete code that I used is the following: 

$CALL GDXXRW 10teams.xlsx @teams.txt
$Title 10teams_ca

SETS
i filas matriz A /i1*i95/
j filas matriz M /j1*j135/
k  variables de la instania /k1*k2025/
l(k) subconjunto de variables binarys (0 <= x <= 1) /k226*k2025/
m1(k) subconjunto de variables continuas FX=1 /k1, k51, k105, k165, k225/
m2(k) subconjunto de variables continuas FX=0;

m2(k) = (not l(k)) - m1(k);

PARAMETERS
A(i,k) matriz A
M(j,k) matriz M
b(i)   vector b
g(j)   vector g
c(k)   vector de costos;

$GDXIN 10teams.gdx
$load A
$load M
$load b
$load g
$load c
$GDXIN

VARIABLES
z funcion objetivo
x(k) variables;

BINARY VARIABLES
x(l) variables binarias;


EQUATIONS
fobj funcion objetivo z
res1 restriccion 1
res2 restriccion 2;

fobj..    z =e= sum(k,c(k)*x(k));
res1(i).. sum(k,A(i,k)*x(k)) =l= b(i);
res2(j).. sum(k,M(j,k)*x(k)) =e= g(j);
x.fx(m1) = 1;
x.fx(m2) = 0;

Model Centro /all/;

option mip=coincbc,rmip=coincbc;
solve Centro USING MIP MINIMIZING z;

Edson Cordeiro do Valle

unread,
Dec 22, 2010, 5:12:54 AM12/22/10
to gams...@googlegroups.com
Fabi�n
Where are x(l) on your model?
You can substitute x(l) for another name: xx(l).
Why do you want the binaries a subset of the continuous variables?

Regards

Fabi�n Mancilla escreveu:

> --
> You received this message because you are subscribed to the Google
> Groups "gamsworld" group.
> To post to this group, send email to gams...@googlegroups.com.
> To unsubscribe from this group, send email to
> gamsworld+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/gamsworld?hl=en.

babak saleckpay

unread,
Dec 25, 2010, 3:51:21 AM12/25/10
to gams...@googlegroups.com
Hi
I think the easiest way is to seperate the variables :

k1     continious variables /1*225/
k2     binary variables       /225*2025/
;
Variables
x1(k1)
x2(k2)
;
BinaryVariables
x2
;

2010/12/22 Fabián Mancilla <mancill...@gmail.com>
--
You received this message because you are subscribed to the Google Groups "gamsworld" group.
To post to this group, send email to gams...@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.



--
Babak Saleck Pay
Group of Industrial Engineering
M.Sc
Operations Research
University of Tehran
Tehran,Iran

Fabián Mancilla

unread,
Dec 29, 2010, 10:11:02 PM12/29/10
to gams...@googlegroups.com
Edson and Babak:

Well, I have a lot data of a LP problem in a GDX file. But I need consider some like binary and since the coeficients of the matrix "A" & "M" depend of the index "k" (System of the form Ax<=b; Mx=g), I define the subset "I" of "k" and I try to declaring "x(I)" binary variables. Thus the formulation of the equations is more easy (I think). However this seem not possible.

Regars and thanks

Reply all
Reply to author
Forward
0 new messages