src/simulator.cpp
//TODO: Add prior values from knowledge representation, heuristics, etc.
//This is where a KR would go, initializing prior state values when the nodes are first expanded.
//If using something like a NN, getPriorValues(NN, state, count, value) --> qnode.Value.Set(count, value)
Add prior values from knowledge representation, heuristics, etc.
This is where a KR would go, initializing prior state values when the nodes are first expanded.
If using something like a NN, getPriorValues(NN, state, count, value) --> qnode.Value.Set(count, value)
Add prior values from knowledge representation heuristics etc . This is where a KR would go initializing prior state values when the nodes are first expanded . If using something like a NN getPriorValues ( NN state count value ) -- > qnode . Value . Set ( count value )
void SIMULATOR::Prior(const STATE* state, const HISTORY& history,
    VNODE* vnode, const STATUS& status) const
{
    static vector<int> actions;
    if (Knowledge.TreeLevel == KNOWLEDGE::PURE || state == 0)
    {
        vnode->SetChildren(0, 0);
        return;
    }
    else
    {
        vnode->SetChildren(+LargeInteger, -Infinity);
    }
    if (Knowledge.TreeLevel >= KNOWLEDGE::LEGAL)
    {
        actions.clear();
        GenerateLegal(*state, history, actions, status);
        for (vector<int>::const_iterator i_action = actions.begin(); i_action != actions.end(); ++i_action)
        {
            int a = *i_action;
            QNODE& qnode = vnode->Child(a);
            qnode.Value.Set(0, 0);
            qnode.AMAF.Set(0, 0);
        }
    }
	 if (Knowledge.TreeLevel >= KNOWLEDGE::PGS)
    {
        actions.clear();
        GenerateLegal(*state, history, actions, status);  
        for (vector<int>::const_iterator i_action = actions.begin(); i_action != actions.end(); ++i_action)
        {
            int a = *i_action;
            QNODE& qnode = vnode->Child(a);
            qnode.Value.Set(0, 0);
            qnode.AMAF.Set(0, 0);
        }
    }
	 else if (Knowledge.TreeLevel >= KNOWLEDGE::SMART)
    {
        actions.clear();
        GeneratePreferred(*state, history, actions, status);
        for (vector<int>::const_iterator i_action = actions.begin(); i_action != actions.end(); ++i_action)
        {
            int a = *i_action;
            QNODE& qnode = vnode->Child(a);
            qnode.Value.Set(Knowledge.SmartTreeCount, Knowledge.SmartTreeValue);
            qnode.AMAF.Set(Knowledge.SmartTreeCount, Knowledge.SmartTreeValue);
        }    
    }
}
void SIMULATOR :: Prior ( const STATE * state , const HISTORY & history , VNODE * vnode , const STATUS & status ) const { static vector < int > actions ; if ( Knowledge . TreeLevel == KNOWLEDGE :: PURE || state == 0 ) { vnode -> SetChildren ( 0 , 0 ) ; return ; } else { vnode -> SetChildren ( + LargeInteger , - Infinity ) ; } if ( Knowledge . TreeLevel >= KNOWLEDGE :: LEGAL ) { actions . clear ( ) ; GenerateLegal ( * state , history , actions , status ) ; for ( vector < int > :: const_iterator i_action = actions . begin ( ) ; i_action != actions . end ( ) ; ++ i_action ) { int a = * i_action ; QNODE & qnode = vnode -> Child ( a ) ; qnode . Value . Set ( 0 , 0 ) ; qnode . AMAF . Set ( 0 , 0 ) ; } } if ( Knowledge . TreeLevel >= KNOWLEDGE :: PGS ) { actions . clear ( ) ; GenerateLegal ( * state , history , actions , status ) ; for ( vector < int > :: const_iterator i_action = actions . begin ( ) ; i_action != actions . end ( ) ; ++ i_action ) { int a = * i_action ; QNODE & qnode = vnode -> Child ( a ) ; qnode . Value . Set ( 0 , 0 ) ; qnode . AMAF . Set ( 0 , 0 ) ; } } else if ( Knowledge . TreeLevel >= KNOWLEDGE :: SMART ) { actions . clear ( ) ; GeneratePreferred ( * state , history , actions , status ) ; for ( vector < int > :: const_iterator i_action = actions . begin ( ) ; i_action != actions . end ( ) ; ++ i_action ) { int a = * i_action ; QNODE & qnode = vnode -> Child ( a ) ; qnode . Value . Set ( Knowledge . SmartTreeCount , Knowledge . SmartTreeValue ) ; qnode . AMAF . Set ( Knowledge . SmartTreeCount , Knowledge . SmartTreeValue ) ; } } }
TODO: Add prior values from knowledge representation, heuristics, etc.
TODO : Add prior values from knowledge representation heuristics etc .
//TODO: review and possibly improve node initialization.  Eg. initial values.  Also, must ALL actions be pre-added? //TODO: should this use generatePGS instead? maybe...