[FlopCpp] Returning to the shell (FlopC++ constraint)
Tim Hultberg
Tim.Hultberg at eumetsat.int
Tue Feb 13 03:12:11 EST 2007
Hi Vishy,
second thing first:
To get the constraint to compile you must use
(li>MP_index_exp(curLev(A,I)) instead of (li>curLev(A,I) [and
similarly for the (lj>curLev(A,I)]
For the first thing, I am not sure. I would be helpfull if you could
provide the complete model (since when I am running with some dummy
objective I dont observe the problem).
You might try to cure it by using MP_index_exp explicitly, i.e. (
li>MP_index_exp(curLev(A,I)-1) ) ,etc. whenever you are comparing an
index with some expression.
Hope this helps.
Cheers, Tim
>>> "Vishy Jeet" <vishv.jeet at gmail.com> 12/02/2007 18:22:10 >>>
Hi,
I have written a little piece of my program below, the constraint
CostITDevCon2 is causing a problem, I can compile my program without
any
errors/warnings, but when I run it, the program hangs and I don't get
any
message to know what went wrong. When I remove this constraint from
the
overall program everything works just fine. I think something is
seriously
wrong with this constraints, don't know what. Any help on this much
appreciated.
#define bigM 10000
MP_set A(3), I(4), L(3);
MP_data curLev(A,I), itDevCost(A,I,L)
MP_constraint CostITDevCon2(A,I)
MP_index li, lj; //alias for set L
MP_variable U(A,I,L), DC(A,I);
DC.lowerLimit(A, I) = 0;
U.binary();
CostITDevCon2(A,I).such_that(curLev(A,I)>=1) =
DC(A,I) >= sum(L(li).such_that(li>curLev(A,I)-1),
(1-sum(L(lj).such_that((lj>curLev(A,I)-1) &&
(lj<=li)), U(A,I,lj)))*itDevCost(A,I,li)) +
bigM*(sum(L.such_that(L>curLev(A,I)-1),
U(A,I,L))-1);
The other strange thing is this when I write the above constraint like
below, I can't even compile my program:
CostITDevCon2(A,I).such_that(curLev(A,I)>=1) =
DC(A,I) >= sum(L(li).such_that(li>curLev(A,I)),
(1-sum(L(lj).such_that((lj>curLev(A,I)) &&
(lj<=li)), U(A,I,lj)))*itDevCost(A,I,li)) +
bigM*(sum(L.such_that(L>curLev(A,I)),
U(A,I,L))-1);
Here I just remove "-1" from all such_that blocks; everything else is
just
the same.
For some verification purpose, I rewrote the entire program in
GAMS/CPLEX
combo and it works just fine over there.
curLev(A,I) is the data that contains either 1, 2, or 3.
best regards,
--vishy
_______________________
Youngest Music Meastro
Mayank Sahu
http://www.mayanksahu.net
More information about the FlopCpp
mailing list