Generated on: Thu Mar 29 07:46:58 PDT 2012 for custom file set | ||
|
||
// doxy/ or-tools/ src/ algorithms/ |
#include <knapsack_solver.h>
Public Member Functions | |
BaseKnapsackSolver (const string &solver_name) | |
virtual | ~BaseKnapsackSolver () |
virtual void | Init (const std::vector< int64 > &profits, const std::vector< std::vector< int64 > > &weights, const std::vector< int64 > &capacities)=0 |
Initializes the solver and enters the problem to be solved. | |
virtual void | GetLowerAndUpperBoundWhenItem (int item_id, bool is_item_in, int64 *lower_bound, int64 *upper_bound) |
Gets the lower and upper bound when the item is in or out of the knapsack. | |
virtual int64 | Solve ()=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 string | GetName () const |
Definition at line 469 of file knapsack_solver.h.
operations_research::BaseKnapsackSolver::BaseKnapsackSolver | ( | const string & | solver_name | ) | [inline, explicit] |
Definition at line 471 of file knapsack_solver.h.
virtual operations_research::BaseKnapsackSolver::~BaseKnapsackSolver | ( | ) | [inline, virtual] |
Definition at line 473 of file knapsack_solver.h.
virtual void operations_research::BaseKnapsackSolver::Init | ( | const std::vector< int64 > & | profits, | |
const std::vector< std::vector< int64 > > & | weights, | |||
const std::vector< int64 > & | capacities | |||
) | [pure virtual] |
Initializes the solver and enters the problem to be solved.
Implemented in operations_research::KnapsackBruteForceSolver, operations_research::Knapsack64ItemsSolver, operations_research::KnapsackDynamicProgrammingSolver, operations_research::KnapsackMIPSolver, and operations_research::KnapsackGenericSolver.
void operations_research::BaseKnapsackSolver::GetLowerAndUpperBoundWhenItem | ( | int | item_id, | |
bool | is_item_in, | |||
int64 * | lower_bound, | |||
int64 * | upper_bound | |||
) | [virtual] |
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 1311 of file knapsack_solver.cc.
virtual int64 operations_research::BaseKnapsackSolver::Solve | ( | ) | [pure virtual] |
Solves the problem and returns the profit of the optimal solution.
Implemented in operations_research::KnapsackBruteForceSolver, operations_research::Knapsack64ItemsSolver, operations_research::KnapsackDynamicProgrammingSolver, operations_research::KnapsackMIPSolver, and operations_research::KnapsackGenericSolver.
virtual bool operations_research::BaseKnapsackSolver::best_solution | ( | int | item_id | ) | const [pure virtual] |
Returns true if the item 'item_id' is packed in the optimal knapsack.
Implemented in operations_research::KnapsackBruteForceSolver, operations_research::Knapsack64ItemsSolver, operations_research::KnapsackDynamicProgrammingSolver, operations_research::KnapsackMIPSolver, and operations_research::KnapsackGenericSolver.
virtual string operations_research::BaseKnapsackSolver::GetName | ( | ) | const [inline, virtual] |
Definition at line 494 of file knapsack_solver.h.