[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-glpk] Re: ordered and ord in MathProg?
From: |
Andrew Makhorin |
Subject: |
Re: [Help-glpk] Re: ordered and ord in MathProg? |
Date: |
Tue, 9 Feb 2010 07:35:13 +0300 |
>>> set TT := 1jan04 # Time Buckets
>>> 2jan04
>>> 3jan04
>>> 4jan04
>>> 5jan04
>>> 6jan04
>>> 7jan04
>>> 8jan04 ;
>>
>> Easiest way is to define TT as follows:
>>
>> set TT := 1 2 3 4 5 6 7 8;
>>
>> in which case ord(t) = t.
>>
> Yes. I think these "ordered" and "ord() can rest in peace now.
> MathProg got solution for this problem.
On printing you can convert elements of TT to calendar dates as
follows:
set TT := 1..8;
param START, symbolic, := "1jan04";
printf{t in TT} "...%s...",
time2str(str2time(START, "%d%b%y")+86400*(t-1), "%d%b%y");
(See also the example model cal.mod in glpk/examples.)