Enum Class EnvironmentMode
- All Implemented Interfaces:
Serializable,Comparable<EnvironmentMode>,Constable
Also, a Solver has a single Random instance.
Some optimization algorithms use the Random instance a lot more than others.
For example simulated annealing depends highly on random numbers,
while tabu search only depends on it to deal with score ties.
This environment mode influences the seed of that Random instance.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionDeprecated, for removal: This API element is subject to removal in a future version.This mode turns on all assertions to fail-fast on a bug in aMoveimplementation, a constraint, the engine itself or something else at a horrible performance cost.As defined byPHASE_ASSERT, but disables every single bug detection mechanism.This mode turns on several assertions (but not all of them) to fail-fast on a bug in aMoveimplementation, a constraint, the engine itself or something else at an overwhelming performance cost.The non-reproducible mode is equally fast or slightly faster thanNO_ASSERT.This is the default mode as it is recommended during development, and runs minimal correctness checks that serve to quickly identify score corruption bugs.Deprecated, for removal: This API element is subject to removal in a future version.PreferNO_ASSERT.This mode turns on several assertions to fail-fast on a bug in aMoveimplementation, a constraint rule, the engine itself or something else at a reasonable performance cost (in development at least).This mode turns onFULL_ASSERTand enables variable tracking to fail-fast on a bug in aMoveimplementation, a constraint, the engine itself or something else at the highest performance cost. -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanbooleanDeprecated, for removal: This API element is subject to removal in a future version.UseisIntrusivelyAsserted()instead.booleanbooleanDeprecated, for removal: This API element is subject to removal in a future version.UseisFullyAsserted()instead.booleanbooleanbooleanstatic EnvironmentModeReturns the enum constant of this class with the specified name.static EnvironmentMode[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
TRACKED_FULL_ASSERT
This mode turns onFULL_ASSERTand enables variable tracking to fail-fast on a bug in aMoveimplementation, a constraint, the engine itself or something else at the highest performance cost.Because it tracks genuine and shadow variables, it is able to report precisely what variables caused the corruption and report any missed
VariableListenerevents.This mode is reproducible (see
PHASE_ASSERTmode).This mode is intrusive because it calls the
InnerScoreDirector.calculateScore()more frequently than a non assert mode.This mode is by far the slowest of all the modes.
-
FULL_ASSERT
This mode turns on all assertions to fail-fast on a bug in aMoveimplementation, a constraint, the engine itself or something else at a horrible performance cost.This mode is reproducible (see
PHASE_ASSERTmode).This mode is intrusive because it calls the
InnerScoreDirector.calculateScore()more frequently than a non assert mode.This mode is horribly slow.
-
NON_INTRUSIVE_FULL_ASSERT
This mode turns on several assertions (but not all of them) to fail-fast on a bug in aMoveimplementation, a constraint, the engine itself or something else at an overwhelming performance cost.This mode is reproducible (see
PHASE_ASSERTmode).This mode is non-intrusive, unlike
FULL_ASSERTandSTEP_ASSERT.This mode is horribly slow.
-
FAST_ASSERT
Deprecated, for removal: This API element is subject to removal in a future version.PreferSTEP_ASSERT. -
STEP_ASSERT
This mode turns on several assertions to fail-fast on a bug in aMoveimplementation, a constraint rule, the engine itself or something else at a reasonable performance cost (in development at least).This mode is reproducible (see
PHASE_ASSERTmode).This mode is intrusive because it calls the
InnerScoreDirector.calculateScore()more frequently than a non-assert mode.This mode is slow.
-
PHASE_ASSERT
This is the default mode as it is recommended during development, and runs minimal correctness checks that serve to quickly identify score corruption bugs.In this mode, two runs on the same computer will execute the same code in the same order. They will also yield the same result, except if they use a time based termination and they have a sufficiently large difference in allocated CPU time. This allows you to benchmark new optimizations (such as a new
Moveimplementation) fairly and reproduce bugs in your code reliably.Warning: some code can disrupt reproducibility regardless of this mode. This typically happens when user code serves data such as
planning entitiesfrom collections without defined iteration order, such asHashSetorHashMap.In practice, this mode uses the default random seed, and it also disables certain concurrency optimizations, such as work stealing.
-
REPRODUCIBLE
Deprecated, for removal: This API element is subject to removal in a future version.PreferNO_ASSERT. -
NO_ASSERT
As defined byPHASE_ASSERT, but disables every single bug detection mechanism. This mode will run negligibly faster thanPHASE_ASSERT, but will allow some bugs in user code (such as score corruptions) to go unnoticed. Use this mode when you are confident that your code is bug-free, or when you want to ignore a known bug temporarily. -
NON_REPRODUCIBLE
The non-reproducible mode is equally fast or slightly faster thanNO_ASSERT.The random seed is different on every run, which makes it more robust against an unlucky random seed. An unlucky random seed gives a bad result on a certain data set with a certain solver configuration. Note that in most use cases, the impact of the random seed is relatively low on the result. An occasional bad result is far more likely to be caused by another issue (such as a score trap).
In multithreaded scenarios, this mode allows the use of work stealing and other non-deterministic speed tricks.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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 class has no constant with the specified nameNullPointerException- if the argument is null
-
isStepAssertOrMore
public boolean isStepAssertOrMore() -
isAsserted
public boolean isAsserted() -
isFullyAsserted
public boolean isFullyAsserted() -
isNonIntrusiveFullAsserted
Deprecated, for removal: This API element is subject to removal in a future version.UseisFullyAsserted()instead. -
isIntrusivelyAsserted
public boolean isIntrusivelyAsserted() -
isIntrusiveFastAsserted
Deprecated, for removal: This API element is subject to removal in a future version.UseisIntrusivelyAsserted()instead. -
isReproducible
public boolean isReproducible() -
isTracking
public boolean isTracking()
-
STEP_ASSERT.