java.lang.Object
org.ddolib.examples.nolayer.knapsack.KSFlb
All Implemented Interfaces:
FastLowerBound<KSState>

public class KSFlb extends Object implements 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 Details

    • KSFlb

      public KSFlb(KSProblem problem)
      Creates a new fast lower bound for the given knapsack instance.
      Parameters:
      problem - the knapsack instance to bound
  • Method Details

    • fastLowerBound

      public double fastLowerBound(KSState state)
      Description copied from interface: FastLowerBound
      Computes a lower bound on the remaining cost from the given state to reach any valid target state.
      Specified by:
      fastLowerBound in interface FastLowerBound<KSState>
      Parameters:
      state - the current state
      Returns:
      a lower bound on the remaining cost