Search found 44 matches

by Manassaldi
3 weeks ago
Forum: Modeling
Topic: Problem with Constraint
Replies: 1
Views: 66

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
1 month ago
Forum: Syntax
Topic: Calibration by linear interpolation
Replies: 3
Views: 136

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
1 month ago
Forum: Syntax
Topic: Calibration by linear interpolation
Replies: 3
Views: 136

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
1 month ago
Forum: Modeling
Topic: Maximizing the difference in the order of binary variables
Replies: 28
Views: 806

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
1 month ago
Forum: Modeling
Topic: Maximizing the difference in the order of binary variables
Replies: 28
Views: 806

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
1 month ago
Forum: Syntax
Topic: how to display the current value of a set
Replies: 1
Views: 78

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;
by Manassaldi
1 month ago
Forum: Modeling
Topic: Maximizing the difference in the order of binary variables
Replies: 28
Views: 806

Re: Maximizing the difference in the order of binary variables

Hi, I think you can try with this... eq01(tp).. x(tp) =e= sum(t,xpos(tp,t)*ord(tp)) eq02(tp).. c(tp) =e= sum(t,ypos(tp,t)*ord(tp))}); eq1(tp).. absvalue(tp) =l= x(tp) - c(tp) + (1-p(tp))*M; eq2(tp).. absvalue(tp) =g= x(tp) - c(tp) - (1-p(tp))*M; eq3(tp).. x(tp) - c(tp) =g= -(1-p(tp))*M eq4(tp).. abs...
by Manassaldi
2 months ago
Forum: Modeling
Topic: Modeling the absolute value
Replies: 21
Views: 1170

Re: Modeling the absolute value

Hi, the dollar command is used to manipulate the sets. For example, if the restrictions eq1, eq2, eq3 and eq4 does not apply to the last "t": eq1(n,m,t)$(ord(t) ne card(t)).. 1 - z(n,m,t) + z(n,m,t+1) + absvalue(n,m,t) =g= 1; eq2(n,m,t)$(ord(t) ne card(t)).. 1 - z(n,m,t) + 1-z(n,m,t+1) + 1-absvalue(...
by Manassaldi
2 months ago
Forum: Modeling
Topic: Modeling the absolute value
Replies: 21
Views: 1170

Re: Modeling the absolute value

Hi, this constraints are equivalent to "sum((n,m,t),abs(z(n,m,t) - z(n,m,t+1)) =l= 2*j" With the command "$" you must decide what happens with the last t eq1(n,m,t).. 1 - z(n,m,t) + z(n,m,t+1) + absvalue(n,m,t) =g= 1; eq2(n,m,t).. 1 - z(n,m,t) + 1-z(n,m,t+1) + 1-absvalue(n,m,t) =g= 1; eq3(n,m,t).. z...
by Manassaldi
2 months ago
Forum: Modeling
Topic: Modeling the absolute value
Replies: 21
Views: 1170

Re: Modeling the absolute value

Hi,
What kind of variables are z and j?