mable.simulation_space package
Submodules
mable.simulation_space.structure module
The space where the simulation and operation takes place including the seas and the ports.
- class mable.simulation_space.structure.NetworkWithPortDict(ports=None)
Bases:
ShippingNetwork
,ABC
A space of operation that stores the ports in form of a dictionary.
- __init__(ports=None)
- get_port(name)
Returns the port with the name.
- get_port_or_default(name, default=None)
Returns a port by name or the default value in case no port with the specified name exists. :param _sphinx_paramlinks_mable.simulation_space.structure.NetworkWithPortDict.get_port_or_default.name: str
The name of the port.
- Parameters:
default¶ – Any The default value to return. By default, this is None.
- Returns:
default Whatever is passed to default or None if nothing is specified.
- property ports
- class mable.simulation_space.structure.ShippingNetwork
Bases:
SimulationEngineAware
An abstract class for the space of operation.
- __init__()
- abstract static get_distance(location_one, location_two)
Returns the distance between two locations. :param _sphinx_paramlinks_mable.simulation_space.structure.ShippingNetwork.get_distance.location_one: Location
The first location.
- Parameters:
location_two¶ – Location The second location.
- Returns:
float The distance.
- abstract get_journey_location(journey, vessel, current_time)
Returns the current position of the vessel based on the journey information and the current time. :param _sphinx_paramlinks_mable.simulation_space.structure.ShippingNetwork.get_journey_location.journey: Journey
The journey object.
- abstract get_port(name)
Returns a port by name. :param _sphinx_paramlinks_mable.simulation_space.structure.ShippingNetwork.get_port.name: str
The name of the port.
- Returns:
Port The port by the name.
- abstract get_port_or_default(name, default=None)
Returns a port by name or the default value in case no port with the specified name exists.
- get_vessel_location(vessel, current_time)
Returns the location of the vessel assuming the vessel is either in a port or on a journey. If the vessel is on a journey the current time is used to determine the vessel’s location on the journey.
The method is robust to the vessel having a location by name or Location, i.e. if the vessel’s location is a port name the port will be determined by the name. :param _sphinx_paramlinks_mable.simulation_space.structure.ShippingNetwork.get_vessel_location.vessel: Vessel
The vessel.
- Parameters:
current_time¶ – float The current time.
- Returns:
Location The current location of the vessel.
- class mable.simulation_space.structure.UnitShippingNetwork(ports=None)
Bases:
NetworkWithPortDict
A space of operation in the [0,1]^2 Euclidian space.
- __init__(ports=None)
Constructor. :param _sphinx_paramlinks_mable.simulation_space.structure.UnitShippingNetwork.ports: dict | list
The collection of ports.
- get_distance(location_one, location_two)
Returns the Euclidean distance between two locations. :param _sphinx_paramlinks_mable.simulation_space.structure.UnitShippingNetwork.get_distance.location_one: Location
The first location.
- Parameters:
location_two¶ – Location The second location.
- Returns:
float The Euclidean distance. If the location are outside of [0,1]^2 float(‘inf’) is returned.
- get_journey_location(journey, vessel, current_time)
Returns the current position of the vessel based on the journey information and the current time. If the current time is before the start time the origin is returned. Similarly, if the current time is beyond the start time plus the travel time the destination is returned. :param _sphinx_paramlinks_mable.simulation_space.structure.UnitShippingNetwork.get_journey_location.journey: Journey
The journey object.
mable.simulation_space.universe module
- class mable.simulation_space.universe.Location(x, y, name=None)
Bases:
object
A location in the operational space.
- __init__(x, y, name=None)
- property name
- property x
- property y
- class mable.simulation_space.universe.OnJourney(origin: Location, destination: Location, start_time: float)
Bases:
object
An indicator that a vessel is in transit, i.e. performing a journey.
- Parameters:
- __init__(origin: Location, destination: Location, start_time: float) None
Method generated by attrs for class OnJourney.
- start_time: float