| | |
| | | import com.algo.service.PathPlanningService; |
| | | import com.algo.service.TaskAllocationService; |
| | | import com.algo.util.AgvTaskUtils; |
| | | import com.algo.util.JsonUtils; |
| | | import org.junit.Test; |
| | | import org.junit.runner.RunWith; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | | import org.springframework.test.context.junit4.SpringRunner; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @SpringBootTest |
| | | @RunWith(SpringRunner.class) |
| | | public class AlgorithmMain { |
| | | |
| | | |
| | | @Autowired |
| | | private TaskAllocationService taskAllocationService; |
| | | |
| | | @Autowired |
| | | private PathPlanningService pathPlanningService; |
| | | |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Test |
| | | public void taskAllocationService() { |
| | | Map<String, Map<String, Integer>> pathMapping = JsonUtils.loadPathMapping("path_mapping.json"); |
| | | System.out.println(pathMapping); |
| | | Map<String, Object> environment = JsonUtils.loadEnvironment("environment.json"); |
| | | System.out.println(environment); |
| | | |
| | | TaskAllocationService taskAllocationService = new TaskAllocationService(pathMapping, environment); |
| | | |
| | | List<AGVStatus> agvStatusList = AgvTaskUtils.loadAgvStatus("ctu_agv_status.json"); |
| | | System.out.println(agvStatusList); |
| | |
| | | */ |
| | | @Test |
| | | public void pathPlanningService() { |
| | | Map<String, Map<String, Integer>> pathMapping = JsonUtils.loadPathMapping("path_mapping.json"); |
| | | System.out.println(pathMapping); |
| | | Map<String, Object> environment = JsonUtils.loadEnvironment("environment.json"); |
| | | System.out.println(environment); |
| | | |
| | | List<TaskData> taskList = AgvTaskUtils.loadTaskList("ctu_task_data.json"); |
| | | System.out.println(taskList); |
| | | |
| | | PathPlanningService pathPlanningService = new PathPlanningService(pathMapping, environment, taskList); |
| | | List<AGVStatus> agvStatusList = AgvTaskUtils.loadAgvStatus("ctu_agv_status.json"); |
| | | System.out.println(agvStatusList); |
| | | PathPlanningService.PathPlanningResult planningResult = pathPlanningService.planAllAgvPaths(agvStatusList, true, null); |
| | | PathPlanningService.PathPlanningResult planningResult = pathPlanningService.planAllAgvPaths(taskList, agvStatusList, true, null); |
| | | System.out.println(planningResult); |
| | | } |
| | | |