Search found 118 matches

by Manassaldi
6 years ago
Forum: Syntax
Topic: Synthax of binary variables
Replies: 3
Views: 3520

Re: Synthax of binary variables

e1_npb(i) .. m_pb_rc(i) =l= (1-npb(i) )*M;
e2_npb(i) .. m_pb_ts(i) =l= (1-npb(i) )*M;

With these equations when npb(i) take the value of 1, m_pb_rc (i) and m_pb_ts (i) are 0.
I can not understand the idea of the problem but this may help you.
Best
by Manassaldi
6 years ago
Forum: Syntax
Topic: logical condition with equation definitions and variables
Replies: 4
Views: 4863

Re: logical condition with equation definitions and variables

Hi, the equations can not vary during the resolution. To relate variables or take logical decisions you will need to use binary variables.
Best!
by Manassaldi
6 years ago
Forum: Syntax
Topic: logical condition with equation definitions and variables
Replies: 4
Views: 4863

Re: logical condition with equation definitions and variables

Hi, logical conditions apply to the equations.

e_charge(i+1)$(m_rc_ts(i+1) > 0).. dec(i+1) =e= 1;

Best
by Manassaldi
6 years ago
Forum: Syntax
Topic: Questions about Summation
Replies: 1
Views: 2949

Re: Questions about Summation

Hello, you have many alternatives: sets t /t1*t10/ ; (1) sum(t$(ord(t) ge 2),x(t)) (2) sum(t$(ord(t) ne 9 and ord(t) ne 10),x(t)) =e= 1 sum(t$(ord(t) ge 2 and ord(t) le 7),x(t)) =e= 1 using subsets: sets t /t1*t10/ sum1(t) /t2*t10/ sum2(t) /t1*t8/ sum3(t) /t2*t7/ ; (1) sum(t$sum1(t),x(t)) (2) sum(t$...
by Manassaldi
6 years ago
Forum: Modeling
Topic: Problem with Constraint
Replies: 1
Views: 2564

Re: Problem with Constraint

Hi, try a Mc Cormick relaxation for bilinear product. This is a linear approximation of a product of two variables. obviously you will find a difference with the exact solution. regards!
by Manassaldi
6 years ago
Forum: Syntax
Topic: Calibration by linear interpolation
Replies: 3
Views: 4104

Re: Calibration by linear interpolation

hi, try this: lsquaredeq.. lsquared =E= sum((t,year)$(ord(t) eq ceil(ord(year)/5)), power((MATy(year)-MAT.l(t))/MAT.l(t),2) + power((MLy(year)-ML.l(t))/ML.l(t),2) + power((MUy(year)-MU.l(t))/MU.l(t),2) + power((TATMy(year)-TATM.l(t))/TATM.l(t),2) + power((TOCEANy(year)-TOCEAN.l(t))/TOCEAN.l(t),2) );...
by Manassaldi
6 years ago
Forum: Syntax
Topic: Calibration by linear interpolation
Replies: 3
Views: 4104

Re: Calibration by linear interpolation

Hello, according to your example I think that the final periods correspond to 45 years. A zero-time value is required to complete the 50 years. I can be wrong anyway Bye! This is an example: set t /1*10/ set year Years /1*45/; PARAMETERS E(t) /1 100 2 200 3 300 4 400 5 500 6 600 7 700 8 800 9 900 10...
by Manassaldi
6 years ago
Forum: Modeling
Topic: Maximizing the difference in the order of binary variables
Replies: 28
Views: 19211

Re: Maximizing the difference in the order of binary variables

Hi, I do not completely remember your model. I think this can work. eq1(t,tp).. sum(tpp$(ord(tpp) le ord(t)),x(tpp)) =l= ord(tp) + (1-xpos(tp,t))*1440; eq2(t,tp).. sum(tpp$(ord(tpp) le ord(t)),x(tpp)) =g= ord(tp) - (1-xpos(tp,t))*1440; eq3(tp).. sum(t,xpos(tp,t)) =l= 1; eq4(t,tp).. sum(tpp$(ord(tpp)...
by Manassaldi
6 years ago
Forum: Modeling
Topic: Maximizing the difference in the order of binary variables
Replies: 28
Views: 19211

Re: Maximizing the difference in the order of binary variables

Hi, x(tp) is the sum of the product between a binary variable and its position, so I suppose that is an integer variable (not binary). Anyway, I think it's better to define it as a continuous variable.
by Manassaldi
6 years ago
Forum: Syntax
Topic: how to display the current value of a set
Replies: 2
Views: 4056

Re: how to display the current value of a set

Hi, you can try this..

set Yr /1*14/;
scalar YrOrd;
loop(Yr,
YrOrd=ord(Yr);
display YrOrd;
);

or

set Yr /1*14/;
parameter YrOrd(Yr);
loop(Yr,
YrOrd(Yr)=ord(Yr);
);

display YrOrd;