fairlight1337 / gdaplanner Goto Github PK
View Code? Open in Web Editor NEWGoal Directed Action Planner
License: BSD 2-Clause "Simplified" License
Goal Directed Action Planner
License: BSD 2-Clause "Simplified" License
When resolving the expression
(and
(member ?a (1 2 3))
(or (= ?a 1)
(= ?a 2)))
only the first solution is found: ?a = 1
. Evaluating only the member
part works great.
We need new predicates to access the world state object from within Prolog. This includes:
(assert <some-fact>)
(retract <some-fact>)
(holds <some-fact>)
Where assert
adds a new fact to the world, retract
removes it, and holds
checks whether the fact currently holds.
Also, we need predicates for accessing world categories: Init sequences for PDDL domain problem specifications, available action predicates, etc.
When loading the GDA Prolog Standard Library, subsequent files loaded from those files require the same relative path (relative to the binary of the program loading the library).
prolog_tool
loads the stdlib from ../data/lib/std/main.plg
. In main.plg
there needs to be this line to properly include math.plg
residing in the same directory:
(load "../data/lib/std/math.plg")
Ideally, it would only require this:
(load "math.plg")
This can be done by cutting the original file's relative path from its filename, and appending the now-to-load file to that path.
(once ...)
would cut off all solutions after the first one (if any). This is applicable for situations in which only a truth value is required, for example >=
:
(<- (>= ?a ?b)
(or (> ?a ?b)
(= ?a ?b)))
When resolving this, it yields two solutions if both, >
and =
are met, instead of only one expected. The final predicate would be used like this:
(<- (>= ?a ?b)
(once (or (> ?a ?b)
(= ?a ?b)))
The index
vector in the Solution
class has different meanings for different predicates (or facts), and will ultimately lead to problems when not consistently defined over all areas.
Mentioned here: #34
Try the following:
prolog->addPredicate("(apred ?x ?y)",
"(= ?x ?y)",
"(member ?x (0 2))");
prolog->addPredicate("(apred ?x ?y)",
"(= ?x ?y)",
"(member ?x (1 3))");
prolog->addPredicate("(apred ?x)",
"(apred ?x 2)");
solPrior = prolog->query("(apred ?x)", solPrior);
if(solPrior.valid())
std::cout << "BINDINGS " << solPrior.bindings().toString() << "\n";
}
Expected output: binding of ?x = 2. Produced output: no bindings (no valid solution found). This doesn't change if we switch the order of the predicate additions like this, however:
prolog->addPredicate("(apred ?x ?y)",
"(= ?x ?y)",
"(member ?x (1 3))");
prolog->addPredicate("(apred ?x ?y)",
"(= ?x ?y)",
"(member ?x (0 2))");
prolog->addPredicate("(apred ?x)",
"(apred ?x 2)");
so it's probably a recursion issue.
The next call (essentially, an unwrapping of the branch of apred that should work):
solPrior = prolog->query("(and (= ?x 2) (member ?x (0 2)))", solPrior);
if(solPrior.valid())
std::cout << "BINDINGS " << solPrior.bindings().toString() << "\n";
}
produces the expected binding of ?x = 2
Using the predicate
(<- (>= ?a ?b)
(or (> ?a ?b)
(= ?a ?b)))
The query (>= 2 1)
yields this solution:
---
* ?a = 2
* ?b = 1
?a
and ?b
shouldn't be in here.
Although present in the Action
class and parsed by the PDDL parser, the type information of variables is not yet used. As pointed out in #34, this leads to a tremendously large search space for planners.
Ergo: Typing needs to be implemented into the Prolog
class properly.
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.