This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== BigObject MixedIntegerLinearProgram<Scalar> ====== //from application [[..:polytope|polytope]]//\\ \\ A mixed integer linear program specified by a linear or abstract objective function ? Type Parameters: :: ''Scalar'': numeric type of variables and objective function ===== Properties ===== ==== no category ==== {{anchor:integer_variables:}} ? **''INTEGER_VARIABLES''** :: Set of integers that indicate which entries of the solution should be integral. If no value is specified, all entries are required to be integral. If all entries should be rational, please use an ''[[..:polytope:LinearProgram |LinearProgram]]'' instead. ? Type: :''[[..:common#Set |Set]]<[[..:common#Int |Int]]>'' ? Example: :: The following defines a MixedIntegerLinearProgram together with a linear objective on a rational line segment embedded in two-dimensional space. :: <code perl> > $l = new Polytope(INEQUALITIES=>[[0,1,0],[3/2,-1,0],[1,0,0]],EQUATIONS=>[[0,0,1]]); > $obj = new Vector([0,1,0]); > $intvar = new Set<Int>([0,1,2]); > $milp = $l->MILP(LINEAR_OBJECTIVE=>$obj, INTEGER_VARIABLES=>$intvar); > print $milp->INTEGER_VARIABLES; {0 1 2} </code> ? Example: :: Same as the previous example, but we do not require the first coordinate to be integral anymore. :: <code perl> > $l = new Polytope(INEQUALITIES=>[[0,1,0],[3/2,-1,0],[1,0,0]],EQUATIONS=>[[0,0,1]]); > $obj = new Vector([0,1,0]); > $intvar = new Set<Int>([0,2]); > $milp = $l->MILP(LINEAR_OBJECTIVE=>$obj, INTEGER_VARIABLES=>$intvar); > print $milp->INTEGER_VARIABLES; {0 2} </code> ---- {{anchor:linear_objective:}} ? **''LINEAR_OBJECTIVE''** :: Linear objective funtion. In d-space a linear objective function is given by a (d+1)-vector. The first coordinate specifies a constant that is added to the resulting value. ? Type: :''[[..:common#Vector |Vector]]<Scalar>'' ? Example: :: The following defines a MixedIntegerLinearProgram together with a linear objective on a rational line segment embedded in two-dimensional space. :: <code perl> > $l = new Polytope(INEQUALITIES=>[[0,1,0],[3/2,-1,0],[1,0,0]],EQUATIONS=>[[0,0,1]]); > $obj = new Vector([0,-1,0]); > $intvar = new Set<Int>([0,1,2]); > $milp = $l->MILP(LINEAR_OBJECTIVE=>$obj, INTEGER_VARIABLES=>$intvar); > print $milp->LINEAR_OBJECTIVE; 0 -1 0 </code> ---- {{anchor:maximal_solution:}} ? **''MAXIMAL_SOLUTION''** :: Coordinates of a (possibly not unique) affine vertex at which the maximum of the objective function is attained. ? Type: :''[[..:common#Vector |Vector]]<Scalar>'' ? Example: :: The following defines a MixedIntegerLinearProgram together with a linear objective for the centered square with side length 2 and asks for a maximal solution: :: <code perl> > $c = new Vector([0, 1, -1/2]); > $p = cube(2); > $p->MILP(LINEAR_OBJECTIVE=>$c); > print $p->MILP->MAXIMAL_SOLUTION; 1 1 -1 </code> ? Example: :: The following defines a MixedIntegerLinearProgram together with a linear objective on a rational line segment embedded in two-dimensional space. Note that the maximal solution is not a vertex/endpoint of the line segment. :: <code perl> > $l = new Polytope(INEQUALITIES=>[[0,1,0],[3/2,-1,0],[1,0,0]],EQUATIONS=>[[0,0,1]]); > $obj = new Vector([0,1,0]); > $intvar = new Set<Int>([0,1,2]); > $milp = $l->MILP(LINEAR_OBJECTIVE=>$obj, INTEGER_VARIABLES=>$intvar); > print $milp->MAXIMAL_SOLUTION; 1 1 0 </code> ? Example: :: Same as the previous example, but we do not require the first coordinate to be integral anymore. Now the maximal solution is an endpoint of the line segment. :: <code perl> > $l = new Polytope(INEQUALITIES=>[[0,1,0],[3/2,-1,0],[1,0,0]],EQUATIONS=>[[0,0,1]]); > $obj = new Vector([0,1,0]); > $intvar = new Set<Int>([0,2]); > $milp = $l->MILP(LINEAR_OBJECTIVE=>$obj, INTEGER_VARIABLES=>$intvar); > print $milp->MAXIMAL_SOLUTION; 1 3/2 0 </code> ---- {{anchor:maximal_value:}} ? **''MAXIMAL_VALUE''** :: Maximum value the objective funtion takes under the restriction given by ''[[..:polytope:MixedIntegerLinearProgram#INTEGER_VARIABLES |INTEGER_VARIABLES]]''. ? Type: :''Scalar'' ? Example: :: The following defines a MixedIntegerLinearProgram together with a linear objective on a rational line segment embedded in two-dimensional space. Note that the maximal value is integral and not the same as the value of the objective function on any of the vertices. :: <code perl> > $l = new Polytope(INEQUALITIES=>[[0,1,0],[3/2,-1,0],[1,0,0]],EQUATIONS=>[[0,0,1]]); > $obj = new Vector([0,1,0]); > $intvar = new Set<Int>([0,1,2]); > $milp = $l->MILP(LINEAR_OBJECTIVE=>$obj, INTEGER_VARIABLES=>$intvar); > print $milp->MAXIMAL_VALUE; 1 </code> ? Example: :: Same as the previous example, but we do not require the first coordinate to be integral anymore. :: <code perl> > $l = new Polytope(INEQUALITIES=>[[0,1,0],[3/2,-1,0],[1,0,0]],EQUATIONS=>[[0,0,1]]); > $obj = new Vector([0,1,0]); > $intvar = new Set<Int>([0,2]); > $milp = $l->MILP(LINEAR_OBJECTIVE=>$obj, INTEGER_VARIABLES=>$intvar); > print $milp->MAXIMAL_VALUE; 3/2 </code> ---- {{anchor:minimal_solution:}} ? **''MINIMAL_SOLUTION''** :: Similar to ''[[..:polytope:MixedIntegerLinearProgram#MAXIMAL_SOLUTION |MAXIMAL_SOLUTION]]'' ? Type: :''[[..:common#Vector |Vector]]<Scalar>'' ? Example: :: The following defines a MixedIntegerLinearProgram together with a linear objective for the centered square with side length 2 and asks for a maximal solution: :: <code perl> > $c = new Vector([0, 1, -1/2]); > $p = cube(2); > $p->MILP(LINEAR_OBJECTIVE=>$c); > print $p->MILP->MINIMAL_SOLUTION; 1 -1 1 </code> ---- {{anchor:minimal_value:}} ? **''MINIMAL_VALUE''** :: Similar to ''[[..:polytope:MixedIntegerLinearProgram#MAXIMAL_VALUE |MAXIMAL_VALUE]]''. ? Type: :''Scalar'' ? Example: :: The following defines a MixedIntegerLinearProgram together with a linear objective on a rational line segment embedded in two-dimensional space. Note that the maximal value is integral and not the same as the value of the objective function on any of the vertices. :: <code perl> > $l = new Polytope(INEQUALITIES=>[[0,1,0],[3/2,-1,0],[1,0,0]],EQUATIONS=>[[0,0,1]]); > $obj = new Vector([0,-1,0]); > $intvar = new Set<Int>([0,1,2]); > $milp = $l->MILP(LINEAR_OBJECTIVE=>$obj, INTEGER_VARIABLES=>$intvar); > print $milp->MINIMAL_VALUE; -1 </code> ? Example: :: Same as the previous example, but we do not require the first coordinate to be integral anymore. :: <code perl> > $l = new Polytope(INEQUALITIES=>[[0,1,0],[3/2,-1,0],[1,0,0]],EQUATIONS=>[[0,0,1]]); > $obj = new Vector([0,-1,0]); > $intvar = new Set<Int>([0,2]); > $milp = $l->MILP(LINEAR_OBJECTIVE=>$obj, INTEGER_VARIABLES=>$intvar); > print $milp->MINIMAL_VALUE; -3/2 </code> ---- documentation/latest/polytope/mixedintegerlinearprogram.txt Last modified: 2023/11/06 10:57by 127.0.0.1