Page 1 of 1


Posted: Fri Jul 26, 2019 11:35 pm
by Omi
In the attachment, 1) constraint 12 has variable x(i,t) but how write that constraint? Do I have to specify three variables x, x1, x0? where x is amount produced.

2) constraint 15, How to write last summation part which is multiplied by M? (k=t+1) to (s-1)

Thank you.

Re: Equation

Posted: Sat Jul 27, 2019 9:09 am
by Renger
Hi Omi

1) Only X^0 seems to be an additional variable. X^(-1) is just 1/X.
2) just multiply it with the sum?

BTW: You should start submitting your own code by now, so people can answer your questions more easily building on what you submit.

Re: Equation

Posted: Sat Jul 27, 2019 3:17 pm
by Omi
Hello Renger,
Thank you for your response.
This is the code I tried to write for the above constraints 12 to 15.
is this correct?
x is a production amount for product j and I want to split this amount.

Code: Select all





Re: Equation

Posted: Mon Jul 29, 2019 8:39 am
by Renger
Hi Omi

It looks fine to me. If you not sure, if the equation does the right thing, you could initialize the variables in the equations to some values, and define checking parameters to see what they produce.
Here a small example:

Code: Select all

set i /1*4/;
variable X(i), OBJ;

equation c1;
c1.. OBJ =E= sum(i, X(i));

* Checking the equations
X.L(i) = 1;

parameter check;
check = sum(i, X.L(i));
display check;
Check should now have 4 as value. You could do the same thing with the equations of your model.



BTW: If you sent code, make sure it runs. In order to check your equations by running the code, I had to make some assumptions and so it is hard to say if the equations are really correct.
I had to add the following to be able to run the code:

Code: Select all

set i /1*4/,  t /1*4/,  j /1*2/;


variables r(k), x(j,t), x1(j,t), x0(j,t), z(j,t);

parameter M /1000/, mi /199/;

parameter u(j,j,t);


equations ct3, ct4, ct5,ct6;