Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
|
#include <knapsack_solver.h>
Public Member Functions | |
KnapsackGenericSolver (const std::string &solver_name) | |
--— KnapsackGenericSolver --— | |
KnapsackGenericSolver (const KnapsackGenericSolver &)=delete | |
This type is neither copyable nor movable. | |
KnapsackGenericSolver & | operator= (const KnapsackGenericSolver &)=delete |
~KnapsackGenericSolver () override | |
void | Init (const std::vector< int64_t > &profits, const std::vector< std::vector< int64_t > > &weights, const std::vector< int64_t > &capacities) override |
Initializes the solver and enters the problem to be solved. | |
int | GetNumberOfItems () const |
void | GetLowerAndUpperBoundWhenItem (int item_id, bool is_item_in, int64_t *lower_bound, int64_t *upper_bound) override |
--— BaseKnapsackSolver --— | |
void | set_primary_propagator_id (int primary_propagator_id) |
int64_t | Solve (TimeLimit *time_limit, double time_limit_in_seconds, bool *is_solution_optimal) override |
Solves the problem and returns the profit of the optimal solution. | |
bool | best_solution (int item_id) const override |
Returns true if the item 'item_id' is packed in the optimal knapsack. | |
Public Member Functions inherited from operations_research::BaseKnapsackSolver | |
BaseKnapsackSolver (absl::string_view solver_name) | |
virtual | ~BaseKnapsackSolver ()=default |
virtual std::string | GetName () const |
--— KnapsackGenericSolver --— KnapsackGenericSolver is the multi-dimensional knapsack solver class. In the current implementation, the next item to assign is given by the primary propagator. Using SetPrimaryPropagator allows changing the default (propagator of the first dimension), and selecting another dimension when more constrained.
Definition at line 646 of file knapsack_solver.h.
|
explicit |
--— KnapsackGenericSolver --—
Definition at line 346 of file knapsack_solver.cc.
|
delete |
This type is neither copyable nor movable.
|
override |
Definition at line 355 of file knapsack_solver.cc.
|
inlineoverridevirtual |
Returns true if the item 'item_id' is packed in the optimal knapsack.
Implements operations_research::BaseKnapsackSolver.
Definition at line 678 of file knapsack_solver.h.
|
overridevirtual |
--— 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 from operations_research::BaseKnapsackSolver.
Definition at line 379 of file knapsack_solver.cc.
|
inline |
Definition at line 662 of file knapsack_solver.h.
|
overridevirtual |
Initializes the solver and enters the problem to be solved.
Implements operations_research::BaseKnapsackSolver.
Definition at line 357 of file knapsack_solver.cc.
|
delete |
|
inline |
Sets which propagator should be used to guide the search. 'primary_propagator_id' should be in 0..p-1 with p the number of propagators.
Definition at line 670 of file knapsack_solver.h.
|
overridevirtual |
Solves the problem and returns the profit of the optimal solution.
Implements operations_research::BaseKnapsackSolver.
Definition at line 403 of file knapsack_solver.cc.