[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-glpk] Modelling differences in time
From: |
Andrew Makhorin |
Subject: |
Re: [Help-glpk] Modelling differences in time |
Date: |
Sun, 29 Mar 2009 14:59:09 +0300 |
> 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;
Another way:
param month{p in PERIOD} := time2str("%m", str2time("%b", p)) + 0;
"+ 0" is required to convert a symbolic value returned by time2str to
numeric one.