Beispiel #1
0
        public Sloth()
        {
            reward        = new List <State>();
            punish        = new List <State>();
            states        = new List <State>();
            possibleTrans = new List <Transition>();
            inputs        = new Dictionary <string, float>();
            outputs       = new Dictionary <string, float>();
            output        = new ConsoleOutput();
            dist          = new DistrubutionV2();

            //convert the enum and put it into the inputs/states data
            foreach (int i in Enum.GetValues(typeof(DirectionalBox)))
            {
                string name = Enum.GetName(typeof(DirectionalBox), i);
                inputs.Add(name, 0);
                states.Add(new State(i, output));
                possibleTrans.Add(new Transition(states[0], states[i], name, output, dist));
            }
            reward.Add(states[states.Count - 1]);//last is food

            foreach (Transition t in possibleTrans)
            {
                t.Confidence = 100;
                states[0].AddTransition(t.Name, t);
            }

            foreach (Movement values in Enum.GetValues(typeof(Movement)))
            {
                outputs.Add(values.ToString(), 0);
            }

            model = new Model(states, reward, punish, states[0], inputs, outputs, output, dist);
        }
Beispiel #2
0
 public Transition(State start, State end, string symbol, AbstractOutput output, AbstractDistribution distribution)
 {
     StartTransition = start;
     EndTransition   = end;
     Expectations    = new Dictionary <Transition, float>();
     Name            = symbol;
     Distribution    = distribution;
     IsTemporary     = false;
     Confidence      = .1f;
 }
Beispiel #3
0
 public Model(AbstractOutput output)
 {
     Q              = new List <State>();
     R              = new List <State>();
     P              = new List <State>();
     q0             = new State(0, output);
     OSymbol        = new List <string>();
     ISymbol        = new List <string>();
     I              = new Dictionary <string, float>();
     Il             = new Dictionary <string, float>();
     SymbolStrength = new Dictionary <string, float>();
     HistoryData    = new Dictionary <string, Transition>();
     Distribution   = new DistrubutionV2();
     Initalize();
 }
Beispiel #4
0
 //used to initalize predefine setting and be able to track it outside of this model...
 public Model(List <State> Q, List <State> Reward, List <State> Punish, State Inital, Dictionary <string, float> I, Dictionary <string, float> Il, AbstractOutput output, AbstractDistribution dist)
 {
     this.Q            = Q;
     R                 = Reward;
     P                 = Punish;
     q0                = Inital;
     this.I            = I;
     this.Il           = Il;
     this.Distribution = dist;
     this.Output       = output;
     SymbolStrength    = new Dictionary <string, float>();
     HistoryData       = new Dictionary <string, Transition>();
     SymbolStrength    = new Dictionary <string, float>();
     OSymbol           = new List <string>();
     ISymbol           = new List <string>();
     Initalize();
 }
Beispiel #5
0
 public State(int id, AbstractOutput output)
 {
     StateID          = id;
     SymbolTransition = new Dictionary <string, Transition>();
     Output           = output;
 }