Rel: MonStgElt Default: "eq"
Add some constraints to L. All constraints will have the same relation, given by Rel, which may be set to "eq" for strict equality (the default), "le" for less-or-equal constraints, or "ge" for greater-or-equal constraints.
Constraints are of the form sum_(j = 1)^(n)( LHS_(ij)) ( Rel) ( RHS_(i1))
The number of constraints in L.
The number of variables in L.
Evaluate the objective function of L at the point p.
The LHS, RHS and relation (-1 for <= , 0 for =, 1 for >= ) of the n-th constraint of L.
Sequence of indices of the variables in L to be solved in integers.
The objective function of L.
Returns true if L is set to maximise its objective function, false if set to minimise.
Remove the n-th constraint from L.
Set the variables of L indexed by elements of I to be solved in integers if m is true, or in the usual ring if false.
Set the lower bound on the n-th variable of n in L to b.
Set L to maximise its objective function if m is true, or to minimise the objective function if m is false.
Set the objective function of L to F.
Set the upper bound on the n-th variable in L to b.
Solve the LP problem L; returns a point representing an optimal solution, and an integer representing the state of the solution.
Remove any bounds on all variables in L.
> R := RealField( ); > L := LPProcess(R, 2); > SetObjectiveFunction(L, Matrix(R, 1, 2, [3,13])); > lhs := Matrix(R, 2, 2, [2, 9, 11, -8]); > rhs := Matrix(R, 2, 1, [40, 82]); > AddConstraints(L, lhs, rhs : Rel := "le"); > SetMaximiseFunction(L, true); > L; LP <Real Field, 2 variables> Maximising objective function: [ 3 13] Subject to constraints: 1 : [2 9] <= [40] 2 : [11 -8] <= [82] Variables bounded above by: [ ] Variables bounded below by: [ ] Solving in integers for variables [ ] > Solution(L); [9.199999999999999289 2.400000000000000355] 0Now, we place some bounds on y:
> SetUpperBound(L, 2, R!2); > SetLowerBound(L, 2, R!1); > Solution(L); [8.909090909090908283 2.000000000000000000] 0And find integer solutions:
> SetIntegerSolutionVariables(L, [1,2], true); > Solution(L); [8.000000000000000000 2.000000000000000000] 0Now, removing the 2nd constraint:
> RemoveConstraint(L, 2); > L; LP <Real Field, 2 variables> Maximising objective function: [ 3 13] Subject to constraints: 1 : [2 9] <= [40] Variables bounded above by: [ 2:2 ] Variables bounded below by: [ 2:1 ] Solving in integers for variables [ 1, 2 ] > Solution(L); [11.00000000000000000 2.000000000000000000] 0And removing the restriction to Integer values for y,
> SetIntegerSolutionVariables(L, [2], false); > Solution(L); [15.00000000000000000 1.111111111111111160] 0[Next][Prev] [Right] [Left] [Up] [Index] [Root]