If I declear var x {1..3}; is there a way to specify specific indices to be integer variables?
i.e. x[1] & x[3] are integer variables while x[2] is continuous.
var x{1..3};
x[1] integer;
x[3] integer;
If I declear var x {1..3}; is there a way to specify specific indices to be integer variables?
i.e. x[1] & x[3] are integer variables while x[2] is continuous.
var x{1..3};
x[1] integer;
x[3] integer;
Copyright © 2021 Jogjafile Inc.
Typically indexed variables are all integer or all continuous, but you can do that by having another indexed variable (e.g.,
y) that is integer and using a constraint to enforcex[2]andx[3]to be equal to integer variables (e.g.,y[2]andy[3]) as follows:The constraint
xintegerensuresx[1] = y[1]andx[3] = y[3]. Sinceyis integer,x[1]andx[3]must be integer too.