help-glpk
[Top][All Lists]
Advanced

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

Re: [Help-glpk] Modelling differences in time


From: Jiri K
Subject: Re: [Help-glpk] Modelling differences in time
Date: Mon, 30 Mar 2009 02:07:39 -0700 (PDT)

Thank you,
actually this is what I thought of doing, I just did not know how to use the
parameter to define the constraint, but I have figured out:)
Jiri


xypron wrote:
> 
> Hello Jiri
> 
> Jiri K wrote:
>> 
>> Dear all,
>> In my model I need to care about the values of a variable in consecutive
>> periods. Therefore in the formulas I operate with differences like 
>> 
>> {i in PERIOD: i>1} x[i]-x[i-1]
>> 
>> However this only works when periods are described with numbers which
>> always increment by 1. How could I simply model this if the members of
>> the PERIOD set are e.g. 'Jan', 'Feb' etc?
>> 
> 
> you will need a parameter translating the strings to numbers.
> 
> set PERIOD;
> param month{p in PERIOD};
> data;
> set PERIOD := 
>   Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec;
> 
> param month :=
>   Jan 1 Feb 2 Mar 3 Apr 4 May 5 Jun 6 Jul 7 Aug 8 Sep 9 Oct 10 Nov 11 Dec
> 12;
> end;
> 
> Best regards
> 
> Xypron
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Modelling-differences-in-time-tp22723127p22778963.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]