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:
- Returns:
The schedule proposals.
- Return type:
- class mable.examples.companies.PondPlayer(fleet, name)
Bases:
TradingCompany
- 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:
- Returns:
The schedule proposals.
- Return type:
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:
- 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:
environment_files_path¶ (str) – The location of the environment files, i.e. the resources archive.
trade_occurrence_frequency¶ (int) – The number of days between each auction occurrence. Default is 30 days.
trades_per_occurrence¶ (int) – The number of trades per auction occurrence. Default is 1.
num_auctions¶ (int) – The number of auctions. Default is 2.
fixed_trades¶ (List[Trade]) – A list of fixed trades. Default is None. If fixed trades are specified,
get_specification_builder.trade_occurrence_frequency,get_specification_builder.trades_per_occurrenceandget_specification_builder.num_auctionswill be ignored.use_only_precomputed_routes¶ (bool) – Only generate cargoes between ports that have a precomputed route. Default is True.
- Returns:
The specification builder.
- Return type:
- 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:
- 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:
- mable.examples.fleets.default_vlcc_laden_balast_consumption()
Returns laden and balast consumption curve specifications.
- Returns:
Tuple of laden and balast consumption.
- Return type:
- 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:
- mable.examples.fleets.get_vessel_aframax(name, port=None)
Generate an Aframax vessel.
- Parameters:
- Returns:
The vessel.
- Return type:
- mable.examples.fleets.get_vessel_suezmax(name, port=None)
Generate a Suezmax vessel.
- Parameters:
- Returns:
The vessel.
- Return type:
- mable.examples.fleets.get_vessel_vlcc(name, port=None)
Generate a VLCC vessel.
- Parameters:
- Returns:
The vessel.
- Return type:
- 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:
- 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:
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]