Class KSFlb
java.lang.Object
org.ddolib.examples.nolayer.knapsack.KSFlb
- All Implemented Interfaces:
FastLowerBound<KSState>
Fast lower bound for the Knapsack Problem (KS), using the no-layer modeling API.
The bound is computed by a fractional-relaxation greedy heuristic: remaining items are sorted by decreasing profit-to-weight ratio and packed into the remaining capacity, allowing the last item to be split fractionally. The negated value of this greedy profit is returned, consistently with the library's minimization convention.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoublefastLowerBound(KSState state) Computes a lower bound on the remaining cost from the given state to reach any valid target state.
-
Constructor Details
-
KSFlb
Creates a new fast lower bound for the given knapsack instance.- Parameters:
problem- the knapsack instance to bound
-
-
Method Details
-
fastLowerBound
Description copied from interface:FastLowerBoundComputes a lower bound on the remaining cost from the given state to reach any valid target state.- Specified by:
fastLowerBoundin interfaceFastLowerBound<KSState>- Parameters:
state- the current state- Returns:
- a lower bound on the remaining cost
-