--— KnapsackState --— KnapsackState represents a partial solution to the knapsack problem. More...
#include <knapsack_solver.h>
Public Member Functions | |
| KnapsackState () | |
| void | Init (int number_of_items) |
| Initializes vectors with number_of_items set to false (i.e. not bound yet). More... | |
| bool | UpdateState (bool revert, const KnapsackAssignment &assignment) |
| Updates the state by applying or reverting a decision. More... | |
| int | GetNumberOfItems () const |
| bool | is_bound (int id) const |
| bool | is_in (int id) const |
--— KnapsackState --— KnapsackState represents a partial solution to the knapsack problem.
Definition at line 334 of file knapsack_solver.h.
| operations_research::KnapsackState::KnapsackState | ( | ) |
|
inline |
Definition at line 345 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).
|
inline |
Definition at line 346 of file knapsack_solver.h.
|
inline |
Definition at line 347 of file knapsack_solver.h.
| bool operations_research::KnapsackState::UpdateState | ( | bool | revert, |
| const KnapsackAssignment & | assignment | ||
| ) |
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.