[Cmpl] Error
Oscar Augusto Téllez Sánchez
oskarts at gmail.com
Sun Jun 1 17:36:01 EDT 2014
Thank you very much!
i have found these and some errors more. however, with the last one…i give up, any idea? i have tried many ways but nothing
create model instance ...
error (compiler): file biomass.cmpl line 21: array dimensions don't match
CMPL model generation - failed
here is new version of program:
%data biomass-data.cdat : FARMS set, SIZE set, SP,TC,PC,CF[SIZE], Q[FARMS], K[SIZE],d[FARMS,FARMS], gamma[FARMS]
variables:
#Quantity of waste treated at plant i
X[FARMS]: real[0..];
#Quantity of waste send from farm j to plant i
XS[FARMS,FARMS]: real[0..];
#1 if plant i is installed with capacity k
Y[FARMS,SIZE]: binary;
#1 if we send waste from farm j to plant i
W[FARMS,FARMS]: real[0..];
objectives:
Profit: sum{i in FARMS: (SP-PC)* X[i] }
+ sum{i in FARMS, j in FARMS : TC * XS[i,j] * d[i,j]}
+ sum{i in FARMS, k in SIZE : Y[i,k] * CF[k] } ->max;
constraints:
# you cannot send more than farm´s capacity
farms {j in FARMS: sum{i in FARMS: X[i,j]} <= sum{i in FARMS:Q[j]*W[i,j]};}
#A farm can only send to one plant
exclusivity {i in FARMS : sum{j in FARMS: W[i,j]} = 1;}
#Maximum one plant per site
nPlants {i in FARMS : sum{k in SIZE: Y[i,k]} <= 1;}
#You can send to i only if there is a plant there
cond1 {i in FARMS: sum{j in FARMS: W[i,j]} <= sum{k in SIZE: Y[i,k]};}
#Production capacity
ProductionCap: X[] <= K[]*Y[,];
# Equivanlence between what is send (waste) and what is produce (methane)
equivalence {i in FARMS: gamma[i]*X[i] = sum{j in SIZE: XS[i,j]};}
thank you in advance
Oscar
On Jun 1, 2014, at 9:35 PM, Mike Steglich <mike.steglich at berlin.de> wrote:
> Hi Oscar,
>
> In line 16 you specified K as index in the sum header but k is used within the sum body. The same issue is happened in line 20: k defined in the sum header but K is used in the body.
>
> Cheers,
>
> Mike
>
> Am 01.06.2014 um 16:45 schrieb Oscar Augusto Téllez Sánchez <oskarts at gmail.com>:
>
>> Good day,
>>
>> here is my problem… when i run my program this is the message
>>
>> create model instance ...
>> error (compiler): file biomass.cmpl line 16: syntax error, unexpected ASSIGN_ITER, expecting ':'
>> error (compiler): file biomass.cmpl line 20: syntax error, unexpected ASSIGN_ITER, expecting ':'
>> error (compiler): file biomass.cmpl line 20: syntax error, unexpected '}', expecting end of file
>> CMPL model generation - failed
>>
>> I am following the standard and i don´t know why is asking me to put (:) any idea how to solve it? (in bold are the referred lines)
>>
>> thank you in advance ;) my code is below
>>
>> Oscar
>>
>> Program:
>> %data biomass-data.cdat : FARMS set, SIZE set, SP,TC,PC,CF[SIZE], Q[FARMS], K[SIZE],d[FARMS,FARMS], gamma[FARMS]
>>
>> variables:
>> #Quantity of waste treated at plant i
>> X[FARMS]: real[0..];
>> #Quantity of waste send from farm j to plant i
>> XS[FARMS,FARMS]: real[0..];
>> #1 if plant i is installed with capacity k
>> Y[FARMS,SIZE]: binary;
>> #1 if we send waste from farm j to plant i
>> W[FARMS,FARMS]: real[0..];
>>
>> objectives:
>> Profit: sum{i in FARMS: (SP-PC)* X[i] }
>> + sum{i in FARMS, j in FARMS : TC * XS[i,j] * d[i,j]}
>> + sum{i in FARMS, K in SIZE : Y[i,k] * CF[k] } ->max;
>>
>> constraints:
>> #Maximum one plant per site
>> nPlants {i in FARMS : sum{k in SIZE: Y[i,K]} <= 1;}
>>
>> #A farm can only send to one plant
>> exclusivity {i in FARMS : sum{j in FARMS: W[i,j]} = 1;}
>>
>> #You can send to i only if there is a plant there
>> cond1 {i in < FARMS: sum{j in FARMS: W[i,j]} <= sum{k in SIZE: Y[i,K]};}
>>
>> # Equivanlence between what is send (waste) and what is produce (methane)
>> equivalence {i in < FARMS: gamma[i]*X[i] = sum{j in SIZE: XS[i,j]};}
>>
>> #Production capacity
>> ProductionCap {i in < FARMS: x[i] <= sum{k in SIZE: Y[i,K]*KP[K]};}
>>
>> # you cannot send more than farm´s capacity
>> farmsCapacity {j in < FARMS: sum{i in FARMS: X[i,j]} <= sum{i in FARMS: W[i,j]*Q[j]};}
>>
>>
>>
>>
>>> _______________________________________________
>>> Cmpl mailing list
>>> Cmpl at list.coin-or.org
>>> http://list.coin-or.org/mailman/listinfo/cmpl
>>
>> _______________________________________________
>> Cmpl mailing list
>> Cmpl at list.coin-or.org
>> http://list.coin-or.org/mailman/listinfo/cmpl
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/cmpl/attachments/20140601/4b503192/attachment.html>
More information about the Cmpl
mailing list