ptrefall / fluid-hierarchical-task-network Goto Github PK
View Code? Open in Web Editor NEWA simple HTN planner based around the principles of the Builder pattern.
License: MIT License
A simple HTN planner based around the principles of the Builder pattern.
License: MIT License
Describe the bug
Base on the Humphreys' article, MTR with a lower index should have higher priority.
To Reproduce
For example:
ctx.LastMTR: [0, 3, 0]
ctx.MethodTraversalRecord: [0, 0]
taskIndex = 1
Expected behavior
[0,0,1] should have a higher priority than [0,3,0].
Hello and many thanks for your work
By installing Callback hooks in the planner;
I try to get last state from any task (for debugging purposes)
But apparently (If i understood well) ITask.LastStatus is never updated internally by any class derived from ITask
Thanks
Is your feature request related to a problem? Please describe.
It's hard to visualize when it gets longer.
Describe the solution you'd like
a simple tool that converts the domain from the c# syntax to a graphical diagram.
Is your feature request related to a problem? Please describe.
In the file DomainTests
's function FindPlanIfMTRsAreEqualThenReturnNullPlan_ExpectedBehavior
, task6
is unused.
I'm not sure it will affect the test case or not.
Describe the solution you'd like
Contact author and update this test.
Describe alternatives you've considered
None.
Additional context
These test cases are surprising detailed, GJ.
hi,
I needed a C++ HTN and ran across your project while searching. Since I found the code easy to follow and you have a ton of Unit tests, I was able to convert it to C++.
It lives here https://github.com/accesshoops/fluid-hierarchical-task-network
I converted most of the Unit Tests to C++ as well and am trying to get the TextAdventure working in C++ too. That part is here https://github.com/accesshoops/fluid-text-adventure
My eventual goal is to have an UE4 example project, but that will probably take a while longer.
If you'd like to take a look at my fork and consider integrating it with this project, let me know. I totally understand if you don't want to deal with a whole another language :-) .
Edit: TextAdventure needs more work.
Describe the bug
Domain.FindPlan(...)
rejects valid new plan, because the MethodTraversalRecord
equals the LastMTR
, even though the found plan differs from the last found plan.
To Reproduce
Define a domain like this (where OperatorA
and OperatorB
are both operators that do NOT finish instantly):
.Select("Test Select")
.Action("Test Action A")
.Condition("Can choose A", ctx => ctx.HasState(TestWorldState.CanChooseA))
.SetOperator(new OperatorA())
.End()
.Action("Test Action B")
.Condition("Can not choose A", ctx => !ctx.HasState(TestWorldState.CanChooseA))
.SetOperator(new OperatorB())
.End()
.End()
Then set TestWorldState.CanChooseA
to true
and Tick()
the planer. Observe (as expected) that a plan containing only "Test Action A" is found.
Then (while the existing plan is not yet finished) set TestWorldState.CanChooseA
to false
and Tick()
the planer again. Observe that the plan containing only "Test Action B" is initially found during the decomposition but is then discarded by this part of the code:
// If this MTR equals the last MTR, then we need to double check whether we ended up
// just finding the exact same plan. During decomposition each compound task can't check
// for equality, only for less than, so this case needs to be treated after the fact.
var isMTRsEqual = ctx.MethodTraversalRecord.Count == ctx.LastMTR.Count;
if (isMTRsEqual)
{
for (var i = 0; i < ctx.MethodTraversalRecord.Count; i++)
if (ctx.MethodTraversalRecord[i] < ctx.LastMTR[i])
{
isMTRsEqual = false;
break;
}
if (isMTRsEqual)
{
plan = null;
status = DecompositionStatus.Rejected;
}
}
because both the MethodTraversalRecord
and the LastMTR
are equal and contain only the single entry 0
, even though the new plan (containing only "Test Action B") is different from the old plan (containing only "Test Action A").
Expected behavior
The new plan should not have been rejected for being equal to the old plan because it is clearly different.
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.