Skip to main content

Dear community,

I have a question about min and max values for variables. I have a nonlinear problem. What I want to model is that if the variable a(t) has a value larger than 2,000,000, it should be set to 2,000,000. But it is no problem that a(t) is above 2,000,000, it should not be “punished”. I have the same for the minimum value -400,000. When I just set the min and max values in the range of the variable when I define it, it seems that the optimal solution found is one where the variable a(t) does not exceed 2,000,000 or gets below -400,000.

Am I right in my understanding of the range of variables? And how do I then correctly impose these constraints?

Thank you in advance :)

Hi @kin006. Your understanding of the range of a variable is correct. The range will enforce that the solution value of a(t) must be between -400,000 and 2,000,000.

What do you mean by “if the variable a(t) has a value larger than 2,000,000, it should be set to 2,000,000”? Do you mean that if a(t) is large than 2,000,000 then the objective value should be the same as for a(t) = 2,000,000?


Thank you for the response, @Marcel Hunting!

Yes, I think that is what I am looking for!


This is going to be ugly. I am going to ignore the index t (you have to add them to all variables and constraints below). Let lb = -400,000 and ub = 2,000,000. We need 5 more variables:

 

y with range: glb,ub]

z1: nonnegative

z2: nonnegative

bz1: binary

bz2: binary

 

And then the following constraints:

 

y = a - z1 + z2

y >= lb + (ub - lb) * bz1

y <= ub + (lb - ub) * bz2

z1 <= BigM * bz1

z2 <= BigM * bz2

bz1 + bz2 <= 1

 

Here BigM is a large value. As you already use large values in your model (2,000,000) it might become tricky to select an appropriate value for BigM.

Finally, the variable a(t) should be changed into a free variable, and a(t) should be replaced by y(t) in the objective.

Note the binary variables change the model into a mixed-integer nonlinear problem (MINLP).

A better reformulation might exist.


Thank you, @Marcel Hunting! I will try it :)


Reply


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

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