public abstract class

AbstractBaseKnapsackSolver

extends Object
implements BaseKnapsackSolver
java.lang.Object
   ↳ org.apache.helix.controller.strategy.knapsack.AbstractBaseKnapsackSolver
Known Direct Subclasses

Class Overview

Common implementation of a knapsack solver

Based on the C++ knapsack solver in Google's or-tools package.

Summary

Public Constructors
AbstractBaseKnapsackSolver(String solverName)
Initialize the solver
Public Methods
long[] getLowerAndUpperBoundWhenItem(int itemId, boolean isItemIn, long lowerBound, long upperBound)
Compute an upper and lower bound on the knapsack given the assignment state of the knapsack
String getName()
Get the solver name
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.apache.helix.controller.strategy.knapsack.BaseKnapsackSolver

Public Constructors

public AbstractBaseKnapsackSolver (String solverName)

Initialize the solver

Parameters
solverName the name of the solvers

Public Methods

public long[] getLowerAndUpperBoundWhenItem (int itemId, boolean isItemIn, long lowerBound, long upperBound)

Compute an upper and lower bound on the knapsack given the assignment state of the knapsack

Parameters
itemId the item id
isItemIn true if the item is in the knapsack, false otherwise
lowerBound the current lower bound
upperBound the current upper bound
Returns
  • the new lower and upper bounds

public String getName ()

Get the solver name

Returns
  • solver name