// Use this for initialization void Start() { map = new PolyMapLoaderT3("polygMap1/x", "polygMap1/y", "polygMap1/goalPos", "polygMap1/startPos", "polygMap1/button", "polygMap1/customerPos"); mapData = map.polyData; R = 5; agents = new List <PolyAgent> (); for (int i = 0; i < mapData.start.Count; i++) { Vector3 start = mapData.start[i]; Vector3 end = mapData.end[i]; agents.Add(new PolyAgent("Agent " + i, start, end, R, "point")); agents [i].agent.renderer.material.color = Color.blue; agents[i].model = gameObject.AddComponent <DynamicPointModel> (); } vrp = new VRPPL(mapData.customers, agents.Count); foreach (PolyAgent agent in agents) { List <Vector3> path = new List <Vector3> (); path.Add(agent.end); agent.model.SetPath(path, agent, mapData.lines); agent.model.StartCoroutineMove(); } }
void Start() { map = new PolyMapLoaderT3("polygMap1/x", "polygMap1/y", "polygMap1/goalPos", "polygMap1/startPos", "polygMap1/button", "polygMap1/customerPos"); polyData = map.polyData; graph = new VGraph(); walkableLines = new List <Line> (); // START VRP R = 3; agents = new List <PolyAgent> (); for (int i = 0; i < polyData.start.Count; i++) { Vector3 start = polyData.start[i]; Vector3 end = polyData.end[i]; agents.Add(new PolyAgent("Agent " + i, start, end, R, "car")); agents [i].agent.renderer.material.color = Color.black; agents[i].model = gameObject.AddComponent <DynamicCarModel> (); //agents[i].model = gameObject.AddComponent<DynamicPointModel> (); } List <Vector3> customers = new List <Vector3> (); // for plotting foreach (Vector3 v in polyData.customers) { customers.Add(v); } vrp = new VRPPL(customers, agents.Count); // END VRP CreateObstacles(); ConstructWalkableLines(); CreateInterObstacleWalk(); // print ("Walkable lines: " + walkableLines.Count); // graph.PrintGraph (); stopwatch.Start(); ready = new List <PolyAgent> (); }