help-glpk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-glpk] Different constraint for first element of a set than for


From: Pietro Scionti
Subject: Re: [Help-glpk] Different constraint for first element of a set than for other elements
Date: Wed, 3 Feb 2010 00:39:24 -0800 (PST)

You could use the "if" statement inside the RHS together with a symbolic
parameter to single out the first period, like this:

set PERIODS;
param Initial_Period symbolic in PERIODS;


subject to Supply_Capacity {i in SUPPLIERS, t in PERIODS}:
    purchase [i,t] <=  capacity [i,t] + if t = Initial_Period then
initial_inventory [i] - inventory[i,t] else  inventory [i,t-1] - inventory
[i,t];

I'm guessing you could treat the inventory parameter in the same way


Marc Goetschalckx wrote:
> 
> The model has a different constraint for the first element of a set (say 
> PERIODS) than for all remaining elements.
> I have defined three sets:
> INITIAL_PERIOD;
> OTHER_PERIODS;
> PERIODS := INITIAL_PERIOD union OTHER_PERIODS;
> when MathProg is generating the model and specifically constraints over 
> the PERIODS set it terminates with the following error
> 
> cannot convert JAN to floating-point number
> 
> where JAN is the first period in OTHER_PERIODS
> How should the model be written in MathProg to allow different 
> constraints for the first element.
> Thanks
> 
> _______________________________________________
> Help-glpk mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/help-glpk
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Different-constraint-for-first-element-of-a-set-than-for-other-elements-tp27413242p27433008.html
Sent from the Gnu - GLPK - Help mailing list archive at Nabble.com.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]