Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
|
#include <knapsack_solver.h>
Public Member Functions | |
BaseKnapsackSolver (absl::string_view solver_name) | |
virtual | ~BaseKnapsackSolver ()=default |
virtual void | Init (const std::vector< int64_t > &profits, const std::vector< std::vector< int64_t > > &weights, const std::vector< int64_t > &capacities)=0 |
Initializes the solver and enters the problem to be solved. | |
virtual void | GetLowerAndUpperBoundWhenItem (int item_id, bool is_item_in, int64_t *lower_bound, int64_t *upper_bound) |
--— BaseKnapsackSolver --— | |
virtual int64_t | Solve (TimeLimit *time_limit, double time_limit_in_seconds, bool *is_solution_optimal)=0 |
Solves the problem and returns the profit of the optimal solution. | |
virtual bool | best_solution (int item_id) const =0 |
Returns true if the item 'item_id' is packed in the optimal knapsack. | |
virtual std::string | GetName () const |
--— BaseKnapsackSolver --— This is the base class for knapsack solvers.
Definition at line 606 of file knapsack_solver.h.
|
inlineexplicit |
Definition at line 608 of file knapsack_solver.h.
|
virtualdefault |
|
pure virtual |
Returns true if the item 'item_id' is packed in the optimal knapsack.
Implemented in operations_research::Knapsack64ItemsSolver, operations_research::KnapsackBruteForceSolver, operations_research::KnapsackCpSat, operations_research::KnapsackDivideAndConquerSolver, operations_research::KnapsackDynamicProgrammingSolver, operations_research::KnapsackGenericSolver, and operations_research::KnapsackMIPSolver.
|
virtual |
--— BaseKnapsackSolver --—
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.
Reimplemented in operations_research::KnapsackGenericSolver.
Definition at line 1651 of file knapsack_solver.cc.
|
inlinevirtual |
Definition at line 631 of file knapsack_solver.h.
|
pure virtual |
Initializes the solver and enters the problem to be solved.
Implemented in operations_research::Knapsack64ItemsSolver, operations_research::KnapsackBruteForceSolver, operations_research::KnapsackCpSat, operations_research::KnapsackDivideAndConquerSolver, operations_research::KnapsackDynamicProgrammingSolver, operations_research::KnapsackGenericSolver, and operations_research::KnapsackMIPSolver.
|
pure virtual |
Solves the problem and returns the profit of the optimal solution.
Implemented in operations_research::Knapsack64ItemsSolver, operations_research::KnapsackBruteForceSolver, operations_research::KnapsackCpSat, operations_research::KnapsackDivideAndConquerSolver, operations_research::KnapsackDynamicProgrammingSolver, operations_research::KnapsackGenericSolver, and operations_research::KnapsackMIPSolver.