//constructor for testing
        public MDP(Dictionary <Tuple <string, string>, int> count_transition)
        {
            this.count_transition = count_transition;

            Ad_Graph = new AdjacencyList();

            initialize_graph();
        }
        private Dictionary <int, int> state_map; // this id to map various state_no to index of list.

        //constructor

        public MDP(Dictionary <Tuple <string, string>, int> count_transition, Dictionary <Tuple <string, int, string>, Double> trans_prob, Dictionary <string, Tuple <Double, int> > state_reward)
        {
            this.count_transition = count_transition;
            this.trans_prob       = trans_prob;
            this.state_reward     = state_reward;

            Global_nodes = new List <State>();
            Ad_Graph     = new AdjacencyList();

            state_map = new Dictionary <int, int>();

            initialize_states();

            Global_nodes_temp = new List <State>(Global_nodes);

            initialize_graph();

            no_states = Global_nodes.Count;
            Console.WriteLine("Total no of nodes in graph : {0}", no_states);
        }
示例#3
0
        public Test()
        {
            read_dictionary();
            MDP model = new MDP(count_transition);

            Ad_Graph = model.Ad_Graph;


            var nodes = Ad_Graph.adjacencyList.Keys.ToList();;

            for (int i = 0; i < nodes.Count; i++)
            {
                writer.WriteLine();
                var row = string.Format("{0},{1}", "start node", nodes[i]);
                writer.WriteLine(row);
                //Console.WriteLine("start node : "+ nodes[i]);
                state_flow(nodes[i]); //1 61155 71221 21254 92434
            }

            writer.Close();
            Console.ReadLine();
        }