-
Notifications
You must be signed in to change notification settings - Fork 7
How to add a new domain
Please note these instructions will likely become outdated when issue #3 is addressed.
When adding a domain into MIDCA, we need to make changes in multiple places. Briefly, we need to change MIDCA's simulator (under the worldsim/ folder), we need to change the methods and operators that the planner will use (under modules/_plan/ folder), and we also need to change the translation function which converts MIDCA states to planner usable states (this is found in modules/planning.py)
- Changing MIDCA's simulator
-
worldsim/domains/ contains the logic for MIDCA states (types, predicates, and operators) that MIDCA's simulator will use (see worldsim/domains/blocksworld.sim) for an example
-
worldsim/states/ contain the starting states for MIDCA.
-
In the MIDCA startup script, you specify both the domain and state files that MIDCA will use (see examples/cogsci_demo.py and look for where domainFile and stateFile are used). If you are adding new domain and state files, you need to change these values in your MIDCA startup script.
- Changing the planner operators and methods (the following assumes you are using PyHOP)
- The planning methods and operators used by PyHOP are located under modules/_plan/ and generally you have a file for the methods and a separate file for the operators (i.e. methods_mortar.py and operators_mortar.py)
-
Finally, you need a translation function from MIDCA states into PyHop states. Looking at the current examples is the easiest way to see how this is done. Basically MIDCA's state consists of multiple facts like
BLOCK(A_) BLOCK(B_) on(A_,B_) clear(A_)
and the PyHop state's use state variable representation, so the same state is
state.pos = {A_:B_} state.clear = {A_:True, B_:False}
where state is a pyhop.State() object. You will likely be able to copy the code found in the pyhop_state_from_world() and pyhop_tasks_from_goals() and modify it to suit your needs.
Go to MIDCA Home page