I want to selectively set and disable integer constraints on some variables in a model. Something like this:
set index_values := {"A","B","C","D"};
set index_subset := {"B","D"};
var x{index_values};
subject to SomeIntegerConstraints{i in index_subset}: x[i] integer;
# force x[i] to take integer values for i in index_subset;
with the option to then drop and undrop the integer constraint later on, as I would with other constraint types.
But so far, the only way I've found to set an integer constraint is as part of the variable declaration. I can suppress integer constraints with option relax_integrality 1, but this is all-or-nothing; it doesn't allow me to selectively disable just some of the integer constraints.
I can work around the issue by adding extra variables and constraints:
var integer_values{index_subset} integer;
subject to ForceIntegers{i in index_subset}: x[i]=integer_values[i];
which effectively sets an integer constraint on those values, and then I can disable/enable that constraint by dropping/undropping ForceIntegers. But this seems a bit clumsy. Is there a better way to do this?
Cheers - Geoffrey
Dr. Geoffrey Brent
Assistant Director (a/g)
National Accounts Branch | Macroeconomic Statistics Division | Australian Bureau of Statistics
(P) (03) 9615 7685 (M) 0422 65 35 26
(E) geoffre...@abs.gov.au (W) www.abs.gov.au
The ABS Privacy Policy outlines how the ABS will handle any personal information that you provide to us.