mable.examples package

Submodules

mable.examples.companies module

class mable.examples.companies.MyArchEnemy(fleet, name, profit_factor=1.65)

Bases: TradingCompany

class Data(current_class: Type[DataProtocol], fleet: list[Data], name: str, profit_factor: float = 1.65)

Bases: Data

class Schema(*, only: Sequence[str] | AbstractSet[str] | None = None, exclude: Sequence[str] | AbstractSet[str] = (), many: bool | None = None, context: dict | None = None, load_only: Sequence[str] | AbstractSet[str] = (), dump_only: Sequence[str] | AbstractSet[str] = (), partial: bool | Sequence[str] | AbstractSet[str] | None = None, unknown: str | None = None)

Bases: Schema

opts: SchemaOpts = <marshmallow.schema.SchemaOpts object>
__init__(current_class: Type[DataProtocol], fleet: list[Data], name: str, profit_factor: float = 1.65) None

Method generated by attrs for class MyArchEnemy.Data.

profit_factor: float
__init__(fleet, name, profit_factor=1.65)
Parameters:
  • fleet (List[VesselWithEngine]) – The companies fleet.

  • name (str) – The companies name.

  • profit_factor (float) – The companies profit factor, i.e. factor applied to cost to determine bids.

propose_schedules(trades)

Tries to generate new schedules based on the vessels’ current schedules and the specified trades. Trades are attempted to schedule by simply finding the first vessel that can transport the cargo after finishing the current schedule.

Parameters:

trades (List[Trade]) – The trades.

Returns:

The schedule proposals.

Return type:

ScheduleProposal

class mable.examples.companies.PondPlayer(fleet, name)

Bases: TradingCompany

receive(contracts, auction_ledger=None, *args, **kwargs)

Allocate a list of trades to the company.

Parameters:
  • contracts (List[Contract]) – The list of trades.

  • auction_ledger (AuctionLedger | None) – Outcomes of all cargo auctions in the round.

  • args – Not used.

  • kwargs – Not used.

class mable.examples.companies.TheScheduler(fleet, name, profit_factor=1.65)

Bases: TradingCompany

class Data(current_class: Type[DataProtocol], fleet: list[Data], name: str, profit_factor: float = 1.65)

Bases: Data

class Schema(*, only: Sequence[str] | AbstractSet[str] | None = None, exclude: Sequence[str] | AbstractSet[str] = (), many: bool | None = None, context: dict | None = None, load_only: Sequence[str] | AbstractSet[str] = (), dump_only: Sequence[str] | AbstractSet[str] = (), partial: bool | Sequence[str] | AbstractSet[str] | None = None, unknown: str | None = None)

Bases: Schema

opts: SchemaOpts = <marshmallow.schema.SchemaOpts object>
__init__(current_class: Type[DataProtocol], fleet: list[Data], name: str, profit_factor: float = 1.65) None

Method generated by attrs for class TheScheduler.Data.

profit_factor: float
__init__(fleet, name, profit_factor=1.65)
Parameters:
  • fleet (List[VesselWithEngine]) – The companies fleet.

  • name (str) – The companies name.

  • profit_factor (float) – The companies profit factor, i.e. factor applied to cost to determine bids.

predict_cost(vessel, trade)
propose_schedules(trades, calculate_cost=True)

Tries to generate new schedules based on the vessels’ current schedules and the specified trades. Trades are attempted to schedule by simply finding the first vessel that can transport the cargo after finishing the current schedule.

Parameters:

trades (List[Trade]) – The trades.

Returns:

The schedule proposals.

Return type:

ScheduleProposal

receive(contracts, auction_ledger=None, *args, **kwargs)

Allocate a list of trades to the company.

Parameters:
  • contracts (List[Contract]) – The list of trades.

  • auction_ledger (AuctionLedger | None) – Outcomes of all cargo auctions in the round.

  • args – Not used.

  • kwargs – Not used.

mable.examples.environment module

mable.examples.environment.generate_simulation(specifications_builder, show_detailed_auction_outcome=False, output_directory='.', global_agent_timeout=60, info=None)

Generate a simulation from a specifications.

Parameters:
  • specifications_builder (FuelSpecsBuilder) – The specifications builder that has been used to specify a simulation settings.

  • show_detailed_auction_outcome (bool) – Log the outcomes of auctions in detail.

  • output_directory (str) – A directory to save the simulation output files.

  • global_agent_timeout (int.) – The timeout in seconds of every agent action, e.g. one call to ‘inform’ or ‘receive’. Default is 60 seconds.

  • info (str | dict) – Any information on the simulation.

Returns:

The simulation instance.

Return type:

SimulationEngine

Raises:

ValueError – If the output directory does not exist.

mable.examples.environment.get_specification_builder(environment_files_path='.', trade_occurrence_frequency=30, trades_per_occurrence=1, num_auctions=2, fixed_trades=None, use_only_precomputed_routes=True)

