Reply-to: gamsworld@googlegroups.com

Dear all,

I have a scheduling problem, in which I want to make the values of the

parameters (a(i)) are depending on the values of the variables (x(i)).

The correlation is below:

## If a variable at a certain time is “1”, then the next parameter is its

prior value plus “1”.

If a variable at a certain time is “0”, then the next parameter is

“1”.

## a(i)=1;

if (x.l(i)=1,

a(i+1)=a(i)+1;

elseif x.l(i)=0,

a(i+1)=1;

);

);

## Below is the code:

set i days /1*20/;

variables x(i);

x.l(i)=1;

parameter CostClean, CostLoss, a(i);

CostClean = 50000;

CostLoss = 10000;

variables

Qloss(i), QlossTot(i), Total;

a(i)=1;

if (x.l(i)=1,

a(i+1)=a(i)+1;

elseif x.l(i)=0,

a(i+1)=1;

);

);

Equation

hitungQloss, hitungQlossTot, hitungTotal;

hitungQloss… Qloss(i) =e= CostLoss*a(i);

hitungQlossTot… QlossTot(i) =e= x(i)*Qloss(i)+(1-x(i))*CostClean;

hitungTotal… Total =e= sum(i,QlossTot(i));

model totok /all/;

## solve totok using minlp minimizing Total;

When I run this, error comes saying “Uncontrolled set entered as

constant” on the if statement of “x.l(i)”.

Then, I make a loop for the “if statement” above, and I got the same

error but on the equation of Qloss(i).

And, if I want to make all equations in the loop, it is not allowed.

Could you please help me with this?

Thank you very much,

Zulfan

\