Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Cooperative Cuisine Environment
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Social Cognitive Systems
CoCoSy
Cooperative Cuisine Environment
Commits
968826dd
Commit
968826dd
authored
1 year ago
by
Fabian Heinrich
Browse files
Options
Downloads
Patches
Plain Diff
Fix tests with empty layout, recipes cant be checked
parent
51a575be
No related branches found
No related tags found
1 merge request
!89
Resolve "simple pathfinding"
Pipeline
#49048
passed
1 year ago
Stage: test
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
cooperative_cuisine/configs/environment_config_no_validation.yaml
+208
-0
208 additions, 0 deletions
...ive_cuisine/configs/environment_config_no_validation.yaml
tests/test_start.py
+27
-6
27 additions, 6 deletions
tests/test_start.py
tests/test_utils.py
+4
-3
4 additions, 3 deletions
tests/test_utils.py
with
239 additions
and
9 deletions
cooperative_cuisine/configs/environment_config_no_validation.yaml
0 → 100644
+
208
−
0
View file @
968826dd
plates
:
clean_plates
:
2
dirty_plates
:
1
plate_delay
:
[
5
,
10
]
# range of seconds until the dirty plate arrives.
game
:
time_limit_seconds
:
300
undo_dispenser_pickup
:
true
validate_recipes
:
false
layout_chars
:
_
:
Free
hash
:
Counter
# #
A
:
Agent
pipe
:
Extinguisher
P
:
PlateDispenser
C
:
CuttingBoard
X
:
Trashcan
$
:
ServingWindow
S
:
Sink
+
:
SinkAddon
at
:
Plate
# @ just a clean plate on a counter
U
:
Pot
# with Stove
Q
:
Pan
# with Stove
O
:
Peel
# with Oven
F
:
Basket
# with DeepFryer
T
:
Tomato
N
:
Onion
# oNioN
L
:
Lettuce
K
:
Potato
# Kartoffel
I
:
Fish
# fIIIsh
D
:
Dough
E
:
Cheese
# chEEEse
G
:
Sausage
# sausaGe
B
:
Bun
M
:
Meat
question
:
Counter
# ? mushroom
↓
:
Counter
^
:
Counter
right
:
Counter
left
:
Counter
wave
:
Free
# ~ Water
minus
:
Free
# - Ice
dquote
:
Counter
# " wall/truck
p
:
Counter
# second plate return ??
orders
:
meals
:
all
:
true
# if all: false -> only orders for these meals are generated
# TODO: what if this list is empty?
list
:
# - TomatoSoup
# - OnionSoup
# - Salad
-
FriedFish
order_gen_class
:
!!python/name:cooperative_cuisine.orders.RandomOrderGeneration
'
'
# the class to that receives the kwargs. Should be a child class of OrderGeneration in orders.py
order_gen_kwargs
:
order_duration_random_func
:
# 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
:
2
# number of orders generated at the start of the environment
sample_on_dur_random_func
:
# 'random' library call with getattr, kwargs are passed to the function
func
:
uniform
kwargs
:
a
:
10
b
:
20
sample_on_serving
:
false
# Sample the delay for the next order only after a meal was served.
serving_not_ordered_meals
:
true
# can meals that are not ordered be served / dropped on the serving window
player_config
:
radius
:
0.4
speed_units_per_seconds
:
6
interaction_range
:
1.6
restricted_view
:
False
view_angle
:
70
view_range
:
4
# in grid units, can be "null"
effect_manager
:
FireManager
:
class
:
!!python/name:cooperative_cuisine.effects.FireEffectManager
'
'
kwargs
:
spreading_duration
:
[
5
,
10
]
fire_burns_ingredients_and_meals
:
true
hook_callbacks
:
# # --------------- Scoring ---------------
orders
:
hooks
:
[
completed_order
]
callback_class
:
!!python/name:cooperative_cuisine.scores.ScoreViaHooks
'
'
callback_class_kwargs
:
static_score
:
20
score_on_specific_kwarg
:
meal_name
score_map
:
Burger
:
15
OnionSoup
:
10
Salad
:
5
TomatoSoup
:
10
not_ordered_meals
:
hooks
:
[
serve_not_ordered_meal
]
callback_class
:
!!python/name:cooperative_cuisine.scores.ScoreViaHooks
'
'
callback_class_kwargs
:
static_score
:
2
trashcan_usages
:
hooks
:
[
trashcan_usage
]
callback_class
:
!!python/name:cooperative_cuisine.scores.ScoreViaHooks
'
'
callback_class_kwargs
:
static_score
:
-5
expired_orders
:
hooks
:
[
order_expired
]
callback_class
:
!!python/name:cooperative_cuisine.scores.ScoreViaHooks
'
'
callback_class_kwargs
:
static_score
:
-10
# --------------- Recording ---------------
# json_states:
# hooks: [ json_state ]
# callback_class: !!python/name:cooperative_cuisine.recording.FileRecorder ''
# callback_class_kwargs:
# record_path: USER_LOG_DIR/ENV_NAME/json_states.jsonl
actions
:
hooks
:
[
pre_perform_action
]
callback_class
:
!!python/name:cooperative_cuisine.recording.FileRecorder
'
'
callback_class_kwargs
:
record_path
:
USER_LOG_DIR/ENV_NAME/LOG_RECORD_NAME.jsonl
random_env_events
:
hooks
:
[
order_duration_sample
,
plate_out_of_kitchen_time
]
callback_class
:
!!python/name:cooperative_cuisine.recording.FileRecorder
'
'
callback_class_kwargs
:
record_path
:
USER_LOG_DIR/ENV_NAME/LOG_RECORD_NAME.jsonl
add_hook_ref
:
true
env_configs
:
hooks
:
[
env_initialized
,
item_info_config
]
callback_class
:
!!python/name:cooperative_cuisine.recording.FileRecorder
'
'
callback_class_kwargs
:
record_path
:
USER_LOG_DIR/ENV_NAME/LOG_RECORD_NAME.jsonl
add_hook_ref
:
true
# Game event recording
game_events
:
hooks
:
-
post_counter_pick_up
-
post_counter_drop_off
-
post_dispenser_pick_up
-
cutting_board_100
-
player_start_interaction
-
player_end_interact
-
post_serving
-
no_serving
-
dirty_plate_arrives
-
trashcan_usage
-
plate_cleaned
-
added_plate_to_sink
-
drop_on_sink_addon
-
pick_up_from_sink_addon
-
serve_not_ordered_meal
-
serve_without_plate
-
completed_order
-
new_orders
-
order_expired
-
action_on_not_reachable_counter
-
new_fire
-
fire_spreading
-
drop_off_on_cooking_equipment
-
players_collide
-
post_plate_dispenser_pick_up
-
post_plate_dispenser_drop_off
-
on_item_transition
-
progress_started
-
progress_finished
-
content_ready
-
dispenser_item_returned
callback_class
:
!!python/name:cooperative_cuisine.recording.FileRecorder
'
'
callback_class_kwargs
:
record_path
:
USER_LOG_DIR/ENV_NAME/LOG_RECORD_NAME.jsonl
add_hook_ref
:
true
# info_msg:
# func: !!python/name:cooperative_cuisine.hooks.hooks_via_callback_class ''
# kwargs:
# hooks: [ cutting_board_100 ]
# callback_class: !!python/name:cooperative_cuisine.info_msg.InfoMsgManager ''
# callback_class_kwargs:
# msg: Glückwunsch du hast was geschnitten!
# fire_msg:
# func: !!python/name:cooperative_cuisine.hooks.hooks_via_callback_class ''
# kwargs:
# hooks: [ new_fire ]
# callback_class: !!python/name:cooperative_cuisine.info_msg.InfoMsgManager ''
# callback_class_kwargs:
# msg: Feuer, Feuer, Feuer
# level: Warning
This diff is collapsed.
Click to expand it.
tests/test_start.py
+
27
−
6
View file @
968826dd
...
@@ -43,6 +43,9 @@ from cooperative_cuisine.utils import create_init_env_time, get_touching_counter
...
@@ -43,6 +43,9 @@ from cooperative_cuisine.utils import create_init_env_time, get_touching_counter
layouts_folder
=
ROOT_DIR
/
"
configs
"
/
"
layouts
"
layouts_folder
=
ROOT_DIR
/
"
configs
"
/
"
layouts
"
environment_config_path
=
ROOT_DIR
/
"
configs
"
/
"
environment_config.yaml
"
environment_config_path
=
ROOT_DIR
/
"
configs
"
/
"
environment_config.yaml
"
environment_config_no_validation_path
=
(
ROOT_DIR
/
"
configs
"
/
"
environment_config_no_validation.yaml
"
)
layout_path
=
ROOT_DIR
/
"
configs
"
/
"
layouts
"
/
"
basic.layout
"
layout_path
=
ROOT_DIR
/
"
configs
"
/
"
layouts
"
/
"
basic.layout
"
layout_empty_path
=
ROOT_DIR
/
"
configs
"
/
"
layouts
"
/
"
empty.layout
"
layout_empty_path
=
ROOT_DIR
/
"
configs
"
/
"
layouts
"
/
"
empty.layout
"
item_info_path
=
ROOT_DIR
/
"
configs
"
/
"
item_info.yaml
"
item_info_path
=
ROOT_DIR
/
"
configs
"
/
"
item_info.yaml
"
...
@@ -54,6 +57,9 @@ item_info_path = ROOT_DIR / "configs" / "item_info.yaml"
...
@@ -54,6 +57,9 @@ item_info_path = ROOT_DIR / "configs" / "item_info.yaml"
def
test_file_availability
():
def
test_file_availability
():
assert
layouts_folder
.
is_dir
(),
"
layouts folder does not exists
"
assert
layouts_folder
.
is_dir
(),
"
layouts folder does not exists
"
assert
environment_config_path
.
is_file
(),
"
environment config file does not exists
"
assert
environment_config_path
.
is_file
(),
"
environment config file does not exists
"
assert
(
environment_config_no_validation_path
.
is_file
()
),
"
environment config file does not exists
"
assert
layout_path
.
is_file
(),
"
layout config file does not exists
"
assert
layout_path
.
is_file
(),
"
layout config file does not exists
"
assert
layout_empty_path
.
is_file
(),
"
layout empty config file does not exists
"
assert
layout_empty_path
.
is_file
(),
"
layout empty config file does not exists
"
assert
item_info_path
.
is_file
(),
"
item info config file does not exists
"
assert
item_info_path
.
is_file
(),
"
item info config file does not exists
"
...
@@ -67,6 +73,13 @@ def env_config():
...
@@ -67,6 +73,13 @@ def env_config():
return
env_config
return
env_config
@pytest.fixture
def
env_config_no_validation
():
with
open
(
environment_config_no_validation_path
,
"
r
"
)
as
file
:
env_config
=
file
.
read
()
return
env_config
@pytest.fixture
@pytest.fixture
def
layout_config
():
def
layout_config
():
with
open
(
layout_path
,
"
r
"
)
as
file
:
with
open
(
layout_path
,
"
r
"
)
as
file
:
...
@@ -101,8 +114,10 @@ def test_player_registration(env_config, layout_config, item_info):
...
@@ -101,8 +114,10 @@ def test_player_registration(env_config, layout_config, item_info):
env
.
add_player
(
"
2
"
)
env
.
add_player
(
"
2
"
)
def
test_movement
(
env_config
,
layout_empty_config
,
item_info
):
def
test_movement
(
env_config_no_validation
,
layout_empty_config
,
item_info
):
env
=
Environment
(
env_config
,
layout_empty_config
,
item_info
,
as_files
=
False
)
env
=
Environment
(
env_config_no_validation
,
layout_empty_config
,
item_info
,
as_files
=
False
)
player_name
=
"
1
"
player_name
=
"
1
"
start_pos
=
np
.
array
([
3
,
4
])
start_pos
=
np
.
array
([
3
,
4
])
env
.
add_player
(
player_name
,
start_pos
)
env
.
add_player
(
player_name
,
start_pos
)
...
@@ -122,8 +137,12 @@ def test_movement(env_config, layout_empty_config, item_info):
...
@@ -122,8 +137,12 @@ def test_movement(env_config, layout_empty_config, item_info):
),
"
Performed movement do not move the player as expected.
"
),
"
Performed movement do not move the player as expected.
"
def
test_player_movement_speed
(
env_config
,
layout_empty_config
,
item_info
):
def
test_player_movement_speed
(
env
=
Environment
(
env_config
,
layout_empty_config
,
item_info
,
as_files
=
False
)
env_config_no_validation
,
layout_empty_config
,
item_info
):
env
=
Environment
(
env_config_no_validation
,
layout_empty_config
,
item_info
,
as_files
=
False
)
player_name
=
"
1
"
player_name
=
"
1
"
start_pos
=
np
.
array
([
3
,
4
])
start_pos
=
np
.
array
([
3
,
4
])
env
.
add_player
(
player_name
,
start_pos
)
env
.
add_player
(
player_name
,
start_pos
)
...
@@ -148,8 +167,10 @@ def test_player_movement_speed(env_config, layout_empty_config, item_info):
...
@@ -148,8 +167,10 @@ def test_player_movement_speed(env_config, layout_empty_config, item_info):
),
"
json state does not match expected StateRepresentation.
"
),
"
json state does not match expected StateRepresentation.
"
def
test_player_reach
(
env_config
,
layout_empty_config
,
item_info
):
def
test_player_reach
(
env_config_no_validation
,
layout_empty_config
,
item_info
):
env
=
Environment
(
env_config
,
layout_empty_config
,
item_info
,
as_files
=
False
)
env
=
Environment
(
env_config_no_validation
,
layout_empty_config
,
item_info
,
as_files
=
False
)
counter_pos
=
np
.
array
([
2
,
2
])
counter_pos
=
np
.
array
([
2
,
2
])
counter
=
Counter
(
pos
=
counter_pos
,
hook
=
Hooks
(
env
))
counter
=
Counter
(
pos
=
counter_pos
,
hook
=
Hooks
(
env
))
...
...
This diff is collapsed.
Click to expand it.
tests/test_utils.py
+
4
−
3
View file @
968826dd
...
@@ -19,7 +19,8 @@ from cooperative_cuisine.utils import (
...
@@ -19,7 +19,8 @@ from cooperative_cuisine.utils import (
create_layout_with_counters
,
create_layout_with_counters
,
setup_logging
,
setup_logging
,
)
)
from
tests.test_start
import
env_config
,
layout_empty_config
,
item_info
from
tests.test_start
import
env_config_no_validation
from
tests.test_start
import
layout_empty_config
,
item_info
def
test_parser_gen
():
def
test_parser_gen
():
...
@@ -57,8 +58,8 @@ def test_setup_logging():
...
@@ -57,8 +58,8 @@ def test_setup_logging():
setup_logging
()
setup_logging
()
def
test_movement_graph
(
env_config
,
layout_empty_config
,
item_info
):
def
test_movement_graph
(
env_config
_no_validation
,
layout_empty_config
,
item_info
):
env
=
Environment
(
env_config
,
layout_empty_config
,
item_info
,
as_files
=
False
)
env
=
Environment
(
env_config
_no_validation
,
layout_empty_config
,
item_info
,
as_files
=
False
)
player_name
=
"
0
"
player_name
=
"
0
"
env
.
add_player
(
player_name
)
env
.
add_player
(
player_name
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment