How do I relax the integrality of only some of a model’s integer variables?

For each variable whose integrality you want to relax, assign a positive value to variable-name.relax . For example, if your model has

var X {1..n} integer >= 0; 
var Y {1..m} integer >= 0;

then to relax the integrality of only the Y variables, you can use the command

let {i in 1..m} Y[i].relax := 1;

To remove a relaxation specified in this way, assign a nonpositive value to variable-name.relax .

1 Like