AI-Planning / macq

Library for action model acquisition from state trace data.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Update Usage/README to Reflect Implementation

beckydvn opened this issue · comments

blocks_gen = generate.pddl.Generator(problem_id = 123)
Generator does not yet take a problem id, but instead takes the (string) file names of the domain and problem respectively.

# further configuration blocks_gen.configure( { 'length': 20, # 20 steps long 'use_goal': True, 'diversity': True, 'method': generate.pddl.modes.MC } )
Generator does not have this configuration method, as these attributes are specified within the child classes themselves. For example, the length of the traces can be specified in VanillaSampling. (Generator is just a base class that handles the parsing/grounding of a problem given the domain and problem pddl files; all other attributes would be specific to other methods of generation).

# generate 100 traces traces = generate.Generate(generator=blocks_gen, traces=100)
You would have to call generate.pddl.VanillaSampling here (the only generator fleshed out so far). VanillaSampling doesn't take the generator as a parameter because it is its child class anyways. As it stands, you just specify the paths to the domain and problem files, then the plan length and number of traces.

The rest should be ok!

Can you copy the lines in particular from the usage that need support into this issue description?

Ok, we should be set.

  1. Feel free to add [this file] (rename to be .py) to whatever branch makes sense. Should sit in the PDDL generator folder.
  2. Use it to fetch the PDDL files given a problem # (example below) on the PDDL generation
  3. Forget about the other two commented lines you included -- just rewrite them to whatever works with the latest you've been working on.
>>> from planning_domains_api import get_problem
>>> get_problem(123)['problem_url']
'http://www.haz.ca/planning-domains/classical/sokoban-sat11-strips/p16.pddl'
>>> get_problem(123)['domain_url']
'http://www.haz.ca/planning-domains/classical/sokoban-sat11-strips/domain.pddl'
>>>

When the files are fetched should they be saved/have their data copied onto some local file? I managed to read the text from the URLs into a string, but it appears that tarski only parses files and not raw strings. (Or is there some way to access the online file and parse it without copying/downloading it...?)

I think @camcunningham might have a solution to that -- load-from-string, Cam?

That change has been made and is currently on the devel branch. Located in fstrips.py (in the IO part of tarski)

Called with parse_domain_string(domain) and parse_instance_string(problem)

Functionally, they are identical, just taking string pddl instead of file names.