[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-glpk] Different constraint for first element of a set than fo
From: |
Noli Sicad |
Subject: |
Re: [Help-glpk] Different constraint for first element of a set than for other elements |
Date: |
Tue, 2 Feb 2010 06:50:30 +0700 |
Hi Marc,
Could you show us the constraint that make this error as well as the
data sets for these 3 sets so we can fix it.
Anyway, here is example how to this period in months:
~~~~~~~~~~
set MONTHS;
param Land_Coef{m in MONTHS, i in CROP};
param Forest_Coef{m in MONTHS,j in FORCROP};
var Land{i in CROP};
# constraint
#subject to LandAllocation(Months): Crop - ForestCrop <= TotalArea
subject to LandAllo{m in MONTHS}:
sum{i in CROP} Land_Coef[m,i] * Land[i] - sum{j in FORCROP}
Forest_Coef[m,j] * LandForest[j] <= TotalArea;
data;
set MONTHS:= Jan Feb Mar Apr May Jun Jul Aug Sept Oct Nov Dec;
~~~~~~~~~~
Regards, Noli
On 2/2/10, Marc Goetschalckx <address@hidden> 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
>