Package com.google.ortools.algorithms
Enum KnapsackSolver.SolverType
- java.lang.Object
-
- java.lang.Enum<KnapsackSolver.SolverType>
-
- com.google.ortools.algorithms.KnapsackSolver.SolverType
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<KnapsackSolver.SolverType>
- Enclosing class:
- KnapsackSolver
public static enum KnapsackSolver.SolverType extends java.lang.Enum<KnapsackSolver.SolverType>
Enum controlling which underlying algorithm is used.
This enum is passed to the constructor of the KnapsackSolver object.
It selects which solving method will be used.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description KNAPSACK_64ITEMS_SOLVEROptimized method for single dimension small problems
Limited to 64 items and one dimension, this
solver uses a branch & bound algorithm.KNAPSACK_BRUTE_FORCE_SOLVERBrute force method.
Limited to 30 items and one dimension, this
solver uses a brute force algorithm, ie.KNAPSACK_DIVIDE_AND_CONQUER_SOLVERDivide and Conquer approach for single dimension problems
Limited to one dimension, this solver is based on a divide and conquer
technique and is suitable for larger problems than Dynamic Programming
Solver.KNAPSACK_DYNAMIC_PROGRAMMING_SOLVERDynamic Programming approach for single dimension problems
Limited to one dimension, this solver is based on a dynamic programming
algorithm.KNAPSACK_MULTIDIMENSION_BRANCH_AND_BOUND_SOLVERGeneric Solver.
This solver can deal with both large number of items and several
dimensions.KNAPSACK_MULTIDIMENSION_CBC_MIP_SOLVERCBC Based Solver
This solver can deal with both large number of items and several
dimensions.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static KnapsackSolver.SolverTypeswigToEnum(int swigValue)intswigValue()static KnapsackSolver.SolverTypevalueOf(java.lang.String name)Returns the enum constant of this type with the specified name.static KnapsackSolver.SolverType[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
KNAPSACK_BRUTE_FORCE_SOLVER
public static final KnapsackSolver.SolverType KNAPSACK_BRUTE_FORCE_SOLVER
Brute force method.
Limited to 30 items and one dimension, this
solver uses a brute force algorithm, ie. explores all possible states.
Experiments show competitive performance for instances with less than
15 items.
-
KNAPSACK_64ITEMS_SOLVER
public static final KnapsackSolver.SolverType KNAPSACK_64ITEMS_SOLVER
Optimized method for single dimension small problems
Limited to 64 items and one dimension, this
solver uses a branch & bound algorithm. This solver is about 4 times
faster than KNAPSACK_MULTIDIMENSION_BRANCH_AND_BOUND_SOLVER.
-
KNAPSACK_DYNAMIC_PROGRAMMING_SOLVER
public static final KnapsackSolver.SolverType KNAPSACK_DYNAMIC_PROGRAMMING_SOLVER
Dynamic Programming approach for single dimension problems
Limited to one dimension, this solver is based on a dynamic programming
algorithm. The time and space complexity is O(capacity *
number_of_items).
-
KNAPSACK_MULTIDIMENSION_CBC_MIP_SOLVER
public static final KnapsackSolver.SolverType KNAPSACK_MULTIDIMENSION_CBC_MIP_SOLVER
CBC Based Solver
This solver can deal with both large number of items and several
dimensions. This solver is based on Integer Programming solver CBC.
-
KNAPSACK_MULTIDIMENSION_BRANCH_AND_BOUND_SOLVER
public static final KnapsackSolver.SolverType KNAPSACK_MULTIDIMENSION_BRANCH_AND_BOUND_SOLVER
Generic Solver.
This solver can deal with both large number of items and several
dimensions. This solver is based on branch and bound.
-
KNAPSACK_DIVIDE_AND_CONQUER_SOLVER
public static final KnapsackSolver.SolverType KNAPSACK_DIVIDE_AND_CONQUER_SOLVER
Divide and Conquer approach for single dimension problems
Limited to one dimension, this solver is based on a divide and conquer
technique and is suitable for larger problems than Dynamic Programming
Solver. The time complexity is O(capacity * number_of_items) and the
space complexity is O(capacity + number_of_items).
-
-
Method Detail
-
values
public static KnapsackSolver.SolverType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (KnapsackSolver.SolverType c : KnapsackSolver.SolverType.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static KnapsackSolver.SolverType valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException- if this enum type has no constant with the specified namejava.lang.NullPointerException- if the argument is null
-
swigValue
public final int swigValue()
-
swigToEnum
public static KnapsackSolver.SolverType swigToEnum(int swigValue)
-
-