[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-glpk] Modelling differences in time
From: |
xypron |
Subject: |
Re: [Help-glpk] Modelling differences in time |
Date: |
Sun, 29 Mar 2009 03:09:48 -0700 (PDT) |
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-tp22723127p22766033.html
Sent from the Gnu - GLPK - Help mailing list archive at Nabble.com.