![]() |
Google OR-Tools v9.14
a fast and portable software suite for combinatorial optimization
|
--— KnapsackState --— KnapsackState represents a partial solution to the knapsack problem.
Definition at line 430 of file knapsack_solver.h.
#include <knapsack_solver.h>
Public Member Functions | |
| KnapsackState () | |
| --— KnapsackState --— | |
| KnapsackState (const KnapsackState &)=delete | |
| This type is neither copyable nor movable. | |
| KnapsackState & | operator= (const KnapsackState &)=delete |
| void | Init (int number_of_items) |
| Initializes vectors with number_of_items set to false (i.e. not bound yet). | |
| bool | UpdateState (bool revert, const KnapsackAssignment &assignment) |
| Returns false when the state is invalid. | |
| int | GetNumberOfItems () const |
| bool | is_bound (int id) const |
| bool | is_in (int id) const |
| operations_research::KnapsackState::KnapsackState | ( | ) |
--— KnapsackState --—
Definition at line 147 of file knapsack_solver.cc.
|
delete |
This type is neither copyable nor movable.
|
inline |
Definition at line 447 of file knapsack_solver.h.
| void operations_research::KnapsackState::Init | ( | int | number_of_items | ) |
Initializes vectors with number_of_items set to false (i.e. not bound yet).
Definition at line 149 of file knapsack_solver.cc.
|
inline |
Definition at line 448 of file knapsack_solver.h.
|
inline |
Definition at line 449 of file knapsack_solver.h.
|
delete |
| bool operations_research::KnapsackState::UpdateState | ( | bool | revert, |
| const KnapsackAssignment & | assignment ) |
Returns false when the state is invalid.
Updates the state by applying or reverting a decision. Returns false if fails, i.e. trying to apply an inconsistent decision to an already assigned item.
Definition at line 155 of file knapsack_solver.cc.