org.drools.planner.config
Enum EnvironmentMode

java.lang.Object
  extended by java.lang.Enum<EnvironmentMode>
      extended by org.drools.planner.config.EnvironmentMode
All Implemented Interfaces:
Serializable, Comparable<EnvironmentMode>

public enum EnvironmentMode
extends Enum<EnvironmentMode>

A solver has a single Random instance. Some solver configurations 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. The environment mode influences the seed of that Random instance.

The environment mode also allows you to detect common bugs in your implementation.


Enum Constant Summary
DEBUG
          The debug mode turns on most assertions (such as DefaultDecider.assertUndoMoveIsUncorrupted) to fail-fast on a bug in a Move implementation, in a score rule or something else.
PRODUCTION
          The production mode is the fastest and the most robust, but not reproducible.
REPRODUCIBLE
          The reproducible mode is the default mode because it is recommended during development.
TRACE
          The trace mode does a few more assertions (such as DefaultDecider.assertMoveScoreIsUncorrupted) than the DEBUG mode at a horrible performance cost.
 
Method Summary
static EnvironmentMode valueOf(String name)
          Returns the enum constant of this type with the specified name.
static EnvironmentMode[] 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, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

TRACE

public static final EnvironmentMode TRACE
The trace mode does a few more assertions (such as DefaultDecider.assertMoveScoreIsUncorrupted) than the DEBUG mode at a horrible performance cost.

The trace mode is reproducible (see REPRODUCIBLE mode).

The trace mode is horribly slow.


DEBUG

public static final EnvironmentMode DEBUG
The debug mode turns on most assertions (such as DefaultDecider.assertUndoMoveIsUncorrupted) to fail-fast on a bug in a Move implementation, in a score rule or something else.

The debug mode is reproducible (see REPRODUCIBLE mode).

The debug mode is slow.


REPRODUCIBLE

public static final EnvironmentMode REPRODUCIBLE
The reproducible mode is the default mode because it is recommended during development. In this mode, 2 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 Move implementation) fairly.

The reproducible mode is not much slower than the production mode.

In practice, this mode uses the default random seed, and it also disables certain concurrency optimizations (such as work stealing). TODO: JBRULES-681 Multi-threaded support which implement those concurrency optimizations


PRODUCTION

public static final EnvironmentMode PRODUCTION
The production mode is the fastest and the most robust, but not reproducible. It is recommended for a production environment.

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).

Method Detail

values

public static EnvironmentMode[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (EnvironmentMode c : EnvironmentMode.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static EnvironmentMode 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


Copyright © 2001-2012 JBoss by Red Hat. All Rights Reserved.