Package com.anylogic.engine
- Nested Class Summary
- Field Summary
- Fields inherited from class com.anylogic.engine.Utilities
- Fields inherited from class com.anylogic.engine.Presentable
- Fields inherited from interface com.anylogic.engine.AgentConstants
- Fields inherited from interface com.anylogic.engine.EnvironmentConstants
- Fields inherited from interface com.anylogic.engine.UtilitiesMath
- Fields inherited from interface com.anylogic.engine.UtilitiesRandom
- Method Summary
- Field Details
- Method Details
- internalFillConfig
- isTestExperiment
- setName
- getName
- error
- errorInModel
- warning
- warning
- getRunCount
- getStep
- getState
- getProgress
- getRunTimeSeconds
- getWindowWidth
- getWindowHeight
- getExperimentHost
- run
- step
- pause
- stop
- close
- isCommandEnabled
- setLoadRootFromSnapshot
- isLoadRootFromSnapshot
- getSnapshotFileName
- getCommandLineArguments
- createRoot
- onBeforeSimulationRun
- onEngineFinished
- reset
- setup
- setupEngine
- onDestroy
- onDestroy_xjal
- destroy_xjal
- initDefaultRandomNumberGenerator
- onError
- onError
- addExecutionListener
- removeExecutionListener
- setCommandLineArguments_xjal
- getMutexRead_xjal
- getMutexWrite_xjal
- registerExperimentHost_xjal
- java.lang.Object
- com.anylogic.engine.Presentable
- com.anylogic.engine.Utilities
- com.anylogic.engine.Experiment<ROOT>
- Type Parameters:
ROOT
- class of top-level agent
- All Implemented Interfaces:
AgentConstants
,EnvironmentConstants
,UtilitiesMath
,UtilitiesRandom
,UtilitiesString
,Serializable
- Direct Known Subclasses:
ExperimentRunFast
,ExperimentSimulation
public abstract class Experiment<ROOT extends Agent> extends Utilities
A base class for all AnyLogic experiments. Experiment describes how would
one like to run the model (just perform a single simulation run, do Monte Carlo
simulation, vary parameters, optimize, etc.), and what outputs of the model you
are interested in (this may be a simple chart of how a certain value was changing over
time during a run, or how an observable depends on a parameter in case of
multiple runs, or a histogram in case of risk analysis, etc.). The experiment is
also capable of storing the outputs producted by the model so that they are
available after the simulation and independently of it. Experiment can display
itself in a presentation window and be controlled by the presentation GUI. For
that purpose it supports a set of commands that can be assigned to the presentation
window toolbar buttons and menu items.
AnyLogic models with GUI can run as Java applications.
AnyLogic models with GUI can run as Java applications.
- Author:
- AnyLogic North America, LLC https://anylogic.com
- See Also:
- Serialized Form
Modifier and Type | Class | Description |
---|---|---|
static enum | Experiment.Command | |
static enum | Experiment.State |
The state of the Engine
|
Modifier and Type | Field | Description |
---|---|---|
static final Experiment.State | ERROR | |
static final Experiment.State | FINISHED | |
static final Experiment.State | IDLE | |
com.anylogic.engine.internal.ActionQueue | modelExecutionCommandQueue |
This field shouldn't be accessed by user
is public due to technical reasons |
com.anylogic.engine.internal.ActionQueue | mutexModelActionQueue |
This field shouldn't be accessed by user
is public due to technical reasons |
static final Experiment.Command | OPEN_RESULTS | |
static final Experiment.Command | OPEN_SNAPSHOT | |
static final Experiment.Command | PAUSE | |
static final Experiment.State | PAUSED | |
static final Experiment.State | PLEASE_WAIT | |
static final Experiment.Command | RUN | |
static final Experiment.State | RUNNING | |
static final Experiment.Command | SAVE_RESULTS | |
static final Experiment.Command | SAVE_SNAPSHOT | |
static final Experiment.Command | STEP | |
static final Experiment.Command | STOP |
AM, APRIL, AUGUST, DECEMBER, FEBRUARY, FRIDAY, JANUARY, JULY, JUNE, LENGTH_UNIT_CENTIMETER, LENGTH_UNIT_FOOT, LENGTH_UNIT_INCH, LENGTH_UNIT_KILOMETER, LENGTH_UNIT_METER, LENGTH_UNIT_MILE, MARCH, MAY, MONDAY, NOVEMBER, OCTOBER, PM, SATURDAY, SEPTEMBER, SUNDAY, THURSDAY, TIME_UNIT_DAY, TIME_UNIT_HOUR, TIME_UNIT_MILLISECOND, TIME_UNIT_MINUTE, TIME_UNIT_MONTH, TIME_UNIT_SECOND, TIME_UNIT_WEEK, TIME_UNIT_YEAR, TUESDAY, UNDECIMBER, WEDNESDAY
ALIGNMENT_CENTER, ALIGNMENT_LEFT, ALIGNMENT_RIGHT, ARROW_FILLED, ARROW_NONE, ARROW_THIN, CAD_ANTIALIASING, CAD_INVERTED, LINE_STYLE_DASHED, LINE_STYLE_DOTTED, LINE_STYLE_SOLID, SHAPE_DRAW_2D, SHAPE_DRAW_2D3D, SHAPE_DRAW_3D
AGENT_ORIENTATION_FRONT, AGENT_ORIENTATION_LEFT, AGENT_ORIENTATION_REAR, AGENT_ORIENTATION_RIGHT, ALL, ALL_CONNECTED, ALL_NEIGHBORS, AREA_ACCESS_RESTRICTION_BY_CAPACITY, AREA_ACCESS_RESTRICTION_BY_CONDITION, AREA_ACCESS_RESTRICTION_BY_SCHEDULE, AREA_ACCESS_RESTRICTION_BY_THROUGHPUT, AREA_ACCESS_RESTRICTION_MANUAL, CENTIMETER, CONVEYOR_BACKWARD, CONVEYOR_CUSTOM_STATION_AGENT_LOCATION_CENTER, CONVEYOR_CUSTOM_STATION_AGENT_LOCATION_NEAR_CONVEYOR, CONVEYOR_CUSTOM_STATION_AGENT_LOCATION_RANDOM, CONVEYOR_FORWARD, CONVEYOR_SIMPLE_STATION_DELAY_TYPE_MANUAL, CONVEYOR_SIMPLE_STATION_DELAY_TYPE_TIMEOUT, CONVEYOR_TYPE_BELT, CONVEYOR_TYPE_CELL, CONVEYOR_TYPE_ROLLER, CUBIC_METER, CUBIC_METER_PER_SECOND, CUSTOM_COLOR_SCHEME, DAY, DEG_PER_SECOND, DEGREE, DENSITY_VALUE_MAX, DENSITY_VALUE_MEAN, EAST, ELEVATOR_DIRECTION_DOWN, ELEVATOR_DIRECTION_NONE, ELEVATOR_DIRECTION_UP, ELEVATOR_DOOR_FRONT, ELEVATOR_DOOR_REAR, ELEVATOR_DOORS_FRONT, ELEVATOR_DOORS_FRONT_REAR, ELEVATOR_DOORS_FRONT_REAR_XJAL, ELEVATOR_DOORS_FRONT_XJAL, ELEVATOR_MOVEMENT_BY_SPEED, ELEVATOR_MOVEMENT_BY_TIME_PER_LEVEL, ELEVATOR_STATE_FAILED, ELEVATOR_STATE_IDLE, ELEVATOR_STATE_LOADING, ELEVATOR_STATE_MOVING, ESCALATOR_STAY_ALL, ESCALATOR_WALK_ALL, ESCALATOR_WALK_ON_LEFT_SIDE, ESCALATOR_WALK_ON_RIGHT_SIDE, EVENT_TIMEOUT_MODE_CYCLIC, EVENT_TIMEOUT_MODE_ONCE, EVENT_TIMEOUT_MODE_USER, EXCEEDED_QUEUE_CROWD_ROUND_AT_THE_END, EXCEEDED_QUEUE_EXTEND_TO_THE_FREE_SPACE, EXT_AGENT_CONTINUOUS, EXT_AGENT_DISCRETE, EXT_AGENT_GIS, EXT_AGENT_INTERACTIVE, EXT_AGENT_NETWORK, EXT_ENTITY, EXT_ENVIRONMENT_CONTINUOUS, EXT_ENVIRONMENT_DISCRETE, EXT_ENVIRONMENT_GIS, EXT_ENVIRONMENT_INTERACTIVE, EXT_SPACE, FLOW_STATISTICS_BOTH, FLOW_STATISTICS_LEFT, FLOW_STATISTICS_RIGHT, FOOT, FPM, FPS, FPS_SQ, HOUR, INCH, JIB_CRANE_CAT_HEAD, JIB_CRANE_FLAT_TOP, JIB_CRANE_INDUSTRIAL, JIB_CRANE_MOVEMENT_CONCURRENT, JIB_CRANE_MOVEMENT_STEP_BY_STEP, KILOGRAM, KILOGRAM_PER_SECOND, KILOMETER, KN, KPH, LIFT_PLATFORM_FLAT, LIFT_PLATFORM_ROLLER, LIFT_SELECTION_MODE_COMPARISON, LIFT_SELECTION_MODE_FIFO, LIFT_SELECTION_MODE_PRIORITY, LINEAR_COLOR_SCHEME, LITER, LITER_PER_SECOND, LOGARITHMIC_COLOR_SCHEME, METER, MILE, MILLIMETER, MILLISECOND, MINUTE, MONTH, MPH, MPS, MPS_SQ, NAUTICAL_MILE, NORTH, NORTHEAST, NORTHWEST, OBJECT_3D_INTERNAL_LIGHTING_GLOBAL, OBJECT_3D_INTERNAL_LIGHTING_INSIDE, OBJECT_3D_INTERNAL_LIGHTING_OFF, OBJECT_3D_XYZ_AXIS_ORDER, OBJECT_3D_YZX_AXIS_ORDER, OBJECT_3D_ZXY_AXIS_ORDER, OIL_BARREL, OIL_BARREL_PER_SECOND, OVERHEAD_CRANE_BRIDGE, OVERHEAD_CRANE_GANTRY, OVERHEAD_CRANE_GIRDER_DOUBLE_TIE, OVERHEAD_CRANE_GIRDER_SINGLE_FLAT, OVERHEAD_CRANE_MOVEMENT_CONCURRENT, OVERHEAD_CRANE_MOVEMENT_INDEPENDENT_HOIST, OVERHEAD_CRANE_MOVEMENT_STEP_BY_STEP, PALLET_RACK_LEFT_TO_RIGHT, PALLET_RACK_NO_DIRECTION, PALLET_RACK_RIGHT_TO_LEFT, PALLET_RACK_SINGLE_AISLE_LEFT, PALLET_RACK_SINGLE_AISLE_RIGHT, PALLET_RACK_TWO_AISLES, PALLET_RACK_TWO_PALLET_RACKS, PARKING_LOT_PARALLEL, PARKING_LOT_PERPENDICULAR, PATH_CONVEYOR, PATH_DASHEDLINE, PATH_LINE, PATH_RAILROAD, PATH_ROAD, PEDESTRIAN_MAP_TYPE, PER_DAY, PER_HOUR, PER_MILLISECOND, PER_MINUTE, PER_MONTH, PER_SECOND, PER_WEEK, PER_YEAR, POSITION_CHOICE_ARRANGED, POSITION_CHOICE_BY_ATTRACTORS, POSITION_CHOICE_RANDOM, RACK_PLACEMENT_BACK_TO_BACK, RACK_PLACEMENT_STAND_ALONE, RACK_TYPE_DRIVE_IN, RACK_TYPE_FIFO_FLOW, RACK_TYPE_LIFO_FLOW, RACK_TYPE_SELECTIVE, RAD_PER_SECOND, RADIAN, RAILWAY_SWITCH_ALL_TO_ALL, RAILWAY_SWITCH_DOUBLE_SLIP, RAILWAY_SWITCH_SINGLE_SLIP, RANDOM, RANDOM_CONNECTED, RANDOM_NEIGHBOR, ROAD_LEFT_HAND, ROAD_LINE_DOUBLE, ROAD_LINE_DOUBLE_DASHED, ROAD_LINE_SINGLE, ROAD_LINE_SINGLE_DASHED, ROAD_RIGHT_HAND, RPM, SECOND, SERVICE_GROUP_BEHAVIOR_DEPENDS_ON_INCOMING_GROUP, SERVICE_GROUP_BEHAVIOR_SAME_FOR_ALL_GROUPS, SERVICE_GROUP_INDIVIDUAL_SERVING, SERVICE_GROUP_ONE_MEMBER_IS_SERVED_OTHERS_WAIT_IN_AREA, SERVICE_GROUP_ONE_MEMBER_IS_SERVED_OTHERS_WAIT_IN_QUEUE, SERVICE_QUEUE_CLOSEST_NON_EMPTY, SERVICE_QUEUE_CLOSEST_STRICT, SERVICE_QUEUE_CUSTOM, SERVICE_QUEUE_LONGEST, SERVICE_QUEUE_NEXT_ROUND_ROBIN, SERVICE_QUEUE_PRIORITY, SERVICE_TYPE_LINEAR, SERVICE_TYPE_POINT, SIGNAL_GREEN, SIGNAL_NONE, SIGNAL_RED, SIGNAL_YELLOW, SIMPLE_STATION_LOADING_MODE_AFTER_UNLOADING, SIMPLE_STATION_LOADING_MODE_SIMULTANEOUS_WITH_UNLOADING, SIMPLE_STATION_PROCESSING_WHEN_AGENT_ENTERS, SIMPLE_STATION_PROCESSING_WHEN_CAPACITY_FULL, SOUTH, SOUTHEAST, SOUTHWEST, SPACE_CONTINUOUS, SPACE_CONTINUOUS_2D, SPACE_DISCRETE, SPACE_DISCRETE_2D, SPACE_GIS, SPACE_UNDEFINED, SQ_CENTIMETER, SQ_FOOT, SQ_INCH, SQ_KILOMETER, SQ_METER, SQ_MILE, SQ_MILLIMETER, SQ_NAUTICAL_MILE, SQ_YARD, TON, TON_PER_SECOND, TRANSFER_MODE_AUTOMATIC, TRANSFER_MODE_MANUAL, TRANSPORTER_MAP_TYPE, TURN, TURN_STATION_MODE_ANGLE, TURN_STATION_MODE_ORIENTATION, WALL_FILL_HATCHING, WALL_FILL_NONE, WALL_FILL_SOLID, WEEK, WEST, WINDOW_3D_NAVIGATION_FULL, WINDOW_3D_NAVIGATION_LIMITED_TO_Z_ABOVE_ZERO, WINDOW_3D_NAVIGATION_NONE, WINDOW_3D_NAVIGATION_ROTATION_ONLY, YARD, YEAR
LAYOUT_ARRANGED, LAYOUT_RANDOM, LAYOUT_RING, LAYOUT_SPRING_MASS, LAYOUT_USER_DEFINED, NEIGHBORHOOD_EUCLIDEAN, NEIGHBORHOOD_MOORE, NETWORK_ALL_IN_RANGE, NETWORK_RANDOM, NETWORK_RING_LATTICE, NETWORK_SCALE_FREE, NETWORK_SMALL_WORLD, NETWORK_USER_DEFINED
Modifier and Type | Method | Description |
---|---|---|
final void | addExecutionListener |
This method is internal and shouldn't be called by user.
it may be removed/renamed in future. |
void | close() |
This method returns immediately and performs
the following actions in a separate thread:
stops experiment if it is not stopped,
destroys the model and
closes experiment window (only if model is started in the application mode)
|
abstract ROOT | createRoot |
Is called to obtain a new top-level agent.
|
final void | destroy_xjal() |
This method normally shouldn't be called by user.
Is called when the experiment object is dynamically disposed - before closing the model window. |
RuntimeException | error |
Signals an error during the model run by throwing a RuntimeException
with errorText preceded by the agent full name.
|
RuntimeException | errorInModel |
Signals an model logic error during the model run by throwing a ModelException
with errorText preceded by the agent full name.
This method differs from error() in the way of displaying error message:
model logic errors are 'softer' than other errors, they use to happen in the models
and signal the modeler that model might need some parameters adjustments. |
final String[] | getCommandLineArguments() |
Returns an array of Command-line Arguments passed to this
experiment on model start (empty array in case of no arguments)
Never returns null |
IExperimentHost | getExperimentHost() |
Returns the experiment host object of the model, or some dummy object
with no functionality if there is none.
|
Object | getMutexRead_xjal() |
This field shouldn't be called by user
is public due to technical reasons |
Object | getMutexWrite_xjal() |
This field shouldn't be called by user
is public due to technical reasons |
String | getName() |
Returns the name (window title) of the experiment.
|
abstract double | getProgress() |
Returns the progress of the experiment: a number between 0 and 1 depending
on what part of experiment is completed, or
-1 if not known. |
int | getRunCount() |
Returns the number of the current simulation run, more precisely the
number of times the model was destroyed.
|
abstract double | getRunTimeSeconds() |
Returns the real duration of the experiment in seconds, excluding pause
times.
|
final String | getSnapshotFileName() |
Returns the name of snapshot file this experiment is configured
to start simulation from
|
abstract Experiment.State | getState() |
Returns the current state of the experiment: IDLE, PAUSED, RUNNING,
FINISHED, ERROR, or PLEASE_WAIT
|
long | getStep() |
Returns the number of events executed by the engine.
|
int | getWindowHeight() |
Returns the initial height of the experiment window, 600 by default.
|
int | getWindowWidth() |
Returns the initial width of the experiment window, 800 by default.
|
void | initDefaultRandomNumberGenerator |
This method should be overridden to initialize random
number generator of the given engine
Default implementation set new random generation with random seed - for unique experiments |
void | internalFillConfig |
This class is internal and shouldn't be called by user.
it may be removed/renamed in future. |
boolean | isCommandEnabled |
Checks if a command can be executed.
|
final boolean | isLoadRootFromSnapshot() |
Returns
true if this experiment is configured
to start simulation from state loaded from snapshot file |
static boolean | isTestExperiment | |
void | onBeforeSimulationRun |
Deprecated.
|
void | onDestroy() |
User extension point which is called when the experiment object
is dynamically disposed - before closing the model window.
This method may be overridden to perform custom actions. Default implementation does nothing. |
void | onDestroy_xjal() |
This method normally shouldn't be called by user.
Is called when the experiment object is dynamically disposed - before closing the model window. This method should be overridden to release resources (e.g. |
void | onEngineFinished() |
Deprecated.
this method will be removed in future, please use
addExecutionListener(ExperimentExecutionListener) instead of overriding this method |
void | onError |
This method may be overridden to perform custom processing
on errors in the model execution (i.e.
|
void | onError |
This method may be overridden to perform custom processing
on errors in the model execution (i.e.
|
abstract void | pause() |
Pauses the experiment execution.
|
void | registerExperimentHost_xjal |
This method isn't designed to be called by user.
Public due to technical reasons May be removed in future releases |
final void | removeExecutionListener |
This method is internal and shouldn't be called by user.
it may be removed/renamed in future. |
void | reset() |
Is called each time before a new model is created and is intended
to reset all data associated with the experiment.
|
abstract void | run() |
Starts the experiment execution from the current state.
|
void | setCommandLineArguments_xjal |
This method should not be called by user
|
final void | setLoadRootFromSnapshot |
Tells this experiment to load the top-level agent from AnyLogic
snapshot file
This method is only available in the AnyLogic Professional |
void | setName |
Sets the name (window title) of the experiment.
|
void | setup |
Is called in static main() method of applications, after the experiment is constructed.
|
void | setupEngine |
Is called for the simulation engine when it is created
|
abstract void | step() |
Performs one step of experiment execution.
|
abstract void | stop() |
Terminates the experiment execution.
|
void | warning |
Signals a warning during the model run with warningText preceded by the agent full name.
Warnings may be turned off in the AnyLogic preferences (runtime section) or by API: AnyLogicRuntimePreferences.setEnableWarnings(Boolean) .This method checks against numerous warnings output: In case of multiple warnings having equal warningText , only the first 10 of them are displayed. |
void | warning |
Signals a warning during the model run with warningText preceded by the agent full name.
|
addToDate, addToDate, atan2fast, bernoulli, beta, beta, binomial, binomial, briefInfoOn, castNumberTypes, castTypes, castTypesBack, cauchy, chi2, convertMarkupSegmentDescriptors_xjal, copyToClipboard, copyToClipboard, copyToClipboard, createTableElementDatabaseBuilder, createTrajectoryGIS, createURL_xjal, date, dateToTime, day, deleteFrom, difference, difference, differenceInCalendarUnits, differenceInCalendarUnits, differenceInDateUnits, differenceInDateUnits, differenceInDateUnits, differenceInDateUnits, dirToAngle, dropTime, erlang, error, error, error, errorInModel, errorInModel, errorInModel, executeAction, executeExpression, executeExpression, executeStatement, exponential, exponential, findExistingFile, format, format, format, format, format, format, format, formatAmountUnits, formatDayOfWeek, formatFlowRateUnits, formatGeoHeading, formatLatitude, formatLengthUnits, formatLengthUnits, formatLongitude, formatMonth, formatSpeedUnits, formatTimeInterval, gamma, gamma, gammaLog, geometric, getAmPm, getAmPm, getCanonicalPath, getDatabaseConnection, getDateWithTimeNextTo, getDayOfMonth, getDayOfMonth, getDayOfWeek, getDayOfWeek, getDayOfYear, getDefaultRandomGenerator, getDistance, getDistance, getDistanceFromPointToLine, getDistanceFromPointToLineSq, getDistanceFromPointToSegment, getDistanceFromPointToSegment, getDistanceFromPointToSegmentSq, getDistanceFromPointToSegmentSq, getDistanceGIS, getDistanceGIS, getDistanceSq, getDistanceSq, getFullName, getHour, getHour, getHourOfDay, getHourOfDay, getLength, getLength, getLengthSq, getLengthSq, getMillisecond, getMillisecond, getMinute, getMinute, getMonth, getMonth, getName, getNearestPointOnSegment, getNearestPointOnSegment, getPerformanceParallelWorkersCount_xjal, getRandom, getRandom, getResult, getSecond, getSecond, getTime, getTimeoutToNextTime, getYear, getYear, gumbel1, gumbel2, hour, hypergeometric, insertInto, inspectOf, inspectOfLink_xjal, isFinite, isLineIntersectingLine, isLineIntersectingRectangle, isLoggingClassToDB, isLoggingToDB, isPointInsideRay, isPointInsideRectangle, isPointInsideSegment, isPointOnTheSameLine, isRayIntersectingSegment, joinArrays_xjal, laplace, layoutTypeToString, limit, limit, limitMax, limitMax, limitMin, limitMin, logarithmic, logistic, lognormal, logToDB, logToDB, logToDB, logToDB, millisecond, minute, month, negativeBinomial, negativeBinomial, normal, normal, pareto, pert, poisson, poisson, prepareBeforeExperimentStart_xjal, prepareStatement, pulse, pulseTrain, quantum, ramp, randomColor, randomFalse, randomFrom, randomFrom, randomFrom, randomlyCreate, randomlyCreate, randomTrue, randomWhere, randomWhere, rayleigh, roundToDecimal, roundToInt, second, selectAndDoForEach, selectArrayOfDouble, selectArrayOfInt, selectExists, selectExists, selectFirstValue, selectFirstValue, selectFirstValue, selectFirstValue, selectFrom, selectResultSet, selectTableFunction, selectUniqueValue, selectUniqueValue, selectUniqueValue, selectUniqueValue, selectValues, selectValues, setDefaultRandomGenerator, sqlGetObject, sqlGetObject, sqlGetObject, sqlGetObject, sqlSetObject, sqr, step, time, time, timeToDate, toDate, toDate, toDate, toDateInMillis, toLatitude, toLongitude, toModelRate, toModelTime, toRateUnits, toStringAlignedNameValues, toTimeout, toTimeout, toTimeoutInCalendar, toTimeUnits, trace, trace, traceln, traceln, traceln, traceln, traceln, traceToDB, traceToDB, triangular, triangular, triangularAV, uniform, uniform, uniform_discr, uniform_pos, update, week, weibull, weibull, xidz, year, zidz
createElementDescriptors, executeShapeControlAction, executeShapeControlAction, executeShapeControlAction, executeShapeControlAction, executeShapeControlAction, executeShapeControlAction, getElementDesciptors, getElementProperty, getEngine, getExperiment, getModelElementsShape, getPresentation, getPresentationShape, getShapeControlDefaultValueBoolean, getShapeControlDefaultValueDouble, getShapeControlDefaultValueInt, getShapeControlDefaultValueString, getViewAreas, iconContains, onSelectionChanged_xjal, onShapeClick, onShapeGroupDraw, presentationContains, readCustomData, updateShapeDynamicProperties, writeCustomData
bernoulli, beta, beta, beta, binomial, binomial, binomial, cauchy, cauchy, chi2, chi2, erlang, erlang, exponential, exponential, exponential, exponential, gamma, gamma, gamma, geometric, gumbel1, gumbel2, hypergeometric, laplace, logarithmic, logistic, lognormal, negativeBinomial, negativeBinomial, normal, normal, normal, normal, pareto, pareto, pert, poisson, poisson, random, randomFalse, randomFrom, randomFrom, randomFrom, randomlyCreate, randomlyCreate, randomTrue, randomWhere, randomWhere, rayleigh, rayleigh, shuffle, triangular, triangular, triangular, triangularAV, uniform, uniform, uniform, uniform_discr, uniform_discr, uniform_pos, weibull, weibull, weibull
public static final Experiment.State IDLE
public static final Experiment.State PAUSED
public static final Experiment.State RUNNING
public static final Experiment.State FINISHED
public static final Experiment.State ERROR
public static final Experiment.State PLEASE_WAIT
public static final Experiment.Command OPEN_RESULTS
public static final Experiment.Command SAVE_RESULTS
public static final Experiment.Command OPEN_SNAPSHOT
public static final Experiment.Command SAVE_SNAPSHOT
public static final Experiment.Command RUN
public static final Experiment.Command STEP
public static final Experiment.Command PAUSE
public static final Experiment.Command STOP
@AnyLogicInternalAPI public transient com.anylogic.engine.internal.ActionQueue modelExecutionCommandQueue
This field shouldn't be accessed by user
is public due to technical reasons
is public due to technical reasons
@AnyLogicInternalAPI public transient com.anylogic.engine.internal.ActionQueue mutexModelActionQueue
This field shouldn't be accessed by user
is public due to technical reasons
is public due to technical reasons
@AnyLogicInternalAPI public void internalFillConfig(LaunchConfiguration config)
This class is internal and shouldn't be called by user.
it may be removed/renamed in future.
it may be removed/renamed in future.
public static boolean isTestExperiment(Class<?> experimentClass)
@AnyLogicInternalCodegenAPI public void setName(String name)
Sets the name (window title) of the experiment.
This method is not intended to be called by user,
to change window title at run-time use
getExperimentHost().getFrame().setTitle("My new name");
- Parameters:
name
- the new name (window title) of the experiment
public String getName()
Returns the name (window title) of the experiment.
- Returns:
- the name (window title) of the experiment
public RuntimeException error(Throwable cause, String errorText)
Description copied from class:
Utilities
Signals an error during the model run by throwing a RuntimeException
with errorText preceded by the agent full name.
- Specified by:
error
in classUtilities
- Parameters:
cause
- the cause (which will be saved for more detailed message), may benull
errorText
- the text describing the error that will be displayed.- Returns:
- actually this method never returns, it throws runtime exception
by itself.
But the return type is defined for some cases when you would like to use the following form of call:throw error("my message");
public RuntimeException errorInModel(Throwable cause, String errorText)
Description copied from class:
Utilities
Signals an model logic error during the model run by throwing a ModelException
with errorText preceded by the agent full name.
This method differs from
This method differs from
error()
in the way of displaying error message:
model logic errors are 'softer' than other errors, they use to happen in the models
and signal the modeler that model might need some parameters adjustments. Examples
are 'entity was unable to leave flowchart block because subsequent block was busy',
'insufficient capacity of pallet rack' etc.- Specified by:
errorInModel
in classUtilities
- Parameters:
cause
- the cause (which will be saved for more detailed message), may benull
errorText
- the text describing the error that will be displayed.- Returns:
- actually this method never returns, it throws runtime exception
by itself.
But the return type is defined for some cases when you would like to use the following form of call:throw errorInModel("my message");
public void warning(String warningText)
Description copied from class:
Utilities
Signals a warning during the model run with warningText preceded by the agent full name.
Warnings may be turned off in the AnyLogic preferences (runtime section) or by API:
This method checks against numerous warnings output:
Warnings may be turned off in the AnyLogic preferences (runtime section) or by API:
AnyLogicRuntimePreferences.setEnableWarnings(Boolean)
.This method checks against numerous warnings output:
- In case of multiple warnings having equal
warningText
, only the first 10 of them are displayed. - When more than 1000 warnings having different
warningText
occur, all the subsequent warnings (including new occurrences of those in the first 1000) will stop displaying. - Be careful with using dynamically changing
warningText
(e.g. listing names of agents), it could be better to useUtilities.warning(String, Object...)
.
public void warning(String warningTextFormat, Object... args)
Description copied from class:
Utilities
Signals a warning during the model run with warningText preceded by the agent full name.
The method allows warning format syntax like in
Warnings may be turned off in the AnyLogic preferences (runtime section) or by API:
This method checks against numerous warnings output:
String.format(String, Object...)
method.Warnings may be turned off in the AnyLogic preferences (runtime section) or by API:
AnyLogicRuntimePreferences.setEnableWarnings(Boolean)
.This method checks against numerous warnings output:
- In case of multiple warnings having equal
warningTextFormat
, only the first 10 of them are displayed. - It is safe to raise numerous warnings with equal format string (which defines the warning type) but varying
args
- AnyLogic will take care to display only10
first warnings of each warning type. - When more than 1000 warnings having different
warningTextFormat
occur, all the subsequent warnings (including new occurrences of those in the first 1000) will stop displaying. - Don't use dynamically changing
warningTextFormat
(e.g. listing names of agents), useargs
instead.
public int getRunCount()
Returns the number of the current simulation run, more precisely the
number of times the model was destroyed.
- Returns:
- the number of the current simulation run, more precisely the number of times the model was destroyed.
public long getStep()
Returns the number of events executed by the engine.
- Returns:
- the number of events executed
public abstract Experiment.State getState()
Returns the current state of the experiment: IDLE, PAUSED, RUNNING,
FINISHED, ERROR, or PLEASE_WAIT
- Returns:
- the current state of the experiment
public abstract double getProgress()
Returns the progress of the experiment: a number between 0 and 1 depending
on what part of experiment is completed, or
-1
if not known.- Returns:
- the progress of the experiment
public abstract double getRunTimeSeconds()
Returns the real duration of the experiment in seconds, excluding pause
times.
- Returns:
- the real duration of the experiment in seconds
public int getWindowWidth()
Returns the initial width of the experiment window, 800 by default.
- Returns:
- the initial width of the experiment window
public int getWindowHeight()
Returns the initial height of the experiment window, 600 by default.
- Returns:
- the initial height of the experiment window
public IExperimentHost getExperimentHost()
Description copied from class:
Presentable
Returns the experiment host object of the model, or some dummy object
with no functionality if there is none.
- Specified by:
getExperimentHost
in classPresentable
- Returns:
- the experiment host object of the model
public abstract void run()
Starts the experiment execution from the current state.
public abstract void step()
Performs one step of experiment execution.
public abstract void pause()
Pauses the experiment execution.
public abstract void stop()
Terminates the experiment execution.
public void close()
This method returns immediately and performs
the following actions in a separate thread:
- stops experiment if it is not stopped,
- destroys the model and
- closes experiment window (only if model is started in the application mode)
public boolean isCommandEnabled(Experiment.Command cmd)
Checks if a command can be executed. The possible command ids are:
OPEN_RESULTS, SAVE_RESULTS, OPEN_SNAPSHOT, SAVE_SNAPSHOT, RUN, STEP
PAUSE, STOP.
- Parameters:
cmd
- the command id- Returns:
true
if the command can be executed,false
otherwise
public final void setLoadRootFromSnapshot(String snapshotFileName)
Tells this experiment to load the top-level agent from AnyLogic
snapshot file
This method is only available in the AnyLogic Professional
This method is only available in the AnyLogic Professional
- Parameters:
snapshotFileName
-
public final boolean isLoadRootFromSnapshot()
Returns
true
if this experiment is configured
to start simulation from state loaded from snapshot file- Returns:
true
if this experiment is configured to start simulation from state loaded from snapshot file
public final String getSnapshotFileName()
Returns the name of snapshot file this experiment is configured
to start simulation from
- Returns:
- the name of snapshot file this experiment is configured to start simulation from
public final String[] getCommandLineArguments()
Returns an array of Command-line Arguments passed to this
experiment on model start (empty array in case of no arguments)
Never returns
Never returns
null
- Returns:
- array of Command-line Arguments passed to this experiment on model start
@AnyLogicInternalCodegenAPI public abstract ROOT createRoot(Engine engine)
Is called to obtain a new top-level agent.
This method must be defined in a subclass. Note that
the top-level agent should just be constructed in this method, as
its create() and start() methods will be called later on.
This method should not be used to define parameters
This method should not be used to define parameters
- Parameters:
engine
- the simulation engine that will simulate the model
@Deprecated @AnyLogicInternalCodegenAPI public void onBeforeSimulationRun(ROOT root)
Deprecated.
this method will be removed in future, please use
addExecutionListener(ExperimentExecutionListener)
instead of overriding this method@Deprecated @AnyLogicInternalCodegenAPI public void onEngineFinished()
Deprecated.
this method will be removed in future, please use
addExecutionListener(ExperimentExecutionListener)
instead of overriding this method@AnyLogicInternalCodegenAPI public void reset()
Is called each time before a new model is created and is intended
to reset all data associated with the experiment. This is
an user's extension point; by default does nothing.
@AnyLogicInternalCodegenAPI public void setup(IExperimentHost experimentHost)
Is called in static main() method of applications, after the experiment is constructed.
Is intended to perform initial setup of the simulation engine and the presentation,
if any. This is a user's extension points; by default does nothing.
- Parameters:
experimentHost
- experiment host, seeExperimentHost
@AnyLogicInternalCodegenAPI public void setupEngine(Engine engine)
Is called for the simulation engine when it is created
- Parameters:
engine
- the simulation engine
@AnyLogicInternalCodegenAPI public void onDestroy()
User extension point which is called when the experiment object
is dynamically disposed - before closing the model window.
This method may be overridden to perform custom actions.
Default implementation does nothing.
This method may be overridden to perform custom actions.
Default implementation does nothing.
@AnyLogicInternalCodegenAPI public void onDestroy_xjal()
This method normally shouldn't be called by user.
Is called when the experiment object is dynamically disposed - before closing the model window.
This method should be overridden to release resources (e.g. commit connections with database) and call
Is called when the experiment object is dynamically disposed - before closing the model window.
This method should be overridden to release resources (e.g. commit connections with database) and call
super.doDestroy_xjal()
method at the end.
Don't call onDestroy()
when overriding this method: it is called automatically@AnyLogicInternalAPI public final void destroy_xjal()
This method normally shouldn't be called by user.
Is called when the experiment object is dynamically disposed - before closing the model window.
Is called when the experiment object is dynamically disposed - before closing the model window.
@AnyLogicInternalCodegenAPI public void initDefaultRandomNumberGenerator(Engine engine)
This method should be overridden to initialize random
number generator of the given engine
Default implementation set new random generation with random seed - for unique experiments
Default implementation set new random generation with random seed - for unique experiments
- Parameters:
engine
- the engine instance
public void onError(Throwable error)
This method may be overridden to perform custom processing
on errors in the model execution (i.e. errors in the action code
of events, dynamic events, transitions, entry/exit codes
of states etc, formulas, conditions of events etc.)
By default, this method does nothing.
This method shouldn't be called directly by user. Instead, engine calls it internally.
By default, this method does nothing.
This method shouldn't be called directly by user. Instead, engine calls it internally.
- Parameters:
error
- an error which has occurred during event execution
public void onError(Throwable error, Agent root)
This method may be overridden to perform custom processing
on errors in the model execution (i.e. errors in the action code
of events, dynamic events, transitions, entry/exit codes
of states etc, formulas, conditions of events etc.)
By default, this method does nothing.
This method shouldn't be called directly by user. Instead, engine calls it internally.
By default, this method does nothing.
This method shouldn't be called directly by user. Instead, engine calls it internally.
- Parameters:
error
- an error which has occurred during event executionroot
- the root (main) agent of the model, useful for experiments with multiple runs executed in parallel. May benull
in some cases (e.g. on errors during root agent creation).- Since:
- 8.4
@AnyLogicInternalAPI public final void addExecutionListener(ExperimentExecutionListener listener)
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
it may be removed/renamed in future.
@AnyLogicInternalAPI public final void removeExecutionListener(ExperimentExecutionListener listener)
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
it may be removed/renamed in future.
@AnyLogicInternalCodegenAPI public void setCommandLineArguments_xjal(String[] commandLineArguments)
This method should not be called by user
- Parameters:
commandLineArguments
-
@AnyLogicInternalAPI public Object getMutexRead_xjal()
This field shouldn't be called by user
is public due to technical reasons
is public due to technical reasons
@AnyLogicInternalAPI public Object getMutexWrite_xjal()
This field shouldn't be called by user
is public due to technical reasons
is public due to technical reasons
@AnyLogicInternalAPI public void registerExperimentHost_xjal(IExperimentHost experimentHost)
This method isn't designed to be called by user.
Public due to technical reasons
May be removed in future releases
Public due to technical reasons
May be removed in future releases
addExecutionListener(ExperimentExecutionListener)
instead of overriding this method