mable.competition package

Submodules

mable.competition.generation module

class mable.competition.generation.AuctionCargoEvent(time)

Bases: CargoEvent

An event of appearance of cargoes in an auction setting.

__init__(time)
Parameters:
  • time (float) – The occurrence time of the event.

  • info (str) – Some info on the event for logging etc.

property allocation_result

The allocation result.

Returns:

event_action(engine)

Collects the cargoes becoming available at the event’s time from the shipping object and passes them to the market for distribution.

Parameters:

engine (AuctionSimulationEngine) – The simulation engine.

Returns:

The distribution ledger.

Return type:

AuctionLedger

class mable.competition.generation.AuctionClassFactory

Bases: FuelClassFactory

static generate_engine(*args, **kwargs)

Generates a simulation engine. Default: py:class:maritime_simulator.engine.SimulationEngine. :param _sphinx_paramlinks_mable.competition.generation.AuctionClassFactory.generate_engine.args:

Positional args.

Parameters:

kwargs – Keyword args.

Returns:

The engine.

static generate_event_cargo(*args, **kwargs)

Generates a cargo event. Default: py:class:maritime_simulator.event_management.CargoEvent.

Parameters:
  • args – Positional args.

  • kwargs – Keyword args.

Returns:

The event.

static generate_market(*args, **kwargs)

Generates a market. Default: py:class:maritime_simulator.shipping_market.SimpleMarket. :param _sphinx_paramlinks_mable.competition.generation.AuctionClassFactory.generate_market.args:

Positional args.

Parameters:

kwargs – Keyword args.

Returns:

The market.

static generate_shipping(*args, **kwargs)

Generates a shipping (cargo generation) unit. Default: py:class:maritime_simulator.shipping_market.StaticShipping. :param _sphinx_paramlinks_mable.competition.generation.AuctionClassFactory.generate_shipping.args:

Positional args.

Parameters:

kwargs – Keyword args.

Returns:

The shipping.

class mable.competition.generation.AuctionSimulationEngine(world, shipping_companies, cargo_generation, cargo_market, class_factory, pre_run_cmds=None, post_run_cmds=None, output_directory=None, global_agent_timeout=60, info=None)

Bases: SimulationEngine

class mable.competition.generation.CompetitionBuilder(class_factory, specifications)

Bases: FuelSimulationFactory

generate_fleet(*args, **kwargs)

Generates the fleet of vessels of one company based on a list of vessel specifications and SimulationFactory.generate_vessel(). :param _sphinx_paramlinks_mable.competition.generation.CompetitionBuilder.generate_fleet.args:

Positional args. The first argument should be a list of vessel instructions.

Parameters:

kwargs – Keyword args.

Returns:

A list of vessels.

generate_shipping_companies(*args, **kwargs)

Generates the shipping companies including the vessels based on the specification information and the class factory’s ClassFactory.generate_company() and SimulationFactory.generate_fleet(), respectively. :param _sphinx_paramlinks_mable.competition.generation.CompetitionBuilder.generate_shipping_companies.args:

Positional args. (Most likely no arguments since the args from the specifications are used. But can be used for further instructions from generate_engine().)

Parameters:

kwargs – Keyword args. (Most likely no arguments since the kwargs from the specifications are used. But can be used for further instructions from generate_engine().)

Returns:

self

set_engines(engine, *args, **kwargs)

Makes the engine known to the units constituting the simulation.

mable.competition.generation.load_module_from_file(file_directory_path='.')

mable.competition.information module

Safe distribution of information to companies.

class mable.competition.information.CompanyHeadquarters(simulation_engine)

Bases: object

A centre that allows the trading companies to interact with the wider environment.

__init__(simulation_engine)
Parameters:

simulation_engine (SimulationEngine) – The simulation engine.

property current_time

The current time of the simulation.

Returns:

The current time.

Return type:

float

get_companies()

Get all companies. :return:

get_journey_location(journey, vessel, time=None)

Get the current location of a vessel on a journey.

Warning: If the location is intended to calculate an exact distance with get_network_distance(), that calculation will take time. It may be better to work with the origin and destination of a journey rather than the actual location of the vessel.

Parameters:
  • journey (OnJourney) – The journey.

  • vessel (Vessel) – The vessel that is performing the journey.

  • time (float) – The time at which the journey location will be calculated. Default, i.e. None, is the current time.

Returns:

The current location the vessel is in.

Return type:

Location

get_network_distance(location_one, location_two)

Get the distance between two locations.

If there is no route between the two locations infinity (math.inf) if returned.

The two locations can be a location (Location), a port (Port) or the names thereof.

Warning: If one or both of the locations come from a vessel on a journey, the calculation will take time. It may be better to work with the origin and destination of a journey rather than the actual location of the vessel.

Parameters:
Returns:

The distance or math.inf if no route between the two locations exists.

Return type:

float

get_network_port_or_default(port_name, default)

Returns a port by name or the default value in case no port with the specified name exists.

Parameters:
  • port_name (str) – The name of the port.

  • default (Any) – The default value to return. By default, this is None.

Returns:

Either the port or whatever is passed to default (None by default).

Return type:

Union[Port, Any]

class mable.competition.information.MarketAuthority

Bases: object

__init__()
add_allocation_results(allocation_results)
Parameters:

allocation_results (AuctionAllocationResult)

property contracts_per_company
Returns:

All contracts for all companies.

Return type:

Dict[ShippingCompany, List[Contract]]

trade_fulfilled(trade, company)
Parameters:

Module contents