gams:restrict_the_increments_of_a_variable_to_certain_values_only

**This is an old revision of the document!**

Q: *I've got a model that is working correctly. It includes a positive variable x(metals), which contains the results I'm seeking. I thought it might be interesting to restrict X to increments of a quarter of a unit. For example,
x = 1, 1.25, 1.5, 1.75, 2, etc. would be encouraged, while x = 1.35, 1.47, etc., would be discouraged.*

Contributed by Arne Drud: You will need an integer variable. An addition of something like this should work:

Integer variable y; equation y2xdef; y2xdef .. x =E= 1 + 0.25*y;

You should note, that if your original model was an LP the new model is a MIP model, and the solution time could be much larger. Also note, the default upper bound on an integer variable is 100 which will translate into an upper bound on x of 1+0.25*100 = 26. If you have larger x-values you can increase the upper bound on y, but rounding for large X-values does not make much sense.

IMPRESSUM / LEGAL NOTICE
PRIVACY POLICY
gams/restrict_the_increments_of_a_variable_to_certain_values_only.1213873194.txt.gz · Last modified: 2008/06/19 12:59 by support