Package org.ddolib.examples.knapsack
Class KSFastLowerBound
java.lang.Object
org.ddolib.examples.knapsack.KSFastLowerBound
- All Implemented Interfaces:
FastLowerBound<Integer>
Fast lower bound heuristic for the Knapsack Problem (KS).
This class implements a quick estimation of the lower bound of the optimal solution for a given knapsack state. The heuristic uses a greedy strategy based on the profit-to-weight ratio of items, selecting the most profitable items first until the remaining capacity is exhausted.
The returned value is negated to be compatible with solvers that minimize the objective function.
-
Constructor Summary
ConstructorsConstructorDescriptionKSFastLowerBound(KSProblem problem) Constructs a new fast lower bound heuristic for the given Knapsack problem. -
Method Summary
Modifier and TypeMethodDescriptiondoublefastLowerBound(Integer state, Set<Integer> variables) Computes a fast lower bound for the given knapsack state.
-
Constructor Details
-
KSFastLowerBound
Constructs a new fast lower bound heuristic for the given Knapsack problem.- Parameters:
problem- the Knapsack problem instance
-
-
Method Details
-
fastLowerBound
Computes a fast lower bound for the given knapsack state.- Specified by:
fastLowerBoundin interfaceFastLowerBound<Integer>- Parameters:
state- the current remaining capacity of the knapsackvariables- the set of available item indices- Returns:
- a fast estimate of the lower bound (negated)
-