Generated on: Thu Mar 29 07:46:58 PDT 2012 for custom file set | ||
|
||
// doxy/ or-tools/ src/ algorithms/ |
#include <knapsack_solver.h>
Public Types | |
enum | SolverType { KNAPSACK_BRUTE_FORCE_SOLVER, KNAPSACK_64ITEMS_SOLVER, KNAPSACK_DYNAMIC_PROGRAMMING_SOLVER, KNAPSACK_MULTIDIMENSION_BRANCH_AND_BOUND_SOLVER } |
Public Member Functions | |
KnapsackSolver (const string &solver_name) | |
KnapsackSolver. | |
KnapsackSolver (SolverType solver_type, const string &solver_name) | |
virtual | ~KnapsackSolver () |
void | Init (const std::vector< int64 > &profits, const std::vector< std::vector< int64 > > &weights, const std::vector< int64 > &capacities) |
Initializes the solver and enters the problem to be solved. | |
int64 | Solve () |
Solves the problem and returns the profit of the optimal solution. | |
bool | BestSolutionContains (int item_id) const |
Returns true if the item 'item_id' is packed in the optimal knapsack. | |
string | GetName () const |
bool | use_reduction () const |
void | set_use_reduction (bool use_reduction) |
Definition at line 112 of file knapsack_solver.h.
KNAPSACK_BRUTE_FORCE_SOLVER | |
KNAPSACK_64ITEMS_SOLVER | |
KNAPSACK_DYNAMIC_PROGRAMMING_SOLVER |
USE_CBC.
USE_GLPK |
KNAPSACK_MULTIDIMENSION_BRANCH_AND_BOUND_SOLVER |
Definition at line 114 of file knapsack_solver.h.
operations_research::KnapsackSolver::KnapsackSolver | ( | const string & | solver_name | ) | [explicit] |
operations_research::KnapsackSolver::KnapsackSolver | ( | SolverType | solver_type, | |
const string & | solver_name | |||
) |
Definition at line 1138 of file knapsack_solver.cc.
operations_research::KnapsackSolver::~KnapsackSolver | ( | ) | [virtual] |
Definition at line 1179 of file knapsack_solver.cc.
void operations_research::KnapsackSolver::Init | ( | const std::vector< int64 > & | profits, | |
const std::vector< std::vector< int64 > > & | weights, | |||
const std::vector< int64 > & | capacities | |||
) |
Initializes the solver and enters the problem to be solved.
Definition at line 1182 of file knapsack_solver.cc.
int64 operations_research::KnapsackSolver::Solve | ( | ) |
Solves the problem and returns the profit of the optimal solution.
Definition at line 1295 of file knapsack_solver.cc.
bool operations_research::KnapsackSolver::BestSolutionContains | ( | int | item_id | ) | const |
Returns true if the item 'item_id' is packed in the optimal knapsack.
Definition at line 1299 of file knapsack_solver.cc.
string operations_research::KnapsackSolver::GetName | ( | ) | const |
Definition at line 1306 of file knapsack_solver.cc.
bool operations_research::KnapsackSolver::use_reduction | ( | ) | const [inline] |
Definition at line 143 of file knapsack_solver.h.
void operations_research::KnapsackSolver::set_use_reduction | ( | bool | use_reduction | ) | [inline] |
Definition at line 144 of file knapsack_solver.h.