Package org.ojalgo.optimisation.integer
Class IntegerStrategy.ConfigurableStrategy
java.lang.Object
org.ojalgo.optimisation.integer.IntegerStrategy.ConfigurableStrategy
- All Implemented Interfaces:
IntegerStrategy
- Enclosing interface:
IntegerStrategy
public static final class IntegerStrategy.ConfigurableStrategy
extends Object
implements IntegerStrategy
Apart from being able to configure various standard properties, you can also provide your own
ModelStrategy
factory.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.ojalgo.optimisation.integer.IntegerStrategy
IntegerStrategy.ConfigurableStrategy, IntegerStrategy.GMICutConfiguration
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final BiFunction
<ExpressionsBasedModel, IntegerStrategy, ModelStrategy> private final NumberContext
private final IntegerStrategy.GMICutConfiguration
private final NumberContext
private final IntSupplier
private final Comparator<NodeKey>[]
Fields inherited from interface org.ojalgo.optimisation.integer.IntegerStrategy
DEFAULT
-
Constructor Summary
ConstructorsConstructorDescriptionConfigurableStrategy
(IntSupplier parallelism, Comparator<NodeKey>[] definitions, NumberContext integrality, NumberContext gap, BiFunction<ExpressionsBasedModel, IntegerStrategy, ModelStrategy> factory, IntegerStrategy.GMICutConfiguration configuration) -
Method Summary
Modifier and TypeMethodDescriptionaddPriorityDefinitions
(Comparator<NodeKey>... additionalDefinitions) Retains any existing definitions, but adds these to be used rather than the existing.int
The MIP gap is the difference between the best integer solution found so far and a node's relaxed non-integer solution.Used to determine if a variable value is integer or notThere will be 1 worker thread per item in the returnedList
.withGapTolerance
(NumberContext newTolerance) Change the MIP gapwithGMICutConfiguration
(IntegerStrategy.GMICutConfiguration newConfiguration) withModelStrategyFactory
(BiFunction<ExpressionsBasedModel, IntegerStrategy, ModelStrategy> newFactory) Create a sub-class ofModelStrategy
and provide a factory method for it here.withParallelism
(IntSupplier newParallelism) How many threads will be used? Perhaps useParallelism
to obtain a suitable value.withPriorityDefinitions
(Comparator<NodeKey>... newDefinitions) Replace the priority definitions with these ones.
-
Field Details
-
myFactory
-
myGapTolerance
-
myGMICutConfiguration
-
myIntegralityTolerance
-
myParallelism
-
myPriorityDefinitions
-
-
Constructor Details
-
ConfigurableStrategy
ConfigurableStrategy(IntSupplier parallelism, Comparator<NodeKey>[] definitions, NumberContext integrality, NumberContext gap, BiFunction<ExpressionsBasedModel, IntegerStrategy, ModelStrategy> factory, IntegerStrategy.GMICutConfiguration configuration)
-
-
Method Details
-
addPriorityDefinitions
public IntegerStrategy.ConfigurableStrategy addPriorityDefinitions(Comparator<NodeKey>... additionalDefinitions) Retains any existing definitions, but adds these to be used rather than the existing. If there are enough threads both these additional and the previously existing definitions will be used. -
countUniqueStrategies
public int countUniqueStrategies()- Specified by:
countUniqueStrategies
in interfaceIntegerStrategy
-
getGapTolerance
Description copied from interface:IntegerStrategy
The MIP gap is the difference between the best integer solution found so far and a node's relaxed non-integer solution. The relative MIP gap is that difference divided by the optimal value (approximated by the currently best integer solution). If the gap (absolute or relative) is too small, then the corresponding branch is terminated as it is deemed unlikely or too "expensive" to find better integer solutions there.- Specified by:
getGapTolerance
in interfaceIntegerStrategy
- Returns:
- The tolerance context used to determine if the gap is too small or not
-
getGMICutConfiguration
- Specified by:
getGMICutConfiguration
in interfaceIntegerStrategy
-
getIntegralityTolerance
Description copied from interface:IntegerStrategy
Used to determine if a variable value is integer or not- Specified by:
getIntegralityTolerance
in interfaceIntegerStrategy
-
getWorkerPriorities
Description copied from interface:IntegerStrategy
There will be 1 worker thread per item in the returnedList
. TheComparator
instances need not be unique. Used to prioritise among the nodes waiting to be evaluated.- Specified by:
getWorkerPriorities
in interfaceIntegerStrategy
-
newModelStrategy
- Specified by:
newModelStrategy
in interfaceIntegerStrategy
-
withGapTolerance
Change the MIP gap -
withGMICutConfiguration
public IntegerStrategy.ConfigurableStrategy withGMICutConfiguration(IntegerStrategy.GMICutConfiguration newConfiguration) -
withModelStrategyFactory
public IntegerStrategy.ConfigurableStrategy withModelStrategyFactory(BiFunction<ExpressionsBasedModel, IntegerStrategy, ModelStrategy> newFactory) Create a sub-class ofModelStrategy
and provide a factory method for it here. -
withParallelism
How many threads will be used? Perhaps useParallelism
to obtain a suitable value. -
withPriorityDefinitions
public IntegerStrategy.ConfigurableStrategy withPriorityDefinitions(Comparator<NodeKey>... newDefinitions) Replace the priority definitions with these ones.
-