Search found 84 matches

1 year ago
Forum: Syntax
Topic: logical equations & binary variables
Replies: 18
Views: 2924

Re: logical equations & binary variables

Hi, In another post I suggested this equation

e_T_pi(i+1) .. T_pi(i+1)*(m_rc_pb(i+1)+m_ts_pb(i+1)) =e= (m_rc_pb(i+1)*T_ro + m_ts_pb(i+1)*T_to(i+1));
1 year ago
Forum: Syntax
Topic: logical equations & binary variables
Replies: 18
Views: 2924

Re: logical equations & binary variables

Hi, the equation listing and column Listing shows the value on the initial point, not in the solution. The equations are fine.
You should review the SolEQU and SolVAR section.
Bye!
1 year ago
Forum: Syntax
Topic: logical equations & binary variables
Replies: 18
Views: 2924

Re: logical equations & binary variables

Hi, It's similar

eq1.. m =g= m.lo*(1-x);
eq2.. m =l= m.up*(1-x)

Bye!
1 year ago
Forum: Syntax
Topic: logical equations & binary variables
Replies: 18
Views: 2924

Re: logical equations & binary variables

Hi, try these equations

eq1.. m =g= m.lo*x;
eq2.. m =l= m.up*x;

m.lo (lower bound)
m.up (upper bound)

if x=1
m greater than m.lo*1;
m lower than m.up*1
if x=0
m greater than m.lo*0;
m lower than m.up*0;
so, m = 0

Bye!
1 year ago
Forum: Syntax
Topic: Synthax of binary variables
Replies: 3
Views: 744

Re: Synthax of binary variables

I think this can work. I do not understand why you use (i + 1) instead of (i) e_T_pi(i+1) .. T_pi(i+1)*(m_rc_pb(i+1)+m_ts_pb(i+1)) =e= (m_rc_pb(i+1)*T_ro + m_ts_pb(i+1)*T_to(i+1)); If you want to avoid the first value of i, you can use this equation. e_T_pi(i)\$(ord(i) ne 1).. T_pi(i)*(m_rc_pb(i)+m_t...
1 year ago
Forum: Modeling
Topic: Ensuring realations between decision variables
Replies: 6
Views: 1785

Re: Ensuring realations between decision variables

Hi Peter, I think that with the auxiliary variable "on(t)" can work. If on(t)=1 x(t) or y(t) = 1 If on(t)=0 x(t) and y(t) = 0 eq1(t).. x(t) + y(t) =l= 1; eq2(t).. 1-on(t) + x(t) + y(t) =g= 1; eq3(t).. on(t) + 1-x(t) =g= 1; eq4(t).. on(t) + 1-y(t) =g= 1; eq5(t,tp)\$(ord(t) gt 1 and ord(tp) gt ord(t) a...
1 year ago
Forum: Syntax
Topic: Synthax of binary variables
Replies: 3
Views: 744

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
1 year ago
Forum: Syntax
Topic: logical condition with equation definitions and variables
Replies: 4
Views: 966

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!
1 year ago
Forum: Syntax
Topic: logical condition with equation definitions and variables
Replies: 4
Views: 966

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
1 year ago
Forum: Syntax
Topic: Questions about Summation
Replies: 1
Views: 834

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\$...