- java.lang.Object
-
- org.ojalgo.optimisation.integer.IntegerStrategy.ConfigurableStrategy
-
- All Implemented Interfaces:
IntegerStrategy
- Enclosing interface:
- IntegerStrategy
public static final class IntegerStrategy.ConfigurableStrategy extends java.lang.Object implements IntegerStrategy
Apart from being able to configure various standard properties, you can also provide your ownModelStrategyfactory.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.ojalgo.optimisation.integer.IntegerStrategy
IntegerStrategy.ConfigurableStrategy, IntegerStrategy.GMICutConfiguration
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.function.BiFunction<ExpressionsBasedModel,IntegerStrategy,ModelStrategy>myFactoryprivate NumberContextmyGapToleranceprivate IntegerStrategy.GMICutConfigurationmyGMICutConfigurationprivate NumberContextmyIntegralityToleranceprivate java.util.function.IntSuppliermyParallelismprivate java.util.Comparator<NodeKey>[]myPriorityDefinitions-
Fields inherited from interface org.ojalgo.optimisation.integer.IntegerStrategy
DEFAULT
-
-
Constructor Summary
Constructors Constructor Description ConfigurableStrategy(java.util.function.IntSupplier parallelism, java.util.Comparator<NodeKey>[] definitions, NumberContext integrality, NumberContext gap, java.util.function.BiFunction<ExpressionsBasedModel,IntegerStrategy,ModelStrategy> factory, IntegerStrategy.GMICutConfiguration configuration)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IntegerStrategy.ConfigurableStrategyaddPriorityDefinitions(java.util.Comparator<NodeKey>... additionalDefinitions)Retains any existing definitions, but adds these to be used rather than the existing.intcountUniqueStrategies()NumberContextgetGapTolerance()The MIP gap is the difference between the best integer solution found so far and a node's relaxed non-integer solution.IntegerStrategy.GMICutConfigurationgetGMICutConfiguration()NumberContextgetIntegralityTolerance()Used to determine if a variable value is integer or notjava.util.List<java.util.Comparator<NodeKey>>getWorkerPriorities()There will be 1 worker thread per item in the returnedList.ModelStrategynewModelStrategy(ExpressionsBasedModel model)IntegerStrategy.ConfigurableStrategywithGapTolerance(NumberContext newTolerance)Change the MIP gapIntegerStrategy.ConfigurableStrategywithGMICutConfiguration(IntegerStrategy.GMICutConfiguration newConfiguration)IntegerStrategy.ConfigurableStrategywithModelStrategyFactory(java.util.function.BiFunction<ExpressionsBasedModel,IntegerStrategy,ModelStrategy> newFactory)Create a sub-class ofModelStrategyand provide a factory method for it here.IntegerStrategy.ConfigurableStrategywithParallelism(java.util.function.IntSupplier newParallelism)How many threads will be used? Perhaps useParallelismto obtain a suitable value.IntegerStrategy.ConfigurableStrategywithPriorityDefinitions(java.util.Comparator<NodeKey>... newDefinitions)Replace the priority definitions with these ones.
-
-
-
Field Detail
-
myFactory
private final java.util.function.BiFunction<ExpressionsBasedModel,IntegerStrategy,ModelStrategy> myFactory
-
myGapTolerance
private final NumberContext myGapTolerance
-
myGMICutConfiguration
private final IntegerStrategy.GMICutConfiguration myGMICutConfiguration
-
myIntegralityTolerance
private final NumberContext myIntegralityTolerance
-
myParallelism
private final java.util.function.IntSupplier myParallelism
-
myPriorityDefinitions
private final java.util.Comparator<NodeKey>[] myPriorityDefinitions
-
-
Constructor Detail
-
ConfigurableStrategy
ConfigurableStrategy(java.util.function.IntSupplier parallelism, java.util.Comparator<NodeKey>[] definitions, NumberContext integrality, NumberContext gap, java.util.function.BiFunction<ExpressionsBasedModel,IntegerStrategy,ModelStrategy> factory, IntegerStrategy.GMICutConfiguration configuration)
-
-
Method Detail
-
addPriorityDefinitions
public IntegerStrategy.ConfigurableStrategy addPriorityDefinitions(java.util.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:
countUniqueStrategiesin interfaceIntegerStrategy
-
getGapTolerance
public NumberContext getGapTolerance()
Description copied from interface:IntegerStrategyThe 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:
getGapTolerancein interfaceIntegerStrategy- Returns:
- The tolerance context used to determine if the gap is too small or not
-
getGMICutConfiguration
public IntegerStrategy.GMICutConfiguration getGMICutConfiguration()
- Specified by:
getGMICutConfigurationin interfaceIntegerStrategy
-
getIntegralityTolerance
public NumberContext getIntegralityTolerance()
Description copied from interface:IntegerStrategyUsed to determine if a variable value is integer or not- Specified by:
getIntegralityTolerancein interfaceIntegerStrategy
-
getWorkerPriorities
public java.util.List<java.util.Comparator<NodeKey>> getWorkerPriorities()
Description copied from interface:IntegerStrategyThere will be 1 worker thread per item in the returnedList. TheComparatorinstances need not be unique. Used to prioritise among the nodes waiting to be evaluated.- Specified by:
getWorkerPrioritiesin interfaceIntegerStrategy
-
newModelStrategy
public ModelStrategy newModelStrategy(ExpressionsBasedModel model)
- Specified by:
newModelStrategyin interfaceIntegerStrategy
-
withGapTolerance
public IntegerStrategy.ConfigurableStrategy withGapTolerance(NumberContext newTolerance)
Change the MIP gap
-
withGMICutConfiguration
public IntegerStrategy.ConfigurableStrategy withGMICutConfiguration(IntegerStrategy.GMICutConfiguration newConfiguration)
-
withModelStrategyFactory
public IntegerStrategy.ConfigurableStrategy withModelStrategyFactory(java.util.function.BiFunction<ExpressionsBasedModel,IntegerStrategy,ModelStrategy> newFactory)
Create a sub-class ofModelStrategyand provide a factory method for it here.
-
withParallelism
public IntegerStrategy.ConfigurableStrategy withParallelism(java.util.function.IntSupplier newParallelism)
How many threads will be used? Perhaps useParallelismto obtain a suitable value.
-
withPriorityDefinitions
public IntegerStrategy.ConfigurableStrategy withPriorityDefinitions(java.util.Comparator<NodeKey>... newDefinitions)
Replace the priority definitions with these ones.
-
-