Skip to main content
Solved

upper bound for variable 1 = value of variable 2

  • May 1, 2021
  • 6 replies
  • 165 views

Forum|alt.badge.img

hello everyone,

i have a question about my aimms project:

i have two variables: x(t,k) and y(t,k)

now i want to determine, that

if x(t,k) < y(t,k) then y(t,k) = x(t,k)

i already know that this is not possible with an if-statement.

has anybody an idea?

 

Thanks in advance.

Seb

 

Best answer by akumar

One way to approach this is to introduce an auxillary variable z(t,k) and solve for following 

Max z(t,k)

s.t 

z(t,k)  <=  x(t,k)

z(t,k) <= y(t,k)

 

Other way, you can try out is:

Write following constraints (introduce dummy binary variable delta(t,k) and build following relations)

x(t,k) <= y(t,k) + (big-M)*delta(t,k)

x(t,k) >= y(t,k) -(big-M) *(1-delta(t,k))

Write Indicator constraints in AIMMS as 

if delta(t,k)=0 then z(t,k) = x(t,k)

if delta(t,k)=1 then z(t,k) = y(t,k)

 

Best Wishes,
Kumar.

6 replies

gdiepen
AIMMS Champ
Forum|alt.badge.img+7
  • AIMMS Champ
  • 155 replies
  • May 1, 2021

What type of variables are x and y? Binary, integer, or continuous? 


Forum|alt.badge.img

both are integer variables.


gdiepen
AIMMS Champ
Forum|alt.badge.img+7
  • AIMMS Champ
  • 155 replies
  • May 1, 2021

But kan x also be greater than y? That is not completely clear to me from what you write.

 


Forum|alt.badge.img

yes, that’s right. x can also be greater than y.

so in short i compare two variables and want both to adopt the lower value. 


  • Explorer
  • 2 replies
  • Answer
  • May 2, 2021

One way to approach this is to introduce an auxillary variable z(t,k) and solve for following 

Max z(t,k)

s.t 

z(t,k)  <=  x(t,k)

z(t,k) <= y(t,k)

 

Other way, you can try out is:

Write following constraints (introduce dummy binary variable delta(t,k) and build following relations)

x(t,k) <= y(t,k) + (big-M)*delta(t,k)

x(t,k) >= y(t,k) -(big-M) *(1-delta(t,k))

Write Indicator constraints in AIMMS as 

if delta(t,k)=0 then z(t,k) = x(t,k)

if delta(t,k)=1 then z(t,k) = y(t,k)

 

Best Wishes,
Kumar.


Andrew
  • Former AIMMSian
  • 50 replies
  • May 25, 2021

Hi @Sebastian Schäfer  

Did @akumar ‘s answer help you with your solution?

 

 



Didn't find what you were looking for? Try searching on our documentation pages:

AIMMS Developer & PRO | AIMMS How-To | AIMMS SC Navigator