Hi,

what is J, K, RJ and KR?

Can you explain what each set means?

An alternative can be:

eq(J,K,RJ,KR)$(sameas(J,RJ) and sameas(K,KR)).. FlowMSAsMEN(J,K) =E= FlowMSAsREG(RJ,KR);

Bye

## Search found 58 matches

- 1 week ago
- Forum: Syntax
- Topic: kind request: Setting two variables equal in GAMS
- Replies:
**1** - Views:
**65**

- 3 weeks ago
- Forum: Syntax
- Topic: logical equations & binary variables
- Replies:
**13** - Views:
**787**

### Re: logical equations & binary variables

Hi, I think you can try a simple big-M reformulation. I assume that "HS(j)" is continuous and positive. The new variable TWC_HS(j) correspond to TWC(j)*HS(j) x(j) is a binary variable: x(j)=1 if HS(j) >=1000. x(j)=0 if HS(j) < 1000 eq1(j).. HS(j) =g= 1000*x(j); eq2(j).. TWC_HS(j) =g= 3.21*HS(j) - 3....

- 2 months ago
- Forum: Modeling
- Topic: converting an integer variable into a binary variable
- Replies:
**2** - Views:
**265**

### Re: converting an integer variable into a binary variable

Hi, try these equations:

eq.. X =l= M*Y

eq.. X =g= Y

M is a parameter and the upper bound of X

If Y =1

X =l= M

X =g= 1

if Y = 0

X =l= 0

X =g= 0

Bye!

eq.. X =l= M*Y

eq.. X =g= Y

M is a parameter and the upper bound of X

If Y =1

X =l= M

X =g= 1

if Y = 0

X =l= 0

X =g= 0

Bye!

- 3 months ago
- Forum: Syntax
- Topic: logical equations & binary variables
- Replies:
**13** - Views:
**787**

### Re: logical equations & binary variables

Hi, To avoid taking the first element, in my opinion, it is preferable to use this code:

e_T_pi(i)$(ord(i) gt 1) .. T_pi(i)*(m_rc_pb(i)+m_ts_pb(i)) =e= (m_rc_pb(i)*T_ro + m_ts_pb(i)*T_to(i));

Bye!

e_T_pi(i)$(ord(i) gt 1) .. T_pi(i)*(m_rc_pb(i)+m_ts_pb(i)) =e= (m_rc_pb(i)*T_ro + m_ts_pb(i)*T_to(i));

Bye!

- 3 months ago
- Forum: Syntax
- Topic: logical equations & binary variables
- Replies:
**13** - Views:
**787**

### 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));

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));

- 3 months ago
- Forum: Syntax
- Topic: logical equations & binary variables
- Replies:
**13** - Views:
**787**

### 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!

You should review the SolEQU and SolVAR section.

Bye!

- 3 months ago
- Forum: Syntax
- Topic: logical equations & binary variables
- Replies:
**13** - Views:
**787**

### Re: logical equations & binary variables

Hi, It's similar

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

eq2.. m =l= m.up*(1-x)

Bye!

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

eq2.. m =l= m.up*(1-x)

Bye!

- 3 months ago
- Forum: Syntax
- Topic: logical equations & binary variables
- Replies:
**13** - Views:
**787**

### 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!

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!

- 3 months ago
- Forum: Syntax
- Topic: Synthax of binary variables
- Replies:
**3** - Views:
**344**

### 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...

- 3 months ago
- Forum: Modeling
- Topic: Ensuring realations between decision variables
- Replies:
**6** - Views:
**874**

### 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...