Enum KnapsackSolver.SolverType

java.lang.Object
java.lang.Enum<KnapsackSolver.SolverType>
com.google.ortools.algorithms.KnapsackSolver.SolverType
All Implemented Interfaces:
Serializable, Comparable<KnapsackSolver.SolverType>, java.lang.constant.Constable
Enclosing class:
KnapsackSolver

public static enum KnapsackSolver.SolverType extends 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 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 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_MULTIDIMENSION_SCIP_MIP_SOLVER

      public static final KnapsackSolver.SolverType KNAPSACK_MULTIDIMENSION_SCIP_MIP_SOLVER
      SCIP based solver

      This solver can deal with both large number of items and several
      dimensions. This solver is based on Integer Programming solver SCIP.
    • 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).
    • KNAPSACK_MULTIDIMENSION_CP_SAT_SOLVER

      public static final KnapsackSolver.SolverType KNAPSACK_MULTIDIMENSION_CP_SAT_SOLVER
      CP-SAT based solver

      This solver can deal with both large number of items and several
      dimensions. This solver is based on the CP-SAT solver
  • 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(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:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null
    • swigValue

      public final int swigValue()
    • swigToEnum

      public static KnapsackSolver.SolverType swigToEnum(int swigValue)