When declaring sets, parameters and variables we have the option to give them special attributes.
Attributes are properties that we want to ensure that our entities have.
For instance, we can use attributes to restrict the domain of
a collection of variables x the binary set (0 or 1):
varx{I}binary;
Different entity types can have different attributes:
SET ATTRIBUTESEXAMPLESDefault value — defaultSpecifies a default value to be used if no value is provided later.set Months default 1..12;Constant value — =Specifies a value for the set that cannot be changed later.set C = A union B;set MemorySizes = setof{p in 12..16} 2**p;Subset — withinRestricts the set so that it can only contain values within the given set.set LargeCities within Cities;Dimension — dimenSpecifies the set dimension explicitly.set H dimen 3;PARAMETER ATTRIBUTESEXAMPLESDefault value — defaultSpecifies a default value to be used if no value is provided later.param alpha default 0.95;Constant value — =Specifies a value for the parameter that cannot be changed later.param pi = 3.141592;param RadiansToDegrees = 180 / pi;Domain — integer or binaryRestricts the parameter so that it can only hold integer/binary values.param PlaneCapacity integer;Arbitrary domain — inRestricts the parameter so that it can only hold values within the given set.param m in Months;param capacity in BusCap union TruckCap;Numeric relation — < <= == != >= >Restricts the parameter so that it can only hold values that meet the given condition.param alpha >= 0.05;Possibly non-numeric — symbolicAllows parameter to assume string values.param LargestCities{1..5} symbolic in Cities;VARIABLE ATTRIBUTESEXAMPLESBounds — <= >=Specifies variable upper/lower bounds.var alpha >= 0.05;Domain — integer or binaryRestricts the variable so that it can only hold integer/binary values.var y binary;Default value — defaultSpecifies a default initial value to be used if no value is provided later.var alpha default 0.95;Defined variable — =Makes a defined variable, which is a variable whose value is calculated based on the value of other variables.var TotalCost = sum{i in I} x[i]*c[i];Arbitrary domain — inRestricts the variable so that it can only hold values within the given set.var pairs in setof{i in 1..4} 2*i;Possibly non-numeric — symbolicAllows variable to assume string values.var City symbolic;Initial value — :=Specifies an initial value that cannot be changed in a data section, but can be changed in a let statement.var y{I} binary, := 1;Suffix — suffixSpecifies an initial value for a previously declared suffix.var y suffix index 1;Coefficient — coeff, obj, cover
Used for columnwise coefficient generation.
Specifies coefficients to be placed in the given constraint — coeff —
or objective — obj. cover is equivalent
to coeff constraint 1.
var x{j in P} coeff{i in R} supply[i] a[i,j];var y{j in P} obj Z c[j];