This topic contains 4 replies, has 3 voices, and was last updated by  CodersExpo 6 months, 3 weeks ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #10165

    CodersExpo
    Participant

    Also, Prime if you or someone can enlighten me a little on how exactly nested memory works I would appreciate it.
    The way I’m understanding this is you can save your current memory variables in another instance of BasicMemory like this:

    //Get the current working memory instance
    var aiMemory = _maxAI.AI.WorkingMemory;

    //Create a new instance of BasicMemory and pass our current memory in the constructor. This will save to the nested memory
    var aiPastMemory = new RAIN.Memory.BasicMemory(aiMemory);

    //Update the nested memory using commit as new variables are added to our current memory
    aiPastMemory.Commit();

    However, we are not actually using this. It’s no more than storage at this point. That doesn’t seem right to me. I could just as well do aiMemory.Save() to place a byte[] into memory and then aiMemory.Clear() to remove all current variables. Set some new ones, then clear and then aiMemory.Load() to get the byte[] I saved and start using again.

    How is nested memory used?

    #10262

    Sigil
    Keymaster

    We currently don’t use nested memory in the RAIN code base, but the purpose of it is to allow for trying out values. It essentially allows you to save state, change anything you like, and then Commit() if you like the outcome (or discard if you don’t).

    In particular, I think it was used for goal oriented behavior (it was awhile ago). It allowed us to set some variables in memory, run some equations, check the results, and then discard the memory (keeping the AI in its current state).

    #10273

    CodersExpo
    Participant

    Hey thanks Sigil! Ok just so I understand, nested memory is more of a development tool and not something that would necessarily be used in a final project. Additionally, nested memory is not anything that is currently being utilized in RAIN code base.

    Would you suggest then to use aiMemory.Save() and aiMemory.Load() to essentially do the same thing, while still providing a benefit to production ready products? I can see that as a means to switch out variable settings for testing and for production. Just want to make sure so I can update the wiki with the proper information/usage of the RAIN features.

    #10484

    prime
    Keymaster

    Nested memory is absolutely something that would be used in an AI at runtime.

    The purpose of nested memory is to create a temporary wrapper around main memory. This lets you override values during computation, without losing the original values. As @sigil said, we used to use it with Goal Oriented Behavior. Goal Oriented Behavior would compute a utility value associated with the effects of performing an action, and associated with each goal. The computations and results used Nested Memory to do it. Nested memory “lifts” values that have not been overwritten, so from the using code’s perspective, all data in memory is available. However, Nested Memory protects the original values when new values are assigned. At that point, requests to memory hide the original values and only return the new ones (for overwritten values).

    We aren’t using NestedMemory in any of RAIN’s current runtime code, but we do use it on misc. projects in conjunction with RAIN.

    #10511

    CodersExpo
    Participant

    Thank you both for your comments. You know this is actually a very interesting topic. I could spend a lot more time on discussing this. This sounds like an approach that would allow for goal oriented type behavior. A way for your AI to analyze several possibilities and ‘commit’ to the one that serves it’s purpose or goal best. I have much to do with the wiki that is probably more important right now, but I want to circle back on this topic again at some point. Thanks you guys.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.