ai-planning / macq Goto Github PK
View Code? Open in Web Editor NEWLibrary for action model acquisition from state trace data.
License: MIT License
Library for action model acquisition from state trace data.
License: MIT License
A baseline backward search using depth-first search
From a given goal state, g
Let g be a unique state in the set G, where G is the set of all states that fit the description of a goal state.
May need a new section.
Papers are:
Perhaps use the tabulate package to display traces in a nice way.
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!
If an agent could execute fewer actions than were observed, then they would have done so. This can be used to infer some of the preconditions of the actions in a trace -- i.e., there must be a reason for every action in the plan, and (effects)x(precond) analysis can bring this insight to bear.
State
class with PartialState
Takes in the number of traces and trace length, and just returns random traces by uniformly sampling the applicable actions.
See paper "Learning Search-Space Specific Heuristics Using Neural Network" for one idea of how to generate a goal state
Until everything passes, the PR will have a "missing resource" badge instead of the coverage badge.
Need to run coverage before other checks, but getting the percentage is tricky as the output changes depending on what tests fail. The current parsing can assume consistent output as the tests all must pass before the "get coverage" job runs, so the format is always that of passing tests.
The user should be able to specify a constant that indicates the maximum amount of time it takes to find a trace (i.e. if it takes more than 30 seconds, give a warning). Necessary because the complexity of some problems can result in trace generation to fall into infinite loops in some edge cases.
Currently, all the tests are in a single file that is getting excessively long. Going to split tests into separate files resembling the structure of the library.
Ie. tests for macq/trace/action.py
will be in tests/trace/action.py
Takes into account the goal and heuristic in order to find the target sample length. Other notes:
Code [here]
A baseline breadth-first search
Without a goal test
Variations may use a goal test
make_generator
is less ambiguous then Generator
for the other generatorsGenerate
take a model or add a function for generating from modelsGenerate
know what type of generator
it got?trace
should be indexable by step (not fluent)traces[0][step]
== trace[step]
trace.get_action(action)
- returns a list of dictionaries: each time the action was taken in the trace and its effects and/or state prior to action (could split in 2)trace.get_cost(step=None)
- cost up to step (default: whole trace)trace.steps
- number of stepstrace.num_fluents
- number of fluentstrace.fluents
- list of fluents (just the list of all fluents used in this particular trace; no true/false)trace.actions
- similarly, list of actions taken in this tracetrace.unused_actions()
- returns a list of actions not used in this tracetrace.get_usage(action)
- percentage of total actions the action appears intrace.test_preconditions(action, [(fluent, true/false), ... ])
- return num/percentage action was taken with those conditions in the tracetraces
class TraceList
to avoid ambiguity with Trace
traces.generate_more(num)
- preserves current traces, converts list back to min heap if the list is large enoughtraces.unused_actions()
- unused actionstraces.get_usage(action)
- percentage of traces the action appears intraces.test_preconditions(action, [(fluent, true/false), ... ])
- return num/percentage action was taken with those conditions across all tracesmodel.fluents
model.initial_state
model.goal
model.serialize()
model.unserialize()
model.solve_from(state, steps=None, traces=1)
- generate trace(s) from a stateA baseline depth-first search
Without a goal test
A variation may include a goal test and cycle checking
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.