C++ Reference: class BaseKnapsackSolver

This documentation is automatically generated.

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

Return type: explicit

Arguments: const std::string& solver_name


Return type: virtual


Return type: virtual bool

Arguments: int item_id

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


Return type: virtual void

Arguments: int item_id, bool is_item_in, int64_t* lower_bound, int64_t* 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.


Return type: virtual std::string


Return type: virtual void

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

Initializes the solver and enters the problem to be solved.


Return type: virtual int64_t

Arguments: TimeLimit* time_limit, bool* is_solution_optimal

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