Git Product home page Git Product logo

Comments (3)

Necr0x0Der avatar Necr0x0Der commented on August 14, 2024 1

Also, tree search is not always good for solving problems with states. A* algorithm should do better. Not sure if the support for it should be built into the interpreter, inference engine, or a core library, though.
But in any case, this example (possibly with some refactoring) can be good for a tutorial demonstrating some pitfalls in using vanilla non-determinism.

from metta-examples.

DaddyWesker avatar DaddyWesker commented on August 14, 2024

Does this mean that it will never be selected because subsequent recursion calls will use the options preceding the third one

As i understand non-determinism in Metta, it will be used of course. Moreover, all three variants will be used and will produce several variants of consequent moves. And in the end you should receive several ending states also.

Also it is possible that metta just evaluating too long and it will end with some results when you calls _canget and not caught in endless recursion. Unfortunately, it is unclear what exactly going on since there are no step-by-step debug option in Metta. You can try to just print what is going on with println! Possible way to print and move deeper to recursion calls is something like that (from my SICP examples):

(= (car $x)
    (car-atom $x))

(= (cdr $x)
    (cdr-atom $x))

(= (for-each $proc $list)
    (if (== $list ())
        ()
        (let*
        (
            (() ($proc (car $list)))
            (() (for-each $proc (cdr $list)))
        )
        ())))

!(for-each println! (57 321 88))

Though you probably know this already.

from metta-examples.

Necr0x0Der avatar Necr0x0Der commented on August 14, 2024

@mvpeterson , yes, your program will try to enumerate all possible ways of achieving the goal. It will not terminate, when the first solution is found. There will always be a branch of non-deterministic evaluation with the monkey just walking back and forth. At the moment, we don't have a way to turn non-determinism into a controllable search. Although we have plans to do exactly this in the future. As for now, you can introduce a counter, e.g.

(= (_canget (state $x $y $z $h) $count)
   (if (== $count 0)
       (empty)
       (if (== $h has)
           True
           (_canget (_move (state $x $y $z $h) $m $state2) (- $count 1)))))
!(_canget (state at_door on_floor at_window hasnot) 5)

There is an additional problem that if there is no move from some state, _move will not be reduced. There are different ways of making this search to work somehow via basic non-determinism, but I'd say that it is a good example for further work of turning non-determinism into an inference/search engine.

from metta-examples.

Related Issues (11)

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.