Coder Social home page Coder Social logo

ptrefall / fluid-hierarchical-task-network Goto Github PK

View Code? Open in Web Editor NEW
310.0 17.0 42.0 314 KB

A simple HTN planner based around the principles of the Builder pattern.

License: MIT License

C# 100.00%
aiplanning htn hierarchial-task-network ai ai-planning ai-planners csharp

fluid-hierarchical-task-network's People

Contributors

hcorion avatar mduvergey avatar ptrefall avatar thesniperfan avatar totallygatsby avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fluid-hierarchical-task-network's Issues

C++ version

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.

it seems that ITask.LastStatus is never upated internally

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

Domain.FindPlan(...) rejects valid new plan

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.