Search found 118 matches

by Manassaldi
6 years ago
Forum: Modeling
Topic: Maximizing the difference in the order of binary variables
Replies: 28
Views: 18835

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
6 years ago
Forum: Modeling
Topic: Modeling the absolute value
Replies: 23
Views: 22035

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...
by Manassaldi
6 years ago
Forum: Modeling
Topic: Modeling the absolute value
Replies: 23
Views: 22035

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) =...
by Manassaldi
6 years ago
Forum: Modeling
Topic: Modeling the absolute value
Replies: 23
Views: 22035

Re: Modeling the absolute value

Hi,
What kind of variables are z and j?
by Manassaldi
6 years ago
Forum: Modeling
Topic: Modeling the absolute value
Replies: 23
Views: 22035

Re: Modeling the absolute value

Hi again PeterBe, I think this can works x(t) and c(t) are continuous variables p(t) are binary variables M is a sufficiently large number (BigM parameter) if "p=1", by "eq3" (x-c) is greater than 0 so by "eq1" and "eq2" absvalue = x-c (the rest of equation ar...
by Manassaldi
6 years ago
Forum: Modeling
Topic: Maximizing the difference in the order of binary variables
Replies: 28
Views: 18835

Re: Maximizing the difference in the order of binary variables

HI, I think that the first approximation generate a smaller model that require lower memory. But i don't know how much memory will consume.
I don't know if there are any way to estimate how much memory the model needs

Best regard
by Manassaldi
6 years ago
Forum: Modeling
Topic: Maximizing the difference in the order of binary variables
Replies: 28
Views: 18835

Re: Maximizing the difference in the order of binary variables

Yes, this BigM formulation generates a very large model...
by Manassaldi
6 years ago
Forum: Modeling
Topic: Maximizing the difference in the order of binary variables
Replies: 28
Views: 18835

Re: Maximizing the difference in the order of binary variables

Hi Peter, no, for bigM reformultation you don't have to use thousands of equations. The model that I showed was complete, but when is expanded is very bigger. As i say previously, if you could found a compact way to express the first formulation of the problem the model will result more small and ea...
by Manassaldi
6 years ago
Forum: Modeling
Topic: Maximizing the difference in the order of binary variables
Replies: 28
Views: 18835

Re: Maximizing the difference in the order of binary variables

Hi, 1) In your first formulation I think you have to insert equations for all timeslots and the number of time in which x is has to be know in advance. Is that correct? You have to propose the maximum number of time in which x=1, this is an upper bound. You don't has to know the number of time in wh...
by Manassaldi
6 years ago
Forum: Modeling
Topic: Maximizing the difference in the order of binary variables
Replies: 28
Views: 18835

Re: Maximizing the difference in the order of binary variables

I think that the first formulation of the problem is better than the BigM. In the first approximation you must to type more equation but the final size is lower. Maybe, if you could found a compact way to express the first formulation the model will result small an easy to implement. If an upper bou...