Skip to main content
Solved

How to get ranges for specific values of variables


Forum|alt.badge.img

Hello, everyone!Now I have a problem about how to set ranges for specific values of a variable.

 I have a variable “Cmatrix(t,x,conv) ” and “t,x,conv” are some sets.  I need that Cmatrix(t,x,conv) ∈ [-1,1] only when conv ≠ 'Heat_pump' . And Cmatrix(t,x,conv) >1 only when conv = 'Heat_pump'. 

How do I write this in the red box?

 

When I set a constraint to bound the “Cmatrix(t,x,conv) ”, there will be errors as “The solver CONOPT 4.1 cannot handle the ranged constraint Cmatrix_except_HP(1,Elec,CHP_engine) in mathematical program "Cost_minimization"; please define the middle term as a variable and add bounds.”

 

Can some kind person save me? Thank you so so so much! Wish you happy every day.

Best answer by gdiepen

Wouldn’t it be an option to use the range attribute?

 

You could create a parameter cMatrix_lowerbound(conv)  and parameter cMatrix_upperbound(conv) that have definition based on the equality to ‘Heat_pump’. In the cMatrix variable, you would then use these lowerbound and upperbound  parameters in the range (if you open  the wizard you will be able to select them)

View original

gdiepen
AIMMS Champ
Forum|alt.badge.img+7
  • AIMMS Champ
  • March 14, 2022

Wouldn’t it be an option to use the range attribute?

 

You could create a parameter cMatrix_lowerbound(conv)  and parameter cMatrix_upperbound(conv) that have definition based on the equality to ‘Heat_pump’. In the cMatrix variable, you would then use these lowerbound and upperbound  parameters in the range (if you open  the wizard you will be able to select them)


Forum|alt.badge.img
  • Ace
  • March 15, 2022
gdiepen wrote:

Wouldn’t it be an option to use the range attribute?

 

You could create a parameter cMatrix_lowerbound(conv)  and parameter cMatrix_upperbound(conv) that have definition based on the equality to ‘Heat_pump’. In the cMatrix variable, you would then use these lowerbound and upperbound  parameters in the range (if you open  the wizard you will be able to select them)

Thank you so much!


Reply