Class ILPNode
- java.lang.Object
-
- dev.nm.solver.multivariate.constrained.integer.linear.bb.ILPNode
-
- All Implemented Interfaces:
BBNode
,ConstrainedOptimProblem
,OptimProblem
public class ILPNode extends Object implements BBNode, ConstrainedOptimProblem
This is the branch-and-bound node used in conjunction withILPBranchAndBoundMinimizer
to solve an Integer Linear Programming problem.
-
-
Constructor Summary
Constructors Constructor Description ILPNode(ILPProblem problem)
Construct a BB node and associate it with an ILP problem.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description List<ILPNode>
branching()
Get the children of this node by using the branching operation.int
dimension()
Get the number of variables.RealScalarFunction
f()
Get the objective function.EqualityConstraints
getEqualityConstraints()
Gets the equality constraints, hi(x) = 0static LinearGreaterThanConstraints
getGreaterThanConstraint(Vector minimizer, int i)
Construct a greater-than constraint for the branching greater-than subproblem.static LinearLessThanConstraints
getLessThanConstraint(Vector minimizer, int i)
Construct a less-than constraint for the branching less-than subproblem.LessThanConstraints
getLessThanConstraints()
Gets the less-than-or-equal-to constraints, gi(x) ≤ 0boolean
isCandidate()
Check if this node is a possible solution to the original problem, e.g., not pruned.ImmutableVector
solution()
the solution to the sub-problem associated with this nodeString
toString()
double
value()
the value of this node
-
-
-
Constructor Detail
-
ILPNode
public ILPNode(ILPProblem problem)
Construct a BB node and associate it with an ILP problem.- Parameters:
problem
- an ILP problem
-
-
Method Detail
-
solution
public ImmutableVector solution()
Description copied from interface:BBNode
the solution to the sub-problem associated with this node
-
value
public double value()
Description copied from interface:BBNode
the value of this node
-
isCandidate
public boolean isCandidate()
Description copied from interface:BBNode
Check if this node is a possible solution to the original problem, e.g., not pruned.- Specified by:
isCandidate
in interfaceBBNode
- Returns:
true
if this node is a possible solution to the original problem
-
branching
public List<ILPNode> branching()
Get the children of this node by using the branching operation. This implementation assumes- the parent node has a solution;
- the parent solution has more than 1 non-satisfying integral variable.
-
getLessThanConstraint
public static LinearLessThanConstraints getLessThanConstraint(Vector minimizer, int i)
Construct a less-than constraint for the branching less-than subproblem.- Parameters:
minimizer
- the node's solutioni
- the index of a non-satisfying integral variable (the branching variable), counting from 1- Returns:
- a less-than constraint for the branching less-than subproblem
-
getGreaterThanConstraint
public static LinearGreaterThanConstraints getGreaterThanConstraint(Vector minimizer, int i)
Construct a greater-than constraint for the branching greater-than subproblem.- Parameters:
minimizer
- the node's solutioni
- the index of a non-satisfying integral variable (the branching variable), counting from 1- Returns:
- a greater-than constraint for the branching greater-than subproblem
-
getLessThanConstraints
public LessThanConstraints getLessThanConstraints()
Description copied from interface:ConstrainedOptimProblem
Gets the less-than-or-equal-to constraints, gi(x) ≤ 0- Specified by:
getLessThanConstraints
in interfaceConstrainedOptimProblem
- Returns:
- the less-than-or-equal-to constraints
-
getEqualityConstraints
public EqualityConstraints getEqualityConstraints()
Description copied from interface:ConstrainedOptimProblem
Gets the equality constraints, hi(x) = 0- Specified by:
getEqualityConstraints
in interfaceConstrainedOptimProblem
- Returns:
- the equality constraints
-
dimension
public int dimension()
Description copied from interface:OptimProblem
Get the number of variables.- Specified by:
dimension
in interfaceOptimProblem
- Returns:
- the number of variables.
-
f
public RealScalarFunction f()
Description copied from interface:OptimProblem
Get the objective function.- Specified by:
f
in interfaceOptimProblem
- Returns:
- the objective function
-
-