[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Help-glpk] Empty Sets
From: |
Matteo Salani |
Subject: |
[Help-glpk] Empty Sets |
Date: |
Wed, 23 Feb 2011 16:02:17 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.15) Gecko/20101027 Thunderbird/3.0.10 |
I have a big model with sets, parameters, variables and constraints
divided in three sections and
interacting in 1 constraint.
I would like to use empty sets to basically "remove" parts of the model
dynamically via the data file.
The problem is that in my model some subsets are defined and this makes
GLPK unhappy.
Without posting the entire model, the problem is exactly equivalent to
make GLPK digest the following model:
param m, integer, >= 0;
set T := 1 .. m;
set S;
param aParameter{s in S}, integer, >= 0;
param anotherParameter{s in S, t in T}, >= 0;
set aSubSet{s in S} within T := {t in T : t > aParameter[s]};
var aVariable{s in S}, >= 0;
s.t. aConstraint{s in S, t in aSubSet[s]}: aVariable[s] >=
anotherParameter[s,t];
This (clearly) works when S is non empty (e.g., with the following data)
param m := 3;
set S := 1;
param aParameter := 1 2 ;
param anotherParameter :=
1 1 10
1 2 20
1 3 10
;
S can be empty and the model works perfectly if I hard code this info,
i.e. the follwing model perfectly works:
param m, integer, >= 0;
set T := 1 .. m;
set S := {}; /* Hard coding an empty set */
param aParameter{s in S}, integer, >= 0;
set aSubSet{s in S} within T := {t in T : t > aParameter[s]};
param anotherParameter{s in S, t in T}, >= 0;
var aVariable{s in S}, >= 0;
s.t. aConstraint{s in S, t in aSubSet[s]}: aVariable[s] >=
anotherParameter[s,t];
when I try to specify an empty set in the data file I cannot make it
work, though it is working in the above version:
set S := {}; /* In the data file */
obtaining: syntax error in set data block
the other way round does not work either, i.e., defining an empty set in
the model and trying to override this in the data file.
Whatever suggestion is appreciated.
Thanks!
M
--
*Matteo Salani*
IDSIA
Galleria 2
6928 Manno-Lugano Switzerland
Web: http://www.idsia.ch/~salani <http://www.idsia.ch/%7Esalani>
Email: address@hidden <mailto:address@hidden>
Phone: +41 58 666 66 71
- [Help-glpk] Empty Sets,
Matteo Salani <=