Skip to content
Snippets Groups Projects
Commit 1de15125 authored by Florian Schröder's avatar Florian Schröder
Browse files

configure the allowed meals via environment_config.yaml and some comments

parent bbb290f9
No related branches found
No related tags found
1 merge request!27Resolve "Orders"
Pipeline #44062 passed
......@@ -2,39 +2,59 @@ plates:
clean_plates: 1
dirty_plates: 2
plate_delay: [ 5, 10 ]
# seconds until the dirty plate arrives.
game:
time_limit_seconds: 180
meals:
all: false
# if all: false -> only orders for these meals are generated
list:
- TomatoSoup
- OnionSoup
- Salad
orders:
kwargs:
duration_sample:
# how long should the orders be alive
# 'random' library call with getattr, kwargs are passed to the function
func: uniform
kwargs:
a: 40
b: 60
max_orders: 6
# maximum number of active orders at the same time
num_start_meals: 3
# number of orders generated at the start of the environment
sample_on_dur: true
# if true, the next order is generated based on the sample_on_dur_func method in seconds
# if sample_on_serving is also true, the value is sampled after a meal was served, otherwise it is sampled directly after an order generation.
sample_on_dur_func:
# 'random' library call with getattr, kwargs are passed to the function
func: uniform
kwargs:
a: 10
b: 20
sample_on_serving: false
# The sample time for a new incoming order is only generated after a meal was served.
score_calc_gen_func: !!python/name:overcooked_simulator.order.simple_score_calc_gen_func ''
score_calc_gen_kwargs:
# the kwargs for the score_calc_gen_func
other: 0
scores:
Burger: 15
OnionSoup: 10
Salad: 5
TomatoSoup: 10
score_calc_gen_func: !!python/name:overcooked_simulator.order.simple_score_calc_gen_func ''
expired_penalty_func: !!python/name:overcooked_simulator.order.simple_expired_penalty ''
expired_penalty_kwargs:
default: -5
serving_not_ordered_meals: null
# a func that calcs a store for not ordered but served meals. Input: meal
order_gen_class: !!python/name:overcooked_simulator.order.RandomOrderGeneration ''
# the class to that receives the kwargs. Should be a child class of OrderGeneration in order.py
player_config:
radius: 0.4
......
......@@ -70,12 +70,23 @@ class Environment:
self.item_info_path: Path = item_info_path
self.item_info = self.load_item_info()
self.validate_item_info()
if self.environment_config["meals"]["all"]:
self.allowed_meal_names = set(
[
item
for item, info in self.item_info.items()
if info.type == ItemType.Meal
]
)
else:
self.allowed_meal_names = set(self.environment_config["meals"]["list"])
self.order_and_score = OrderAndScoreManager(
order_config=self.environment_config["orders"],
available_meals={
item: info
for item, info in self.item_info.items()
if info.type == ItemType.Meal
if info.type == ItemType.Meal and item in self.allowed_meal_names
},
)
plate_transitions = {
......@@ -103,11 +114,7 @@ class Environment:
"W": lambda pos: ServingWindow(
pos,
self.order_and_score,
meals={
item
for item, info in self.item_info.items()
if info.type == ItemType.Meal
},
meals=self.allowed_meal_names,
env_time_func=self.get_env_time,
),
"T": lambda pos: Dispenser(pos, self.item_info["Tomato"]),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment