Skip to main content

A variant of https://github.com/DavidRother/cooking_zoo used in LIPO

Project description

Multi-recipe Overcooked used in LIPO

A variant of https://github.com/DavidRother/cooking_zoo used in LIPO.

Installation

pip install gym-cooking-lipo

Examples

Environment creation

from gym_cooking.environment.game.game import Game
from gym_cooking.environment import cooking_zoo

n_agents = 2
max_steps = 100
render = False

level = "full_divider_salad_4"
seed = 1
record = False
max_num_timesteps = 1000
recipes = [
    "LettuceSalad",
    "TomatoSalad",
    "TomatoLettuceSalad",
    "TomatoCarrotSalad",
    "ChoppedCarrot",
    "ChoppedOnion",
]

env = parallel_env = cooking_zoo.parallel_env(
    level=level,
    num_agents=n_agents,
    record=record,
    max_steps=max_num_timesteps,
    recipes=recipes,
    obs_spaces=["dense"],
)
obs = env.reset()
print(obs)

Human-AI gameplay

from gym_cooking.environment.game.game import Game
from gym_cooking.environment import cooking_zoo

n_agents = 2
num_humans = 1
max_steps = 100
render = False

level = "full_divider_salad_4"  # 'open_room_salad_easy'
seed = 1
record = False
max_num_timesteps = 1000
recipes = [
    "LettuceSalad",
    "TomatoSalad",
    "ChoppedCarrot",
    "ChoppedOnion",
    "TomatoLettuceSalad",
    "TomatoCarrotSalad",
]

parallel_env = cooking_zoo.parallel_env(
    level=level,
    num_agents=n_agents,
    record=record,
    max_steps=max_num_timesteps,
    recipes=recipes,
    obs_spaces=["dense"],
    interact_reward=0.5,
    progress_reward=1.0,
    complete_reward=10.0,
    step_cost=0.05,
)

action_spaces = parallel_env.action_spaces


class CookingAgent:

    def __init__(self, action_space):
        self.action_space = action_space

    def get_action(self, observation) -> int:
        return self.action_space.sample()


player_2_action_space = action_spaces["player_1"]
cooking_agent = CookingAgent(player_2_action_space)
game = Game(parallel_env, num_humans, [cooking_agent], max_steps, render=False)
store = game.on_execute()

print("done")

Single-player gameplay

from gym_cooking.environment.game.game import Game
from gym_cooking.environment import cooking_zoo


n_agents = 1
num_humans = 1
max_steps = 100
render = False

level = "open_room_blender"
seed = 1
record = False
max_num_timesteps = 100
recipes = ["ChoppedCarrot", "LettuceSalad"]

parallel_env = cooking_zoo.parallel_env(
    level=level,
    num_agents=n_agents,
    record=record,
    max_steps=max_num_timesteps,
    recipes=recipes,
    obs_spaces=["dense"],
)

game = Game(parallel_env, num_humans, [], max_steps)
store = game.on_execute()

print("done")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gym_cooking_lipo-0.0.2.tar.gz (2.9 MB view details)

Uploaded Source

Built Distribution

gym_cooking_lipo-0.0.2-py3-none-any.whl (2.9 MB view details)

Uploaded Python 3

File details

Details for the file gym_cooking_lipo-0.0.2.tar.gz.

File metadata

  • Download URL: gym_cooking_lipo-0.0.2.tar.gz
  • Upload date:
  • Size: 2.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.8.19

File hashes

Hashes for gym_cooking_lipo-0.0.2.tar.gz
Algorithm Hash digest
SHA256 dba9cf342d2a165db5acc077d50f9897c224dd6846628605338dad0af9d7d2e8
MD5 7e11f49434ea158ac663050c42b52ecb
BLAKE2b-256 8858e02819d4914cc1d0323ff419201f6f74177a1261f5aae9729ad20748df6e

See more details on using hashes here.

File details

Details for the file gym_cooking_lipo-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for gym_cooking_lipo-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 bff8c20c56ba929f6f1904372649b63767ec83e6c11c51cc872224d1042ca112
MD5 1373f1d2b197bc07a80b917a137f6da2
BLAKE2b-256 27f61a4536ce9897c7a8e7b92c2d5651ac0f4e806032c7a837759ba4bbb5a85d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page