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>, java.lang.constant.Constable
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.
  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    java.lang.Enum.EnumDesc<E extends java.lang.Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant Description
    KNAPSACK_64ITEMS_SOLVER
    Optimized method for single dimension small problems

    Limited to 64 items and one dimension, this
    solver uses a branch & bound algorithm.
    KNAPSACK_BRUTE_FORCE_SOLVER
    Brute force method.

    Limited to 30 items and one dimension, this
    solver uses a brute force algorithm, ie.
    KNAPSACK_DYNAMIC_PROGRAMMING_SOLVER
    Dynamic Programming approach for single dimension problems

    Limited to one dimension, this solver is based on a dynamic programming
    algorithm.
    KNAPSACK_MULTIDIMENSION_BRANCH_AND_BOUND_SOLVER
    Generic Solver.

    This solver can deal with both large number of items and several
    dimensions.
    KNAPSACK_MULTIDIMENSION_CBC_MIP_SOLVER
    CBC Based Solver

    This solver can deal with both large number of items and several
    dimensions.
  • Method Summary

    Modifier and Type Method Description
    static KnapsackSolver.SolverType swigToEnum​(int swigValue)  
    int swigValue()  
    static KnapsackSolver.SolverType valueOf​(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.

    Methods inherited from class java.lang.Enum

    clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • 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 complexity is O(capacity * number_of_items^2) and
      the 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.
  • Method Details

    • values

      public static KnapsackSolver.SolverType[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      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 name
      java.lang.NullPointerException - if the argument is null
    • swigValue

      public final int swigValue()
    • swigToEnum

      public static KnapsackSolver.SolverType swigToEnum​(int swigValue)