C++ Reference: class BaseKnapsackSolver

This documentation is automatically generated.


   ----- BaseKnapsackSolver -----
This is the base class for knapsack solvers.
Method
BaseKnapsackSolver

Return type: explicit

Arguments: const std::string& solver_name

~BaseKnapsackSolver

Return type: virtual

best_solution

Return type: virtual bool

Arguments: int item_id

Returns true if the item 'item_id' is packed in the optimal knapsack.

GetLowerAndUpperBoundWhenItem

Return type: virtual void

Arguments: int item_id, bool is_item_in, int64* lower_bound, int64* upper_bound

Gets the lower and upper bound when the item is in or out of the knapsack. To ensure objects are correctly initialized, this method should not be called before ::Init.

GetName

Return type: virtual std::string

Init

Return type: virtual void

Arguments: const std::vector<int64>& profits, const std::vector<std::vector<int64> >& weights, const std::vector<int64>& capacities

Initializes the solver and enters the problem to be solved.

Solve

Return type: virtual int64

Arguments: TimeLimit* time_limit, bool* is_solution_optimal

Solves the problem and returns the profit of the optimal solution.