Exemplo n.º 1
0
 public void find_dist_to_all_rovers(List <Rover> fidos)
 {
     Distances.Clear();
     for (int i = 0; i < num_rovers; i++)
     {
         Distances.Add(find_dist_to_rover(i, fidos));
     }
 }
Exemplo n.º 2
0
        public void Deserialize(BinaryReader r)
        {
            Distances.Clear();
            int distances_count = r.ReadInt32();

            for (int i = 0; i < distances_count; ++i)
            {
                Distances.Add(new CellIdPair(r), r.ReadSingle());
            }
        }
Exemplo n.º 3
0
        public void Deserialize(BinaryReader r)
        {
            Distances.Clear();
            int distances_count = r.ReadInt32();

            for (int i = 0; i < distances_count; ++i)
            {
                int key1           = r.ReadInt32();
                var distance_table = new Dictionary <int, float>();
                Distances.Add(key1, distance_table);
                int distances2_count = r.ReadInt32();
                for (int j = 0; j < distances2_count; ++j)
                {
                    distance_table.Add(r.ReadInt32(), r.ReadSingle());
                }
            }
        }
Exemplo n.º 4
0
        /// Summary
        /// Time: 8 min 17 sec
        /// Pattern: AAAA, Parameterized stub
        /// Pex Limitations - Not able to generate any test due to the following issue:
        /// <boundary> maxbranches - 40000 (maximum number of branches exceeded)
        /// [execution] Please notice: A branch in the method System.Collections.Hashtable+HashtableEnumerator.MoveNext was executed 5777 times;
        /// please check that the code is not stuck in an infinite loop.
        /// [test] (run 1) GraphWithoutSelfEdgesPUT01, pathboundsexceeded (duplicate)
        /// [execution] Please notice: A branch in the method System.Collections.Hashtable+HashtableEnumerator.MoveNext was executed 4344 times;
        /// please check that the code is not stuck in an infinite loop.
        /// [test] (run 2) GraphWithoutSelfEdgesPUT01, pathboundsexceeded (duplicate)
        /// <summary>
        /// @Author:Madhuri
        /// </summary>
        public void GraphWithSelfEdgesPUT(AdjacencyGraph g, int loopBound)
        {
            Random rnd = new Random();

            Init();
            for (int i = 0; i < loopBound; ++i)
            {
                for (int j = 0; j < i * i; ++j)
                {
                    RandomGraph.Graph(g, i, j, rnd, true);
                    BreadthFirstSearchAlgorithm bfs = new BreadthFirstSearchAlgorithm(g);
                    bfs.InitializeVertex += new VertexHandler(this.InitializeVertex);
                    bfs.DiscoverVertex   += new VertexHandler(this.DiscoverVertex);
                    bfs.ExamineEdge      += new EdgeHandler(this.ExamineEdge);
                    bfs.ExamineVertex    += new VertexHandler(this.ExamineVertex);
                    bfs.TreeEdge         += new EdgeHandler(this.TreeEdge);
                    bfs.NonTreeEdge      += new EdgeHandler(this.NonTreeEdge);
                    bfs.GrayTarget       += new EdgeHandler(this.GrayTarget);
                    bfs.BlackTarget      += new EdgeHandler(this.BlackTarget);
                    bfs.FinishVertex     += new VertexHandler(this.FinishVertex);

                    Parents.Clear();
                    Distances.Clear();
                    m_CurrentDistance = 0;

                    m_SourceVertex = RandomGraph.Vertex(g, rnd);
                    var choose = PexChoose.FromCall(this);
                    if (choose.ChooseValue <bool>("to add a self ede"))
                    {
                        IVertex selfEdge = RandomGraph.Vertex(g, rnd);
                        g.AddEdge(selfEdge, selfEdge);
                    }
                    // g.RemoveEdge(RandomGraph.Edge(g, rnd));
                    foreach (IVertex v in g.Vertices)
                    {
                        Distances[v] = int.MaxValue;
                        Parents[v]   = v;
                    }
                    Distances[SourceVertex] = 0;
                    bfs.Compute(SourceVertex);

                    CheckBfs(g, bfs);
                }
            }
        }
Exemplo n.º 5
0
        public void GraphWithSelfEdges()
        {
            Random rnd = new Random();

            for (int i = 0; i < 10; ++i)
            {
                for (int j = 0; j < i * i; ++j)
                {
                    AdjacencyGraph g = new AdjacencyGraph(
                        new QuickGraph.Providers.VertexProvider(),
                        new QuickGraph.Providers.EdgeProvider(),
                        true);
                    RandomGraph.Graph(g, i, j, rnd, true);

                    BreadthFirstSearchAlgorithm bfs = new BreadthFirstSearchAlgorithm(g);
                    bfs.InitializeVertex += new VertexEventHandler(this.InitializeVertex);
                    bfs.DiscoverVertex   += new VertexEventHandler(this.DiscoverVertex);
                    bfs.ExamineEdge      += new EdgeEventHandler(this.ExamineEdge);
                    bfs.ExamineVertex    += new VertexEventHandler(this.ExamineVertex);
                    bfs.TreeEdge         += new EdgeEventHandler(this.TreeEdge);
                    bfs.NonTreeEdge      += new EdgeEventHandler(this.NonTreeEdge);
                    bfs.GrayTarget       += new EdgeEventHandler(this.GrayTarget);
                    bfs.BlackTarget      += new EdgeEventHandler(this.BlackTarget);
                    bfs.FinishVertex     += new VertexEventHandler(this.FinishVertex);

                    Parents.Clear();
                    Distances.Clear();
                    m_CurrentDistance = 0;
                    m_SourceVertex    = RandomGraph.Vertex(g, rnd);

                    foreach (IVertex v in g.Vertices)
                    {
                        Distances[v] = int.MaxValue;
                        Parents[v]   = v;
                    }
                    Distances[SourceVertex] = 0;
                    bfs.Compute(SourceVertex);

                    CheckBfs(g, bfs);
                }
            }
        }
Exemplo n.º 6
0
        private void resetDefaults()
        {
            if (Enemies != null)
            {
                Enemies.Clear();
                Enemies = null;
            }
            if (Distances != null)
            {
                Distances.Clear();
                Distances = null;
            }

            VariableName  = null;
            VariableValue = 0;

            ExperienceAmount = 0;

            ItemToGet = null;
            //TODO
        }
Exemplo n.º 7
0
 public void Clear()
 {
     Distances.Clear();
 }