AnyLogic
Expand
Font size
Type Parameters:
ROOT - class of top-level agent
All Implemented Interfaces:
AgentConstants, EnvironmentConstants, UtilitiesMath, UtilitiesRandom, UtilitiesString, Serializable

public abstract class ExperimentSimulation<ROOT extends Agent>
extends Experiment<ROOT>
The simplest possible experiment consisting of a single simulation run. One should implement the createRoot() method in a subclass to set a particular model to this experiment.
A typical usage pattern is here:

public class MyExperiment extends ExperimentSimulation {
 
    public Agent createRoot( Engine engine ) {
       MyMain root = new MyMain( engine, null, null );
       //set parameters of root if needed
       ...
       return root;
    }
 
    public void setup() {
       Engine eng = getEngine();
       //set engine stop time, time mode, etc.
       ...
       Presentation p = new Presentation( ex, null );
       p.start();
       //set presentation size, configure toolbar, etc.
       ...
    }
 
    public static void main( String[] args ) {
       MyExperiment ex = new MyExperiment();
       ex.setName( "My Experiment" );
       ex.setup( null );
    }
 
 }
 
Author:
AnyLogic North America, LLC https://anylogic.com
See Also:
Serialized Form

Nested Class Summary

Nested classes/interfaces inherited from class com.anylogic.engine.Experiment

Experiment.Command, Experiment.State

Field Summary

Fields inherited from interface com.anylogic.engine.AgentConstants

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

Fields inherited from interface com.anylogic.engine.UtilitiesMath

infinity

Fields inherited from interface com.anylogic.engine.UtilitiesRandom

RANDOM_BOUNDED_DISTRIBUTIONS_MAX_ITERATIONS

Constructor Summary

ConstructorDescription
ExperimentSimulation()
Creates the experiment and a new simulation engine that will be used for all simulations.

Method Summary

Modifier and TypeMethodDescription
voidcustomRunPause_xjal(boolean requestRun, boolean atAbsoluteTime, double time)
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
voidcustomRunPause_xjal(boolean absoluteTime, double t)
Deprecated.
final com.anylogic.engine.internal.ActiveViewep_xjal()
This method shouldn't be accessed by user
is public due to technical reasons
voidfinish()
Sets a flag that, when tested by the engine, causes it to finish after completing the current event execution.
EnginegetEngine()
Returns the engine executing the model.
doublegetProgress()
Returns the progress of the experiment: in this case it is the same as the progress of the current simulation run.
doublegetRunTimeSeconds()
Returns the real duration of the experiment in seconds, excluding pause times, in this case it is same as duration of the simulation run.
Experiment.StategetState()
Returns the current state of the experiment.
voidonDestroy_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.
voidpause()
Pauses the model execution.
voidregisterExperimentHost_xjal(IExperimentHost experimentHost)
This method isn't designed to be called by user.
Public due to technical reasons
May be removed in future releases
voidrun()
Runs the model from the current state.
voidrunAndShowRoot_xjal()
Deprecated.
voidsetNewEngine_xjal(Engine engine)
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
abstract voidsetupRootParameters(ROOT root, boolean callOnChangeActions)
Is called to setup parameters of top-level agent.
voidstep()
Performs one step of the model execution.
voidstop()
Terminates the model execution, destroys and forgets the model and calls garbage collector, but keeps all experiment data.

Methods inherited from class com.anylogic.engine.Utilities

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

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Details

ExperimentSimulation

public ExperimentSimulation()
Creates the experiment and a new simulation engine that will be used for all simulations.

Method Details

getEngine

public Engine getEngine()
Returns the engine executing the model.
Specified by:
getEngine in class Presentable
Returns:
the engine executing the model

getState

public Experiment.State getState()
Returns the current state of the experiment. In case of ExperimentSimulation it is the same as the state of the engine and can be IDLE, PAUSED, RUNNING, STEP, FINISHED, ERROR.
Specified by:
getState in class Experiment<ROOT extends Agent>
Returns:
the current state of the experiment

getProgress

public double getProgress()
Returns the progress of the experiment: in this case it is the same as the progress of the current simulation run.
Specified by:
getProgress in class Experiment<ROOT extends Agent>
Returns:
the progress of the experiment

getRunTimeSeconds

public double getRunTimeSeconds()
Returns the real duration of the experiment in seconds, excluding pause times, in this case it is same as duration of the simulation run.
Specified by:
getRunTimeSeconds in class Experiment<ROOT extends Agent>
Returns:
the real duration of the experiment in seconds

runAndShowRoot_xjal

@AnyLogicInternalAPI
@Deprecated
public void runAndShowRoot_xjal()
Deprecated.
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.

run

public void run()
Runs the model from the current state. If model is not yet existing, resets the experiment, creates and starts the model.
Specified by:
run in class Experiment<ROOT extends Agent>

customRunPause_xjal

@Deprecated
@AnyLogicInternalAPI
public void customRunPause_xjal(boolean absoluteTime,
 double t)
Deprecated.
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.

customRunPause_xjal

@AnyLogicInternalAPI
public void customRunPause_xjal(boolean requestRun,
 boolean atAbsoluteTime,
 double time)
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.

step

public void step()
Performs one step of the model execution. If model is not yet existing, resets the experiment, creates and starts the model (not making a step).
Specified by:
step in class Experiment<ROOT extends Agent>

pause

public void pause()
Pauses the model execution.
Specified by:
pause in class Experiment<ROOT extends Agent>
See Also:
Engine.pause()

finish

public void finish()
Sets a flag that, when tested by the engine, causes it to finish after completing the current event execution.
See Also:
Engine.finish()

stop

public void stop()
Terminates the model execution, destroys and forgets the model and calls garbage collector, but keeps all experiment data.
Specified by:
stop in class Experiment<ROOT extends Agent>
See Also:
Engine.stop()

setupRootParameters

@AnyLogicInternalCodegenAPI
public abstract void setupRootParameters(ROOT root,
 boolean callOnChangeActions)
Is called to setup parameters of top-level agent. This method must be defined in a subclass.
Parameters:
root - the top-level agent instance
callOnChangeActions - if true this method should use set_* methods of root to setup parameters, otherwise parameter values should be simply assigned to the fields of root

onDestroy_xjal

public void onDestroy_xjal()
Description copied from class: Experiment
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 super.doDestroy_xjal() method at the end. Don't call Experiment.onDestroy() when overriding this method: it is called automatically
Overrides:
onDestroy_xjal in class Experiment<ROOT extends Agent>

ep_xjal

@AnyLogicInternalAPI
public final com.anylogic.engine.internal.ActiveView ep_xjal()
This method shouldn't be accessed by user
is public due to technical reasons

registerExperimentHost_xjal

@AnyLogicInternalAPI
public void registerExperimentHost_xjal(IExperimentHost experimentHost)
Description copied from class: Experiment
This method isn't designed to be called by user.
Public due to technical reasons
May be removed in future releases
Overrides:
registerExperimentHost_xjal in class Experiment<ROOT extends Agent>

setNewEngine_xjal

@AnyLogicInternalAPI
public void setNewEngine_xjal(Engine engine)
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.