Merge branch 'master' of http://10.3.255.244:8801/class_huanghai/group37/2021211180
This commit is contained in:
commit
ffa5d83dea
|
@ -1,6 +1,7 @@
|
|||
cmake_minimum_required(VERSION 3.10) # 设置cmake项目需要的cmake最小版本
|
||||
|
||||
add_subdirectory(test)
|
||||
add_subdirectory(all_test)
|
||||
|
||||
project(auto_pilot_bus) # 设置项目的名称
|
||||
|
||||
|
|
15
all_test/CMakeLists.txt
Normal file
15
all_test/CMakeLists.txt
Normal file
|
@ -0,0 +1,15 @@
|
|||
cmake_minimum_required(VERSION 3.0)
|
||||
project(bus_all_test)
|
||||
|
||||
include_directories(../include)
|
||||
include_directories(include)
|
||||
|
||||
aux_source_directory("../src/" SRCS)
|
||||
aux_source_directory("${CMAKE_CURRENT_SOURCE_DIR}/src" ALL_TEST_SRCS)
|
||||
|
||||
add_executable(bus_all_test ${SRCS} ${ALL_TEST_SRCS} main.c)
|
||||
|
||||
add_custom_command(TARGET bus_all_test POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/test_cases/"
|
||||
$<TARGET_FILE_DIR:bus_all_test>)
|
24
all_test/include/tools.h
Normal file
24
all_test/include/tools.h
Normal file
|
@ -0,0 +1,24 @@
|
|||
//
|
||||
// Created by ricardo on 2022/5/20.
|
||||
//
|
||||
|
||||
#ifndef AUTO_PILOT_BUS_TOOLS_H
|
||||
#define AUTO_PILOT_BUS_TOOLS_H
|
||||
#include "stdio.h"
|
||||
#include "string.h"
|
||||
#include "define.h"
|
||||
#include "rail.h"
|
||||
#include "controller.h"
|
||||
|
||||
void ChooseTestCaseInput(char *path, int index);
|
||||
|
||||
void ChooseTestCaseOutput(char *path, int index);
|
||||
|
||||
rail_node_t *ChooseConfigFile(int index);
|
||||
|
||||
void ReadOutputFile(char *result, FILE *f);
|
||||
|
||||
int CheckOutput(char *program_output, char *read_output);
|
||||
|
||||
rail_node_t *ReadChosenConfigFile(char *config_file_path);
|
||||
#endif //AUTO_PILOT_BUS_TOOLS_H
|
133
all_test/main.c
Normal file
133
all_test/main.c
Normal file
|
@ -0,0 +1,133 @@
|
|||
//
|
||||
// Created by ricardo on 2022/5/20.
|
||||
//
|
||||
#include "bus_io.h"
|
||||
#include "tools.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
/**
|
||||
* 输入的字符串
|
||||
*/
|
||||
char input[30];
|
||||
/**
|
||||
* 输出的字符串
|
||||
*/
|
||||
char output[150];
|
||||
/**
|
||||
* the_bus指针的本体
|
||||
*/
|
||||
bus_t main_bus;
|
||||
/**
|
||||
* 公交车前进的方向
|
||||
*/
|
||||
int direction;
|
||||
/**
|
||||
* 完成的请求
|
||||
*/
|
||||
bus_query_t *finished_query;
|
||||
int index;
|
||||
char path[50];
|
||||
char read_output[150];
|
||||
FILE *input_file = NULL;
|
||||
FILE *output_file = NULL;
|
||||
|
||||
printf("Please choose which test case to use:");
|
||||
scanf("%d\n", &index);
|
||||
|
||||
ChooseTestCaseInput(path, index);
|
||||
input_file = fopen(path, "r");
|
||||
ChooseTestCaseOutput(path, index);
|
||||
output_file = fopen(path, "r");
|
||||
|
||||
// 读取配置文件
|
||||
rails = ChooseConfigFile(index);
|
||||
|
||||
// 制造公交车
|
||||
the_bus = &main_bus;
|
||||
the_bus->distance = 0;
|
||||
the_bus->rail_node_pos = FindNode(rails, 1);
|
||||
|
||||
// 开始时公交车应该是停下的
|
||||
direction = BUS_STOP;
|
||||
|
||||
PrintState(output);
|
||||
ReadOutputFile(read_output, output_file);
|
||||
if(CheckOutput(output, read_output) == BUS_FAlSE)
|
||||
{
|
||||
printf("%s\n", output);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("%d Ok\n", bus_time);
|
||||
}
|
||||
|
||||
for(;;)
|
||||
{
|
||||
fgets(input, sizeof input, input_file);
|
||||
|
||||
int result = ReadInput(input);
|
||||
if(result == IO_CLOCK)
|
||||
{
|
||||
// 时间流动
|
||||
AddTime();
|
||||
|
||||
switch (chosen_strategy)
|
||||
{
|
||||
case BUS_FCFS:
|
||||
// 如果到站,处理请求和
|
||||
if(JudgeOnStation() == BUS_TRUE)
|
||||
{
|
||||
direction = FCFSDirection();
|
||||
finished_query = FCFSQuery();
|
||||
|
||||
if(finished_query != NULL) // 有请求就处理请求
|
||||
{
|
||||
// 循环处理所有可以处理的请求,总共消耗一秒
|
||||
while (finished_query != NULL)
|
||||
{
|
||||
DeleteQuery(finished_query);
|
||||
finished_query = FCFSQuery();
|
||||
}
|
||||
}
|
||||
else //如果没有请求就继续前进
|
||||
{
|
||||
RunBus(direction);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RunBus(direction);
|
||||
}
|
||||
break;
|
||||
case BUS_SSTF:
|
||||
break;
|
||||
case BUS_SCAN:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
PrintState(output);
|
||||
ReadOutputFile(read_output, output_file);
|
||||
if(CheckOutput(output, read_output) == BUS_FAlSE)
|
||||
{
|
||||
printf("%s\n", output);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("%d Ok\n", bus_time);
|
||||
}
|
||||
|
||||
}
|
||||
else if(result == IO_END)
|
||||
{
|
||||
printf("end\n");
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
//在读取到创建请求的情况下,不做任何事
|
||||
}
|
||||
}
|
||||
}
|
184
all_test/src/tools.c
Normal file
184
all_test/src/tools.c
Normal file
|
@ -0,0 +1,184 @@
|
|||
//
|
||||
// Created by ricardo on 2022/5/20.
|
||||
//
|
||||
#include "tools.h"
|
||||
|
||||
void ChooseTestCaseInput(char *path, int index)
|
||||
{
|
||||
memset(path, 0, 50);
|
||||
|
||||
char root_path[] = "./test_cases/";
|
||||
char input_file[] = "/input.txt";
|
||||
char case_path[3];
|
||||
|
||||
sprintf(case_path, "%d", index);
|
||||
|
||||
strcat(path, root_path);
|
||||
strcat(path, case_path);
|
||||
strcat(path, input_file);
|
||||
}
|
||||
|
||||
void ChooseTestCaseOutput(char *path, int index)
|
||||
{
|
||||
memset(path, 0, 50);
|
||||
|
||||
char root_path[] = "./test_cases/";
|
||||
char output_file[] = "/output.txt";
|
||||
char case_path[3];
|
||||
|
||||
sprintf(case_path, "%d", index);
|
||||
|
||||
strcat(path, root_path);
|
||||
strcat(path, case_path);
|
||||
strcat(path, output_file);
|
||||
}
|
||||
|
||||
void ReadOutputFile(char *result, FILE *f)
|
||||
{
|
||||
memset(result, 0, 150);
|
||||
|
||||
for(size_t i = 0; i < 7; i++)
|
||||
{
|
||||
char temp[50];
|
||||
fgets(temp, 50, f);
|
||||
strcat(result, temp);
|
||||
}
|
||||
}
|
||||
|
||||
int CheckOutput(char *program_output, char *read_output)
|
||||
{
|
||||
int result = strcmp(program_output, read_output);
|
||||
|
||||
if(result == 0)
|
||||
{
|
||||
return BUS_TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return BUS_FAlSE;
|
||||
}
|
||||
}
|
||||
|
||||
rail_node_t *ChooseConfigFile(int index)
|
||||
{
|
||||
char root_path[] = "./test_cases/";
|
||||
char config_path[] = "/dict.dic";
|
||||
char case_path[3];
|
||||
|
||||
sprintf(case_path, "%d", index);
|
||||
|
||||
char file_path[30];
|
||||
|
||||
strcat(file_path, root_path);
|
||||
strcat(file_path, case_path);
|
||||
strcat(file_path, config_path);
|
||||
|
||||
return ReadChosenConfigFile(file_path);
|
||||
}
|
||||
|
||||
rail_node_t *ReadChosenConfigFile(char *config_file_path)
|
||||
{
|
||||
FILE *config_file = NULL;
|
||||
char buffer[30];
|
||||
int total_station = 0;
|
||||
int distance = 0;
|
||||
|
||||
config_file = fopen(config_file_path, "r");
|
||||
|
||||
// 循环读取文件的每一行
|
||||
while (fgets(buffer, sizeof buffer, config_file) != NULL)
|
||||
{
|
||||
char first_char = buffer[0];
|
||||
char *p;
|
||||
|
||||
switch (first_char)
|
||||
{
|
||||
case '#':
|
||||
// 如果读取到#什么都不做
|
||||
break;
|
||||
case 'T':
|
||||
// TOTAL_STATION
|
||||
p = buffer;
|
||||
|
||||
// 把数字前面的所有字符全部干掉
|
||||
while (*p < '0' || *p > '9')
|
||||
{
|
||||
p++;
|
||||
}
|
||||
|
||||
if (*p == '1' && *(p + 1) != '\n')
|
||||
{
|
||||
total_station = 10;
|
||||
}
|
||||
else if (*(p + 1) == '\n')
|
||||
{
|
||||
total_station = *p - 48;
|
||||
}
|
||||
|
||||
break;
|
||||
case 'S':
|
||||
// STRATEGY
|
||||
p = buffer;
|
||||
// 将=前的字符全部略去
|
||||
while (*p != '=')
|
||||
{
|
||||
p++;
|
||||
}
|
||||
// =也去掉
|
||||
p++;
|
||||
// =和策略之间的空格也去掉
|
||||
while (*p == ' ')
|
||||
{
|
||||
p++;
|
||||
}
|
||||
|
||||
if (*p == 'F' && *(p + 1) == 'C') //FCFS
|
||||
{
|
||||
chosen_strategy = BUS_FCFS;
|
||||
}
|
||||
else if (*p == 'S' && *(p + 1) == 'S') //SSTF
|
||||
{
|
||||
chosen_strategy = BUS_SSTF;
|
||||
}
|
||||
else if (*p == 'S' && *(p + 1) == 'C') //SCAN
|
||||
{
|
||||
chosen_strategy = BUS_SCAN;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 读取失败
|
||||
chosen_strategy = -1;
|
||||
}
|
||||
|
||||
break;
|
||||
case 'D':
|
||||
// DISTANCE
|
||||
p = buffer;
|
||||
|
||||
// 把数字前面的所有字符全部干掉
|
||||
while (*p < '0' || *p > '9')
|
||||
{
|
||||
p++;
|
||||
}
|
||||
|
||||
if (*(p + 1) == '\n')
|
||||
{
|
||||
distance = *p - 48;
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (distance != 0 && total_station != 0)
|
||||
{
|
||||
return CreateRails(distance, total_station);
|
||||
}
|
||||
else
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
}
|
3
all_test/test_cases/1/dict.dic
Normal file
3
all_test/test_cases/1/dict.dic
Normal file
|
@ -0,0 +1,3 @@
|
|||
TOTAL_STATION = 10
|
||||
STRATEGY = FCFS
|
||||
DISTANCE = 3
|
21
all_test/test_cases/1/input.txt
Normal file
21
all_test/test_cases/1/input.txt
Normal file
|
@ -0,0 +1,21 @@
|
|||
clock
|
||||
counterclockwise 3
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
target 10
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
end
|
134
all_test/test_cases/1/ouput.txt
Normal file
134
all_test/test_cases/1/ouput.txt
Normal file
|
@ -0,0 +1,134 @@
|
|||
TIME:0
|
||||
BUS:
|
||||
position:0
|
||||
target:0000000000
|
||||
STATION:
|
||||
clockwise:0000000000
|
||||
counterclockwise:0000000000
|
||||
TIME:1
|
||||
BUS:
|
||||
position:0
|
||||
target:0000000000
|
||||
STATION:
|
||||
clockwise:0000000000
|
||||
counterclockwise:0000000000
|
||||
TIME:2
|
||||
BUS:
|
||||
position:1
|
||||
target:0000000000
|
||||
STATION:
|
||||
clockwise:0000000000
|
||||
counterclockwise:0010000000
|
||||
TIME:3
|
||||
BUS:
|
||||
position:2
|
||||
target:0000000000
|
||||
STATION:
|
||||
clockwise:0000000000
|
||||
counterclockwise:0010000000
|
||||
TIME:4
|
||||
BUS:
|
||||
position:3
|
||||
target:0000000000
|
||||
STATION:
|
||||
clockwise:0000000000
|
||||
counterclockwise:0010000000
|
||||
TIME:5
|
||||
BUS:
|
||||
position:4
|
||||
target:0000000000
|
||||
STATION:
|
||||
clockwise:0000000000
|
||||
counterclockwise:0010000000
|
||||
TIME:6
|
||||
BUS:
|
||||
position:5
|
||||
target:0000000000
|
||||
STATION:
|
||||
clockwise:0000000000
|
||||
counterclockwise:0010000000
|
||||
TIME:7
|
||||
BUS:
|
||||
position:6
|
||||
target:0000000000
|
||||
STATION:
|
||||
clockwise:0000000000
|
||||
counterclockwise:0010000000
|
||||
TIME:8
|
||||
BUS:
|
||||
position:6
|
||||
target:0000000001
|
||||
STATION:
|
||||
clockwise:0000000000
|
||||
counterclockwise:0000000000
|
||||
TIME:9
|
||||
BUS:
|
||||
position:5
|
||||
target:0000000001
|
||||
STATION:
|
||||
clockwise:0000000000
|
||||
counterclockwise:0000000000
|
||||
TIME:10
|
||||
BUS:
|
||||
position:4
|
||||
target:0000000001
|
||||
STATION:
|
||||
clockwise:0000000000
|
||||
counterclockwise:0000000000
|
||||
TIME:11
|
||||
BUS:
|
||||
position:3
|
||||
target:0000000001
|
||||
STATION:
|
||||
clockwise:0000000000
|
||||
counterclockwise:0000000000
|
||||
TIME:12
|
||||
BUS:
|
||||
position:2
|
||||
target:0000000001
|
||||
STATION:
|
||||
clockwise:0000000000
|
||||
counterclockwise:0000000000
|
||||
TIME:13
|
||||
BUS:
|
||||
position:1
|
||||
target:0000000001
|
||||
STATION:
|
||||
clockwise:0000000000
|
||||
counterclockwise:0000000000
|
||||
TIME:14
|
||||
BUS:
|
||||
position:0
|
||||
target:0000000001
|
||||
STATION:
|
||||
clockwise:0000000000
|
||||
counterclockwise:0000000000
|
||||
TIME:15
|
||||
BUS:
|
||||
position:29
|
||||
target:0000000001
|
||||
STATION:
|
||||
clockwise:0000000000
|
||||
counterclockwise:0000000000
|
||||
TIME:16
|
||||
BUS:
|
||||
position:28
|
||||
target:0000000001
|
||||
STATION:
|
||||
clockwise:0000000000
|
||||
counterclockwise:0000000000
|
||||
TIME:17
|
||||
BUS:
|
||||
position:27
|
||||
target:0000000001
|
||||
STATION:
|
||||
clockwise:0000000000
|
||||
counterclockwise:0000000000
|
||||
TIME:18
|
||||
BUS:
|
||||
position:27
|
||||
target:0000000000
|
||||
STATION:
|
||||
clockwise:0000000000
|
||||
counterclockwise:0000000000
|
||||
end
|
4
all_test/test_cases/2/dict.dic
Normal file
4
all_test/test_cases/2/dict.dic
Normal file
|
@ -0,0 +1,4 @@
|
|||
# first come first serve
|
||||
STRATEGY = FCFS
|
||||
TOTAL_STATION = 10
|
||||
DISTANCE = 2
|
30
all_test/test_cases/2/input.txt
Normal file
30
all_test/test_cases/2/input.txt
Normal file
|
@ -0,0 +1,30 @@
|
|||
clock
|
||||
clockwise 2
|
||||
clock
|
||||
clockwise 4
|
||||
clock
|
||||
clock
|
||||
clockwise 6
|
||||
clock
|
||||
target 8
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
target 10
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
end
|
176
all_test/test_cases/2/output.txt
Normal file
176
all_test/test_cases/2/output.txt
Normal file
|
@ -0,0 +1,176 @@
|
|||
TIME:0
|
||||
BUS:
|
||||
position:0
|
||||
target:0000000000
|
||||
STATION:
|
||||
clockwise:0000000000
|
||||
counterclockwise:0000000000
|
||||
TIME:1
|
||||
BUS:
|
||||
position:0
|
||||
target:0000000000
|
||||
STATION:
|
||||
clockwise:0000000000
|
||||
counterclockwise:0000000000
|
||||
TIME:2
|
||||
BUS:
|
||||
position:1
|
||||
target:0000000000
|
||||
STATION:
|
||||
clockwise:0100000000
|
||||
counterclockwise:0000000000
|
||||
TIME:3
|
||||
BUS:
|
||||
position:2
|
||||
target:0000000000
|
||||
STATION:
|
||||
clockwise:0101000000
|
||||
counterclockwise:0000000000
|
||||
TIME:4
|
||||
BUS:
|
||||
position:2
|
||||
target:0000000000
|
||||
STATION:
|
||||
clockwise:0001000000
|
||||
counterclockwise:0000000000
|
||||
TIME:5
|
||||
BUS:
|
||||
position:3
|
||||
target:0000000000
|
||||
STATION:
|
||||
clockwise:0001010000
|
||||
counterclockwise:0000000000
|
||||
TIME:6
|
||||
BUS:
|
||||
position:4
|
||||
target:0000000100
|
||||
STATION:
|
||||
clockwise:0001010000
|
||||
counterclockwise:0000000000
|
||||
TIME:7
|
||||
BUS:
|
||||
position:5
|
||||
target:0000000100
|
||||
STATION:
|
||||
clockwise:0001010000
|
||||
counterclockwise:0000000000
|
||||
TIME:8
|
||||
BUS:
|
||||
position:6
|
||||
target:0000000100
|
||||
STATION:
|
||||
clockwise:0001010000
|
||||
counterclockwise:0000000000
|
||||
TIME:9
|
||||
BUS:
|
||||
position:6
|
||||
target:0000000101
|
||||
STATION:
|
||||
clockwise:0000010000
|
||||
counterclockwise:0000000000
|
||||
TIME:10
|
||||
BUS:
|
||||
position:7
|
||||
target:0000000101
|
||||
STATION:
|
||||
clockwise:0000010000
|
||||
counterclockwise:0000000000
|
||||
TIME:11
|
||||
BUS:
|
||||
position:8
|
||||
target:0000000101
|
||||
STATION:
|
||||
clockwise:0000010000
|
||||
counterclockwise:0000000000
|
||||
TIME:12
|
||||
BUS:
|
||||
position:9
|
||||
target:0000000101
|
||||
STATION:
|
||||
clockwise:0000010000
|
||||
counterclockwise:0000000000
|
||||
TIME:13
|
||||
BUS:
|
||||
position:10
|
||||
target:0000000101
|
||||
STATION:
|
||||
clockwise:0000010000
|
||||
counterclockwise:0000000000
|
||||
TIME:14
|
||||
BUS:
|
||||
position:10
|
||||
target:0000000101
|
||||
STATION:
|
||||
clockwise:0000000000
|
||||
counterclockwise:0000000000
|
||||
TIME:15
|
||||
BUS:
|
||||
position:11
|
||||
target:0000000101
|
||||
STATION:
|
||||
clockwise:0000000000
|
||||
counterclockwise:0000000000
|
||||
TIME:16
|
||||
BUS:
|
||||
position:12
|
||||
target:0000000101
|
||||
STATION:
|
||||
clockwise:0000000000
|
||||
counterclockwise:0000000000
|
||||
TIME:17
|
||||
BUS:
|
||||
position:13
|
||||
target:0000000101
|
||||
STATION:
|
||||
clockwise:0000000000
|
||||
counterclockwise:0000000000
|
||||
TIME:18
|
||||
BUS:
|
||||
position:14
|
||||
target:0000000101
|
||||
STATION:
|
||||
clockwise:0000000000
|
||||
counterclockwise:0000000000
|
||||
TIME:19
|
||||
BUS:
|
||||
position:14
|
||||
target:0000000001
|
||||
STATION:
|
||||
clockwise:0000000000
|
||||
counterclockwise:0000000000
|
||||
TIME:20
|
||||
BUS:
|
||||
position:15
|
||||
target:0000000001
|
||||
STATION:
|
||||
clockwise:0000000000
|
||||
counterclockwise:0000000000
|
||||
TIME:21
|
||||
BUS:
|
||||
position:16
|
||||
target:0000000001
|
||||
STATION:
|
||||
clockwise:0000000000
|
||||
counterclockwise:0000000000
|
||||
TIME:22
|
||||
BUS:
|
||||
position:17
|
||||
target:0000000001
|
||||
STATION:
|
||||
clockwise:0000000000
|
||||
counterclockwise:0000000000
|
||||
TIME:23
|
||||
BUS:
|
||||
position:18
|
||||
target:0000000001
|
||||
STATION:
|
||||
clockwise:0000000000
|
||||
counterclockwise:0000000000
|
||||
TIME:24
|
||||
BUS:
|
||||
position:18
|
||||
target:0000000000
|
||||
STATION:
|
||||
clockwise:0000000000
|
||||
counterclockwise:0000000000
|
||||
end
|
4
all_test/test_cases/3/dict.dic
Normal file
4
all_test/test_cases/3/dict.dic
Normal file
|
@ -0,0 +1,4 @@
|
|||
# first come first serve
|
||||
STRATEGY = FCFS
|
||||
TOTAL_STATION = 10
|
||||
DISTANCE = 2
|
30
all_test/test_cases/3/input.txt
Normal file
30
all_test/test_cases/3/input.txt
Normal file
|
@ -0,0 +1,30 @@
|
|||
clock
|
||||
clockwise 2
|
||||
clock
|
||||
target 10
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clockwise 3
|
||||
clock
|
||||
clock
|
||||
target 9
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
end
|
183
all_test/test_cases/3/output.txt
Normal file
183
all_test/test_cases/3/output.txt
Normal file
|
@ -0,0 +1,183 @@
|
|||
TIME:0
|
||||
BUS:
|
||||
position:0
|
||||
target:0000000000
|
||||
STATION:
|
||||
clockwise:0000000000
|
||||
counterclockwise:0000000000
|
||||
TIME:1
|
||||
BUS:
|
||||
position:0
|
||||
target:0000000000
|
||||
STATION:
|
||||
clockwise:0000000000
|
||||
counterclockwise:0000000000
|
||||
TIME:2
|
||||
BUS:
|
||||
position:1
|
||||
target:0000000000
|
||||
STATION:
|
||||
clockwise:0100000000
|
||||
counterclockwise:0000000000
|
||||
TIME:3
|
||||
BUS:
|
||||
position:2
|
||||
target:0000000001
|
||||
STATION:
|
||||
clockwise:0100000000
|
||||
counterclockwise:0000000000
|
||||
TIME:4
|
||||
BUS:
|
||||
position:2
|
||||
target:0000000001
|
||||
STATION:
|
||||
clockwise:0000000000
|
||||
counterclockwise:0000000000
|
||||
TIME:5
|
||||
BUS:
|
||||
position:1
|
||||
target:0000000001
|
||||
STATION:
|
||||
clockwise:0000000000
|
||||
counterclockwise:0000000000
|
||||
TIME:6
|
||||
BUS:
|
||||
position:0
|
||||
target:0000000001
|
||||
STATION:
|
||||
clockwise:0010000000
|
||||
counterclockwise:0000000000
|
||||
TIME:7
|
||||
BUS:
|
||||
position:19
|
||||
target:0000000001
|
||||
STATION:
|
||||
clockwise:0010000000
|
||||
counterclockwise:0000000000
|
||||
TIME:8
|
||||
BUS:
|
||||
position:18
|
||||
target:0000000011
|
||||
STATION:
|
||||
clockwise:0010000000
|
||||
counterclockwise:0000000000
|
||||
TIME:9
|
||||
BUS:
|
||||
position:18
|
||||
target:0000000010
|
||||
STATION:
|
||||
clockwise:0010000000
|
||||
counterclockwise:0000000000
|
||||
TIME:10
|
||||
BUS:
|
||||
position:19
|
||||
target:0000000010
|
||||
STATION:
|
||||
clockwise:0010000000
|
||||
counterclockwise:0000000000
|
||||
TIME:11
|
||||
BUS:
|
||||
position:0
|
||||
target:0000000010
|
||||
STATION:
|
||||
clockwise:0010000000
|
||||
counterclockwise:0000000000
|
||||
TIME:12
|
||||
BUS:
|
||||
position:1
|
||||
target:0000000010
|
||||
STATION:
|
||||
clockwise:0010000000
|
||||
counterclockwise:0000000000
|
||||
TIME:13
|
||||
BUS:
|
||||
position:2
|
||||
target:0000000010
|
||||
STATION:
|
||||
clockwise:0010000000
|
||||
counterclockwise:0000000000
|
||||
TIME:14
|
||||
BUS:
|
||||
position:3
|
||||
target:0000000010
|
||||
STATION:
|
||||
clockwise:0010000000
|
||||
counterclockwise:0000000000
|
||||
TIME:15
|
||||
BUS:
|
||||
position:4
|
||||
target:0000000010
|
||||
STATION:
|
||||
clockwise:0010000000
|
||||
counterclockwise:0000000000
|
||||
TIME:16
|
||||
BUS:
|
||||
position:4
|
||||
target:0000000010
|
||||
STATION:
|
||||
clockwise:0000000000
|
||||
counterclockwise:0000000000
|
||||
TIME:17
|
||||
BUS:
|
||||
position:3
|
||||
target:0000000010
|
||||
STATION:
|
||||
clockwise:0000000000
|
||||
counterclockwise:0000000000
|
||||
TIME:18
|
||||
BUS:
|
||||
position:2
|
||||
target:0000000010
|
||||
STATION:
|
||||
clockwise:0000000000
|
||||
counterclockwise:0000000000
|
||||
TIME:19
|
||||
BUS:
|
||||
position:1
|
||||
target:0000000010
|
||||
STATION:
|
||||
clockwise:0000000000
|
||||
counterclockwise:0000000000
|
||||
TIME:20
|
||||
BUS:
|
||||
position:0
|
||||
target:0000000010
|
||||
STATION:
|
||||
clockwise:0000000000
|
||||
counterclockwise:0000000000
|
||||
TIME:21
|
||||
BUS:
|
||||
position:19
|
||||
target:0000000010
|
||||
STATION:
|
||||
clockwise:0000000000
|
||||
counterclockwise:0000000000
|
||||
TIME:22
|
||||
BUS:
|
||||
position:18
|
||||
target:0000000010
|
||||
STATION:
|
||||
clockwise:0000000000
|
||||
counterclockwise:0000000000
|
||||
TIME:23
|
||||
BUS:
|
||||
position:17
|
||||
target:0000000010
|
||||
STATION:
|
||||
clockwise:0000000000
|
||||
counterclockwise:0000000000
|
||||
TIME:24
|
||||
BUS:
|
||||
position:16
|
||||
target:0000000010
|
||||
STATION:
|
||||
clockwise:0000000000
|
||||
counterclockwise:0000000000
|
||||
TIME:25
|
||||
BUS:
|
||||
position:16
|
||||
target:0000000000
|
||||
STATION:
|
||||
clockwise:0000000000
|
||||
counterclockwise:0000000000
|
||||
end
|
4
all_test/test_cases/4/dict.dic
Normal file
4
all_test/test_cases/4/dict.dic
Normal file
|
@ -0,0 +1,4 @@
|
|||
DISTANCE = 4
|
||||
STRATEGY = SCAN
|
||||
TOTAL_STATION = 6
|
||||
# scan serve
|
34
all_test/test_cases/4/input.txt
Normal file
34
all_test/test_cases/4/input.txt
Normal file
|
@ -0,0 +1,34 @@
|
|||
clock
|
||||
clockwise 2
|
||||
clock
|
||||
clock
|
||||
counterclockwise 6
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
target 1
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
counterclockwise 5
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
end
|
211
all_test/test_cases/4/output.txt
Normal file
211
all_test/test_cases/4/output.txt
Normal file
|
@ -0,0 +1,211 @@
|
|||
TIME:0
|
||||
BUS:
|
||||
position:0
|
||||
target:000000
|
||||
STATION:
|
||||
clockwise:000000
|
||||
counterclockwise:000000
|
||||
TIME:1
|
||||
BUS:
|
||||
position:0
|
||||
target:000000
|
||||
STATION:
|
||||
clockwise:000000
|
||||
counterclockwise:000000
|
||||
TIME:2
|
||||
BUS:
|
||||
position:1
|
||||
target:000000
|
||||
STATION:
|
||||
clockwise:010000
|
||||
counterclockwise:000000
|
||||
TIME:3
|
||||
BUS:
|
||||
position:2
|
||||
target:000000
|
||||
STATION:
|
||||
clockwise:010000
|
||||
counterclockwise:000000
|
||||
TIME:4
|
||||
BUS:
|
||||
position:3
|
||||
target:000000
|
||||
STATION:
|
||||
clockwise:010000
|
||||
counterclockwise:000001
|
||||
TIME:5
|
||||
BUS:
|
||||
position:4
|
||||
target:000000
|
||||
STATION:
|
||||
clockwise:010000
|
||||
counterclockwise:000001
|
||||
TIME:6
|
||||
BUS:
|
||||
position:4
|
||||
target:000000
|
||||
STATION:
|
||||
clockwise:000000
|
||||
counterclockwise:000001
|
||||
TIME:7
|
||||
BUS:
|
||||
position:3
|
||||
target:000000
|
||||
STATION:
|
||||
clockwise:000000
|
||||
counterclockwise:000001
|
||||
TIME:8
|
||||
BUS:
|
||||
position:2
|
||||
target:000000
|
||||
STATION:
|
||||
clockwise:000000
|
||||
counterclockwise:000001
|
||||
TIME:9
|
||||
BUS:
|
||||
position:1
|
||||
target:000000
|
||||
STATION:
|
||||
clockwise:000000
|
||||
counterclockwise:000001
|
||||
TIME:10
|
||||
BUS:
|
||||
position:0
|
||||
target:000000
|
||||
STATION:
|
||||
clockwise:000000
|
||||
counterclockwise:000001
|
||||
TIME:11
|
||||
BUS:
|
||||
position:23
|
||||
target:000000
|
||||
STATION:
|
||||
clockwise:000000
|
||||
counterclockwise:000001
|
||||
TIME:12
|
||||
BUS:
|
||||
position:22
|
||||
target:100000
|
||||
STATION:
|
||||
clockwise:000000
|
||||
counterclockwise:000001
|
||||
TIME:13
|
||||
BUS:
|
||||
position:21
|
||||
target:100000
|
||||
STATION:
|
||||
clockwise:000000
|
||||
counterclockwise:000001
|
||||
TIME:14
|
||||
BUS:
|
||||
position:20
|
||||
target:100000
|
||||
STATION:
|
||||
clockwise:000000
|
||||
counterclockwise:000001
|
||||
TIME:15
|
||||
BUS:
|
||||
position:20
|
||||
target:100000
|
||||
STATION:
|
||||
clockwise:000000
|
||||
counterclockwise:000000
|
||||
TIME:16
|
||||
BUS:
|
||||
position:21
|
||||
target:100000
|
||||
STATION:
|
||||
clockwise:000000
|
||||
counterclockwise:000000
|
||||
TIME:17
|
||||
BUS:
|
||||
position:22
|
||||
target:100000
|
||||
STATION:
|
||||
clockwise:000000
|
||||
counterclockwise:000000
|
||||
TIME:18
|
||||
BUS:
|
||||
position:23
|
||||
target:100000
|
||||
STATION:
|
||||
clockwise:000000
|
||||
counterclockwise:000010
|
||||
TIME:19
|
||||
BUS:
|
||||
position:0
|
||||
target:100000
|
||||
STATION:
|
||||
clockwise:000000
|
||||
counterclockwise:000010
|
||||
TIME:20
|
||||
BUS:
|
||||
position:0
|
||||
target:000000
|
||||
STATION:
|
||||
clockwise:000000
|
||||
counterclockwise:000010
|
||||
TIME:21
|
||||
BUS:
|
||||
position:23
|
||||
target:000000
|
||||
STATION:
|
||||
clockwise:000000
|
||||
counterclockwise:000010
|
||||
TIME:22
|
||||
BUS:
|
||||
position:22
|
||||
target:000000
|
||||
STATION:
|
||||
clockwise:000000
|
||||
counterclockwise:000010
|
||||
TIME:23
|
||||
BUS:
|
||||
position:21
|
||||
target:000000
|
||||
STATION:
|
||||
clockwise:000000
|
||||
counterclockwise:000010
|
||||
TIME:24
|
||||
BUS:
|
||||
position:20
|
||||
target:000000
|
||||
STATION:
|
||||
clockwise:000000
|
||||
counterclockwise:000010
|
||||
TIME:25
|
||||
BUS:
|
||||
position:19
|
||||
target:000000
|
||||
STATION:
|
||||
clockwise:000000
|
||||
counterclockwise:000010
|
||||
TIME:26
|
||||
BUS:
|
||||
position:18
|
||||
target:000000
|
||||
STATION:
|
||||
clockwise:000000
|
||||
counterclockwise:000010
|
||||
TIME:27
|
||||
BUS:
|
||||
position:17
|
||||
target:000000
|
||||
STATION:
|
||||
clockwise:000000
|
||||
counterclockwise:000010
|
||||
TIME:28
|
||||
BUS:
|
||||
position:16
|
||||
target:000000
|
||||
STATION:
|
||||
clockwise:000000
|
||||
counterclockwise:000010
|
||||
TIME:29
|
||||
BUS:
|
||||
position:16
|
||||
target:000000
|
||||
STATION:
|
||||
clockwise:000000
|
||||
counterclockwise:000000
|
||||
end
|
4
all_test/test_cases/5/dict.dic
Normal file
4
all_test/test_cases/5/dict.dic
Normal file
|
@ -0,0 +1,4 @@
|
|||
DISTANCE = 4
|
||||
STRATEGY = SCAN
|
||||
TOTAL_STATION = 6
|
||||
# scan serve
|
26
all_test/test_cases/5/input.txt
Normal file
26
all_test/test_cases/5/input.txt
Normal file
|
@ -0,0 +1,26 @@
|
|||
clock
|
||||
clockwise 2
|
||||
counterclockwise 3
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
target 4
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clockwise 5
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
end
|
155
all_test/test_cases/5/output.txt
Normal file
155
all_test/test_cases/5/output.txt
Normal file
|
@ -0,0 +1,155 @@
|
|||
TIME:0
|
||||
BUS:
|
||||
position:0
|
||||
target:000000
|
||||
STATION:
|
||||
clockwise:000000
|
||||
counterclockwise:000000
|
||||
TIME:1
|
||||
BUS:
|
||||
position:0
|
||||
target:000000
|
||||
STATION:
|
||||
clockwise:000000
|
||||
counterclockwise:000000
|
||||
TIME:2
|
||||
BUS:
|
||||
position:1
|
||||
target:000000
|
||||
STATION:
|
||||
clockwise:010000
|
||||
counterclockwise:001000
|
||||
TIME:3
|
||||
BUS:
|
||||
position:2
|
||||
target:000000
|
||||
STATION:
|
||||
clockwise:010000
|
||||
counterclockwise:001000
|
||||
TIME:4
|
||||
BUS:
|
||||
position:3
|
||||
target:000000
|
||||
STATION:
|
||||
clockwise:010000
|
||||
counterclockwise:001000
|
||||
TIME:5
|
||||
BUS:
|
||||
position:4
|
||||
target:000000
|
||||
STATION:
|
||||
clockwise:010000
|
||||
counterclockwise:001000
|
||||
TIME:6
|
||||
BUS:
|
||||
position:4
|
||||
target:000000
|
||||
STATION:
|
||||
clockwise:000000
|
||||
counterclockwise:001000
|
||||
TIME:7
|
||||
BUS:
|
||||
position:5
|
||||
target:000000
|
||||
STATION:
|
||||
clockwise:000000
|
||||
counterclockwise:001000
|
||||
TIME:8
|
||||
BUS:
|
||||
position:6
|
||||
target:000100
|
||||
STATION:
|
||||
clockwise:000000
|
||||
counterclockwise:001000
|
||||
TIME:9
|
||||
BUS:
|
||||
position:7
|
||||
target:000100
|
||||
STATION:
|
||||
clockwise:000000
|
||||
counterclockwise:001000
|
||||
TIME:10
|
||||
BUS:
|
||||
position:8
|
||||
target:000100
|
||||
STATION:
|
||||
clockwise:000000
|
||||
counterclockwise:001000
|
||||
TIME:11
|
||||
BUS:
|
||||
position:8
|
||||
target:000100
|
||||
STATION:
|
||||
clockwise:000000
|
||||
counterclockwise:000000
|
||||
TIME:12
|
||||
BUS:
|
||||
position:9
|
||||
target:000100
|
||||
STATION:
|
||||
clockwise:000000
|
||||
counterclockwise:000000
|
||||
TIME:13
|
||||
BUS:
|
||||
position:10
|
||||
target:000100
|
||||
STATION:
|
||||
clockwise:000000
|
||||
counterclockwise:000000
|
||||
TIME:14
|
||||
BUS:
|
||||
position:11
|
||||
target:000100
|
||||
STATION:
|
||||
clockwise:000010
|
||||
counterclockwise:000000
|
||||
TIME:15
|
||||
BUS:
|
||||
position:12
|
||||
target:000100
|
||||
STATION:
|
||||
clockwise:000010
|
||||
counterclockwise:000000
|
||||
TIME:16
|
||||
BUS:
|
||||
position:12
|
||||
target:000000
|
||||
STATION:
|
||||
clockwise:000010
|
||||
counterclockwise:000000
|
||||
TIME:17
|
||||
BUS:
|
||||
position:13
|
||||
target:000000
|
||||
STATION:
|
||||
clockwise:000010
|
||||
counterclockwise:000000
|
||||
TIME:18
|
||||
BUS:
|
||||
position:14
|
||||
target:000000
|
||||
STATION:
|
||||
clockwise:000010
|
||||
counterclockwise:000000
|
||||
TIME:19
|
||||
BUS:
|
||||
position:15
|
||||
target:000000
|
||||
STATION:
|
||||
clockwise:000010
|
||||
counterclockwise:000000
|
||||
TIME:20
|
||||
BUS:
|
||||
position:16
|
||||
target:000000
|
||||
STATION:
|
||||
clockwise:000010
|
||||
counterclockwise:000000
|
||||
TIME:21
|
||||
BUS:
|
||||
position:16
|
||||
target:000000
|
||||
STATION:
|
||||
clockwise:000000
|
||||
counterclockwise:000000
|
||||
end
|
4
all_test/test_cases/6/dict.dic
Normal file
4
all_test/test_cases/6/dict.dic
Normal file
|
@ -0,0 +1,4 @@
|
|||
TOTAL_STATION = 5
|
||||
DISTANCE = 3
|
||||
# shortest seek time first
|
||||
STRATEGY = SSTF
|
47
all_test/test_cases/6/input.txt
Normal file
47
all_test/test_cases/6/input.txt
Normal file
|
@ -0,0 +1,47 @@
|
|||
clock
|
||||
clockwise 4
|
||||
clockwise 2
|
||||
counterclockwise 4
|
||||
clock
|
||||
clockwise 2
|
||||
clock
|
||||
clock
|
||||
counterclockwise 1
|
||||
clock
|
||||
clock
|
||||
clockwise 3
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
target 5
|
||||
clock
|
||||
target 3
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
target 4
|
||||
target 1
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
end
|
260
all_test/test_cases/6/output.txt
Normal file
260
all_test/test_cases/6/output.txt
Normal file
|
@ -0,0 +1,260 @@
|
|||
TIME:0
|
||||
BUS:
|
||||
position:0
|
||||
target:00000
|
||||
STATION:
|
||||
clockwise:00000
|
||||
counterclockwise:00000
|
||||
TIME:1
|
||||
BUS:
|
||||
position:0
|
||||
target:00000
|
||||
STATION:
|
||||
clockwise:00000
|
||||
counterclockwise:00000
|
||||
TIME:2
|
||||
BUS:
|
||||
position:1
|
||||
target:00000
|
||||
STATION:
|
||||
clockwise:01010
|
||||
counterclockwise:00010
|
||||
TIME:3
|
||||
BUS:
|
||||
position:2
|
||||
target:00000
|
||||
STATION:
|
||||
clockwise:01010
|
||||
counterclockwise:00010
|
||||
TIME:4
|
||||
BUS:
|
||||
position:3
|
||||
target:00000
|
||||
STATION:
|
||||
clockwise:01010
|
||||
counterclockwise:00010
|
||||
TIME:5
|
||||
BUS:
|
||||
position:3
|
||||
target:00000
|
||||
STATION:
|
||||
clockwise:00010
|
||||
counterclockwise:10010
|
||||
TIME:6
|
||||
BUS:
|
||||
position:2
|
||||
target:00000
|
||||
STATION:
|
||||
clockwise:00010
|
||||
counterclockwise:10010
|
||||
TIME:7
|
||||
BUS:
|
||||
position:1
|
||||
target:00000
|
||||
STATION:
|
||||
clockwise:00110
|
||||
counterclockwise:10010
|
||||
TIME:8
|
||||
BUS:
|
||||
position:0
|
||||
target:00000
|
||||
STATION:
|
||||
clockwise:00110
|
||||
counterclockwise:10010
|
||||
TIME:9
|
||||
BUS:
|
||||
position:0
|
||||
target:00000
|
||||
STATION:
|
||||
clockwise:00110
|
||||
counterclockwise:00010
|
||||
TIME:10
|
||||
BUS:
|
||||
position:1
|
||||
target:00000
|
||||
STATION:
|
||||
clockwise:00110
|
||||
counterclockwise:00010
|
||||
TIME:11
|
||||
BUS:
|
||||
position:2
|
||||
target:00000
|
||||
STATION:
|
||||
clockwise:00110
|
||||
counterclockwise:00010
|
||||
TIME:12
|
||||
BUS:
|
||||
position:3
|
||||
target:00000
|
||||
STATION:
|
||||
clockwise:00110
|
||||
counterclockwise:00010
|
||||
TIME:13
|
||||
BUS:
|
||||
position:4
|
||||
target:00000
|
||||
STATION:
|
||||
clockwise:00110
|
||||
counterclockwise:00010
|
||||
TIME:14
|
||||
BUS:
|
||||
position:5
|
||||
target:00001
|
||||
STATION:
|
||||
clockwise:00110
|
||||
counterclockwise:00010
|
||||
TIME:15
|
||||
BUS:
|
||||
position:6
|
||||
target:00101
|
||||
STATION:
|
||||
clockwise:00110
|
||||
counterclockwise:00010
|
||||
TIME:16
|
||||
BUS:
|
||||
position:6
|
||||
target:00001
|
||||
STATION:
|
||||
clockwise:00010
|
||||
counterclockwise:00010
|
||||
TIME:17
|
||||
BUS:
|
||||
position:7
|
||||
target:00001
|
||||
STATION:
|
||||
clockwise:00010
|
||||
counterclockwise:00010
|
||||
TIME:18
|
||||
BUS:
|
||||
position:8
|
||||
target:00001
|
||||
STATION:
|
||||
clockwise:00010
|
||||
counterclockwise:00010
|
||||
TIME:19
|
||||
BUS:
|
||||
position:9
|
||||
target:00001
|
||||
STATION:
|
||||
clockwise:00010
|
||||
counterclockwise:00010
|
||||
TIME:20
|
||||
BUS:
|
||||
position:9
|
||||
target:00001
|
||||
STATION:
|
||||
clockwise:00000
|
||||
counterclockwise:00000
|
||||
TIME:21
|
||||
BUS:
|
||||
position:10
|
||||
target:00001
|
||||
STATION:
|
||||
clockwise:00000
|
||||
counterclockwise:00000
|
||||
TIME:22
|
||||
BUS:
|
||||
position:11
|
||||
target:00001
|
||||
STATION:
|
||||
clockwise:00000
|
||||
counterclockwise:00000
|
||||
TIME:23
|
||||
BUS:
|
||||
position:12
|
||||
target:10011
|
||||
STATION:
|
||||
clockwise:00000
|
||||
counterclockwise:00000
|
||||
TIME:24
|
||||
BUS:
|
||||
position:12
|
||||
target:10010
|
||||
STATION:
|
||||
clockwise:00000
|
||||
counterclockwise:00000
|
||||
TIME:25
|
||||
BUS:
|
||||
position:13
|
||||
target:10010
|
||||
STATION:
|
||||
clockwise:00000
|
||||
counterclockwise:00000
|
||||
TIME:26
|
||||
BUS:
|
||||
position:14
|
||||
target:10010
|
||||
STATION:
|
||||
clockwise:00000
|
||||
counterclockwise:00000
|
||||
TIME:27
|
||||
BUS:
|
||||
position:0
|
||||
target:10010
|
||||
STATION:
|
||||
clockwise:00000
|
||||
counterclockwise:00000
|
||||
TIME:28
|
||||
BUS:
|
||||
position:0
|
||||
target:00010
|
||||
STATION:
|
||||
clockwise:00000
|
||||
counterclockwise:00000
|
||||
TIME:29
|
||||
BUS:
|
||||
position:14
|
||||
target:00010
|
||||
STATION:
|
||||
clockwise:00000
|
||||
counterclockwise:00000
|
||||
TIME:30
|
||||
BUS:
|
||||
position:13
|
||||
target:00010
|
||||
STATION:
|
||||
clockwise:00000
|
||||
counterclockwise:00000
|
||||
TIME:31
|
||||
BUS:
|
||||
position:12
|
||||
target:00010
|
||||
STATION:
|
||||
clockwise:00000
|
||||
counterclockwise:00000
|
||||
TIME:32
|
||||
BUS:
|
||||
position:11
|
||||
target:00010
|
||||
STATION:
|
||||
clockwise:00000
|
||||
counterclockwise:00000
|
||||
TIME:33
|
||||
BUS:
|
||||
position:10
|
||||
target:00010
|
||||
STATION:
|
||||
clockwise:00000
|
||||
counterclockwise:00000
|
||||
TIME:34
|
||||
BUS:
|
||||
position:9
|
||||
target:00010
|
||||
STATION:
|
||||
clockwise:00000
|
||||
counterclockwise:00000
|
||||
TIME:35
|
||||
BUS:
|
||||
position:9
|
||||
target:00000
|
||||
STATION:
|
||||
clockwise:00000
|
||||
counterclockwise:00000
|
||||
TIME:36
|
||||
BUS:
|
||||
position:9
|
||||
target:00000
|
||||
STATION:
|
||||
clockwise:00000
|
||||
counterclockwise:00000
|
||||
end
|
4
all_test/test_cases/7/dict.dic
Normal file
4
all_test/test_cases/7/dict.dic
Normal file
|
@ -0,0 +1,4 @@
|
|||
TOTAL_STATION = 5
|
||||
DISTANCE = 3
|
||||
# shortest seek time first
|
||||
STRATEGY = SSTF
|
42
all_test/test_cases/7/input.txt
Normal file
42
all_test/test_cases/7/input.txt
Normal file
|
@ -0,0 +1,42 @@
|
|||
clock
|
||||
clockwise 2
|
||||
counterclockwise 4
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
counterclockwise 3
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
target 5
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
counterclockwise 4
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
target 1
|
||||
clockwise 3
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
target 2
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
clock
|
||||
end
|
239
all_test/test_cases/7/output.txt
Normal file
239
all_test/test_cases/7/output.txt
Normal file
|
@ -0,0 +1,239 @@
|
|||
TIME:0
|
||||
BUS:
|
||||
position:0
|
||||
target:00000
|
||||
STATION:
|
||||
clockwise:00000
|
||||
counterclockwise:00000
|
||||
TIME:1
|
||||
BUS:
|
||||
position:0
|
||||
target:00000
|
||||
STATION:
|
||||
clockwise:00000
|
||||
counterclockwise:00000
|
||||
TIME:2
|
||||
BUS:
|
||||
position:1
|
||||
target:00000
|
||||
STATION:
|
||||
clockwise:01000
|
||||
counterclockwise:00010
|
||||
TIME:3
|
||||
BUS:
|
||||
position:2
|
||||
target:00000
|
||||
STATION:
|
||||
clockwise:01000
|
||||
counterclockwise:00010
|
||||
TIME:4
|
||||
BUS:
|
||||
position:3
|
||||
target:00000
|
||||
STATION:
|
||||
clockwise:01000
|
||||
counterclockwise:00010
|
||||
TIME:5
|
||||
BUS:
|
||||
position:3
|
||||
target:00000
|
||||
STATION:
|
||||
clockwise:00000
|
||||
counterclockwise:00010
|
||||
TIME:6
|
||||
BUS:
|
||||
position:4
|
||||
target:00000
|
||||
STATION:
|
||||
clockwise:00000
|
||||
counterclockwise:00010
|
||||
TIME:7
|
||||
BUS:
|
||||
position:5
|
||||
target:00000
|
||||
STATION:
|
||||
clockwise:00000
|
||||
counterclockwise:00110
|
||||
TIME:8
|
||||
BUS:
|
||||
position:6
|
||||
target:00000
|
||||
STATION:
|
||||
clockwise:00000
|
||||
counterclockwise:00110
|
||||
TIME:9
|
||||
BUS:
|
||||
position:7
|
||||
target:00000
|
||||
STATION:
|
||||
clockwise:00000
|
||||
counterclockwise:00110
|
||||
TIME:10
|
||||
BUS:
|
||||
position:8
|
||||
target:00000
|
||||
STATION:
|
||||
clockwise:00000
|
||||
counterclockwise:00110
|
||||
TIME:11
|
||||
BUS:
|
||||
position:9
|
||||
target:00001
|
||||
STATION:
|
||||
clockwise:00000
|
||||
counterclockwise:00110
|
||||
TIME:12
|
||||
BUS:
|
||||
position:9
|
||||
target:00001
|
||||
STATION:
|
||||
clockwise:00000
|
||||
counterclockwise:00100
|
||||
TIME:13
|
||||
BUS:
|
||||
position:10
|
||||
target:00001
|
||||
STATION:
|
||||
clockwise:00000
|
||||
counterclockwise:00100
|
||||
TIME:14
|
||||
BUS:
|
||||
position:11
|
||||
target:00001
|
||||
STATION:
|
||||
clockwise:00000
|
||||
counterclockwise:00100
|
||||
TIME:15
|
||||
BUS:
|
||||
position:12
|
||||
target:00001
|
||||
STATION:
|
||||
clockwise:00000
|
||||
counterclockwise:00100
|
||||
TIME:16
|
||||
BUS:
|
||||
position:12
|
||||
target:00000
|
||||
STATION:
|
||||
clockwise:00000
|
||||
counterclockwise:00100
|
||||
TIME:17
|
||||
BUS:
|
||||
position:11
|
||||
target:00000
|
||||
STATION:
|
||||
clockwise:00000
|
||||
counterclockwise:00110
|
||||
TIME:18
|
||||
BUS:
|
||||
position:10
|
||||
target:00000
|
||||
STATION:
|
||||
clockwise:00000
|
||||
counterclockwise:00110
|
||||
TIME:19
|
||||
BUS:
|
||||
position:9
|
||||
target:00000
|
||||
STATION:
|
||||
clockwise:00000
|
||||
counterclockwise:00110
|
||||
TIME:20
|
||||
BUS:
|
||||
position:9
|
||||
target:00000
|
||||
STATION:
|
||||
clockwise:00000
|
||||
counterclockwise:00100
|
||||
TIME:21
|
||||
BUS:
|
||||
position:8
|
||||
target:00000
|
||||
STATION:
|
||||
clockwise:00000
|
||||
counterclockwise:00100
|
||||
TIME:22
|
||||
BUS:
|
||||
position:7
|
||||
target:10000
|
||||
STATION:
|
||||
clockwise:00100
|
||||
counterclockwise:00100
|
||||
TIME:23
|
||||
BUS:
|
||||
position:6
|
||||
target:10000
|
||||
STATION:
|
||||
clockwise:00100
|
||||
counterclockwise:00100
|
||||
TIME:24
|
||||
BUS:
|
||||
position:6
|
||||
target:10000
|
||||
STATION:
|
||||
clockwise:00000
|
||||
counterclockwise:00000
|
||||
TIME:25
|
||||
BUS:
|
||||
position:5
|
||||
target:10000
|
||||
STATION:
|
||||
clockwise:00000
|
||||
counterclockwise:00000
|
||||
TIME:26
|
||||
BUS:
|
||||
position:4
|
||||
target:11000
|
||||
STATION:
|
||||
clockwise:00000
|
||||
counterclockwise:00000
|
||||
TIME:27
|
||||
BUS:
|
||||
position:3
|
||||
target:11000
|
||||
STATION:
|
||||
clockwise:00000
|
||||
counterclockwise:00000
|
||||
TIME:28
|
||||
BUS:
|
||||
position:3
|
||||
target:10000
|
||||
STATION:
|
||||
clockwise:00000
|
||||
counterclockwise:00000
|
||||
TIME:29
|
||||
BUS:
|
||||
position:2
|
||||
target:10000
|
||||
STATION:
|
||||
clockwise:00000
|
||||
counterclockwise:00000
|
||||
TIME:30
|
||||
BUS:
|
||||
position:1
|
||||
target:10000
|
||||
STATION:
|
||||
clockwise:00000
|
||||
counterclockwise:00000
|
||||
TIME:31
|
||||
BUS:
|
||||
position:0
|
||||
target:10000
|
||||
STATION:
|
||||
clockwise:00000
|
||||
counterclockwise:00000
|
||||
TIME:32
|
||||
BUS:
|
||||
position:0
|
||||
target:00000
|
||||
STATION:
|
||||
clockwise:00000
|
||||
counterclockwise:00000
|
||||
TIME:33
|
||||
BUS:
|
||||
position:0
|
||||
target:00000
|
||||
STATION:
|
||||
clockwise:00000
|
||||
counterclockwise:00000
|
||||
end
|
Loading…
Reference in New Issue
Block a user