-
Notifications
You must be signed in to change notification settings - Fork 6
How to add a new domain
To add a new domain into MIDCA, most of the domain-specific material will be located in the domains/ folder. Here you add a sub-folder with the name of your domain. Domain folders are structured as follows:
- MIDCA/
- domains/
-
your-new-domain/
- init.py
- domains/
- states/
- plan/
- util.py
-
your-new-domain/
- domains/
your-new-domain/domains/ contains the .sim files that contain the logic for states (types, predicates, and operators) that MIDCA's simulator will use (see domains/blocksworld/domains/arsonist.sim
) for an example. MIDCA only ever uses one of these .sim files, but often users want to have variations of the domain, and therefore there are multiple .sim files.
your-new-domain/states/ contains the starting states for MIDCA. See (domains/blocksworld/states/defstate_fire.sim
) for an example.
your-new-domain/plan/ is optional, it contains any material the planner will make use of (e.g. htn methods and operators).
your-new-domain/util.py is a file that contains any domain specific utility functions. For example, the blocksworld domain uses an HTN planner PyHOP (the planner can be found in modules/planning.py
). The PyHOP Planner uses its own state representation which requires translation to and from MIDCA states (the state specified in _your-new-domain_/domains/
.sim file). For blocksworld this translation happens in util.py, specifically the functions pyhop_state_from_world()
and pyhop_tasks_from_goals()
. Many other useful utility functions are located here, including how to draw an ascii representation of the world state in a terminal (optional, but useful).
Adding a new domain into MIDCA requires various domain knowledge, and this is all organized into the structure shown above. Mostly, this is to make it convenient to locate anything specific to a domain. When writing startup script of MIDCA, the domain location needs to be given (see examples/cogsci_demo.py
for an example).
This is summarized in the following steps:
-
add a new folder under MIDCA/domains/ (i.e. MIDCA/domains/my_new_domain/)
-
put an init.py file so it's recognized as a module (you can run 'touch init.py')
-
add sub folders for domain and state files (i.e. MIDCA/domains/my_new_domain/domain and MIDCA/domains/my_new_domain/state). The reason for having separate folders for these is that you may decided to have slight variations on a single domain. For example, in blocksworld we have variations that involve mortar and variations that involve fire extinquishers. You may also want to have various starting states for each domain, which will be stored in the sub folder state.
-
add a util.py file that implements necessary functions
-
Customize your script to run the domain by changing the following variables and choosing which modules you want to use
-
(IMPORTANT) modify MIDCA/setup.py to include the new domain folder
Go to MIDCA Home page