Generate a specifications builder to specify a simulation settings.

Parameters:
Returns:

The specification builder.

Return type:

FuelSpecsBuilder

Raises:

FileNotFoundError – If the resource file does not exist.

mable.examples.fleets module

mable.examples.fleets.default_laden_balast_consumption()

Returns laden and balast consumption curve specifications.

Returns:

Tuple of laden and balast consumption.

Return type:

Tuple[ConsumptionRate.Data, ConsumptionRate.Data]

mable.examples.fleets.default_suezmax_aframax_laden_balast_consumption()

Returns laden and balast consumption curve specifications.

Returns:

Tuple of laden and balast consumption.

Return type:

Tuple[ConsumptionRate.Data, ConsumptionRate.Data]

mable.examples.fleets.default_vlcc_laden_balast_consumption()

Returns laden and balast consumption curve specifications.

Returns:

Tuple of laden and balast consumption.

Return type:

Tuple[ConsumptionRate.Data, ConsumptionRate.Data]

mable.examples.fleets.example_fleet_1()

A fleet with one vessel docked in Aberdeen.

Returns:

The fleet.

Return type:

List[VesselWithEngine.Data]

mable.examples.fleets.example_fleet_2()

A fleet with one vessel docked in Aberdeen.

Returns:

The fleet.

Return type:

List[VesselWithEngine.Data]

mable.examples.fleets.example_fleet_3()

A fleet with two vessel.

Returns:

The fleet.

Return type:

List[VesselWithEngine.Data]

mable.examples.fleets.get_fuel_mfo()

Return an ‘MFO’ fuel instance.

Returns:

The fuel instance.

:rtype Fuel

mable.examples.fleets.get_vessel(laden_consumption_rate, ballast_consumption_rate, idle_consumption, loading_consumption, unloading_consumption, capacity, name, port=None)

Generate a vessel based on the specifications.

Parameters:
  • laden_consumption_rate (ConsumptionRate.Data) – The laden consumption curve.

  • ballast_consumption_rate (ConsumptionRate.Data) – The ballast consumption curve.

  • idle_consumption (float) – Fixed idle consumption per day.

  • loading_consumption (float) – Fixed loading consumption per day.

  • unloading_consumption (float) – Fixed unloading consumption per day.

  • capacity (float)

  • name – The name of the vessel.

  • port (str | None) – The starting port of the vessel. If None will be allocated at random.

Returns:

The vessel.

Return type:

VesselWithEngine.Data

mable.examples.fleets.get_vessel_aframax(name, port=None)

Generate an Aframax vessel.

Parameters:
  • name (str | None) – The name of the vessel.

  • port (str | None) – The starting port of the vessel. If None will be allocated at random.

Returns:

The vessel.

Return type:

VesselWithEngine.Data

mable.examples.fleets.get_vessel_suezmax(name, port=None)

Generate a Suezmax vessel.

Parameters:
  • name (str | None) – The name of the vessel.

  • port (str | None) – The starting port of the vessel. If None will be allocated at random.

Returns:

The vessel.

Return type:

VesselWithEngine.Data

mable.examples.fleets.get_vessel_vlcc(name, port=None)

Generate a VLCC vessel.

Parameters:
  • name (str | None) – The name of the vessel.

  • port (str | None) – The starting port of the vessel. If None will be allocated at random.

Returns:

The vessel.

Return type:

VesselWithEngine.Data

mable.examples.fleets.mixed_fleet(num_suezmax=0, num_aframax=0, num_vlcc=0)

Returns a fleet with the specified number of Suezmax (capacity 145000), Aframax (capacity 100000), VLCC (capacity 285000) vessels.

All vessels start in random locations and have random names.

Parameters:
  • num_suezmax (int) – The number of Suezmax vessels.

  • num_aframax (int) – The number of Aframax vessels.

  • num_vlcc (int) – The number of VLCC vessels.

Returns:

The fleet.

Return type:

List[VesselWithEngine.Data]

mable.examples.fleets.specified_laden_balast_consumption(laden_base, laden_speed_power, ballast_base, ballast_speed_power)

Returns laden and balast consumption curve specifications.

Returns:

Tuple of laden and balast consumption.

Return type:

Tuple[ConsumptionRate.Data, ConsumptionRate.Data]

mable.examples.shipping module

mable.examples.shipping.example_trades_1()

A list of five specified trades.

Month 1:
  • Aberdeen to La Plata (amount: 100000)

  • Hartlepool to Rotterdam (amount: 210000)

Month 2:
  • Rostock to Singapore (amount: 100000, earliest drop-off after day 90)

  • Jeddah to Texas City (amount: 100000)

Month 3:
  • Singapore to Panama City (amount: 100000, latest pick-up before day 100)

Returns:

The list of trades.

Return type:

List[TimeWindowTrade]

Module contents