Attributes of Sets, Parameters and Variables

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):

var x {I} binary ;

Different entity types can have different attributes:

SET ATTRIBUTES EXAMPLES Default value — default Specifies 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 — within Restricts the set so that it can only contain values within the given set. set LargeCities within Cities; Dimension — dimen Specifies the set dimension explicitly. set H dimen 3; PARAMETER ATTRIBUTES EXAMPLES Default value — default Specifies 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 binary Restricts the parameter so that it can only hold integer/binary values. param PlaneCapacity integer; Arbitrary domain — in Restricts 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 — symbolic Allows parameter to assume string values. param LargestCities{1..5} symbolic in Cities; VARIABLE ATTRIBUTES EXAMPLES Bounds — <= >= Specifies variable upper/lower bounds. var alpha >= 0.05; Domain — integer or binary Restricts the variable so that it can only hold integer/binary values. var y binary; Default value — default Specifies 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 — in Restricts 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 — symbolic Allows 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 — suffix Specifies 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];