Generated on: Thu Mar 29 07:46:58 PDT 2012 for custom file set
// doxy/ or-tools/ src/ algorithms/

operations_research::Knapsack64ItemsSolver Class Reference

Knapsack64ItemsSolver Knapsack64ItemsSolver solves the 0-1 knapsack problem when the number of items is less or equal to 64. More...

Inheritance diagram for operations_research::Knapsack64ItemsSolver:

operations_research::BaseKnapsackSolver

List of all members.

Public Member Functions

 Knapsack64ItemsSolver (const string &solver_name)
 Knapsack64ItemsSolver.
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 best_solution (int item_id) const
 Returns true if the item 'item_id' is packed in the optimal knapsack.


Detailed Description

Knapsack64ItemsSolver Knapsack64ItemsSolver solves the 0-1 knapsack problem when the number of items is less or equal to 64.

This implementation is about 4 times faster than KnapsackGenericSolver.

Definition at line 688 of file knapsack_solver.cc.


Constructor & Destructor Documentation

operations_research::Knapsack64ItemsSolver::Knapsack64ItemsSolver ( const string &  solver_name  )  [explicit]

Knapsack64ItemsSolver.

Definition at line 738 of file knapsack_solver.cc.


Member Function Documentation

void operations_research::Knapsack64ItemsSolver::Init ( const std::vector< int64 > &  profits,
const std::vector< std::vector< int64 > > &  weights,
const std::vector< int64 > &  capacities 
) [virtual]

Initializes the solver and enters the problem to be solved.

Implements operations_research::BaseKnapsackSolver.

Definition at line 754 of file knapsack_solver.cc.

int64 operations_research::Knapsack64ItemsSolver::Solve (  )  [virtual]

Solves the problem and returns the profit of the optimal solution.

Implements operations_research::BaseKnapsackSolver.

Definition at line 796 of file knapsack_solver.cc.

bool operations_research::Knapsack64ItemsSolver::best_solution ( int  item_id  )  const [inline, virtual]

Returns true if the item 'item_id' is packed in the optimal knapsack.

Implements operations_research::BaseKnapsackSolver.

Definition at line 701 of file knapsack_solver.cc.


The documentation for this class was generated from the following file: