53 Commits

Author SHA1 Message Date
7e5df09232 fix: build on linux 2024-01-13 22:12:29 +08:00
392e11ce5c 添加GPLv3许可证 2022-07-11 10:52:00 +08:00
faa6cfc40e 再次修改了readme文件 2022-07-11 10:38:02 +08:00
e3e807f85d 完善了注释 2022-07-09 10:11:35 +08:00
f179dcbf4e 重写了CI的逻辑
Some checks failed
windows-build / Build the application (push) Has been cancelled
2022-07-07 20:26:55 +08:00
aa6ae9d69d 再次修改构建文件的路径
Some checks failed
windows-build / Build the application (push) Has been cancelled
2022-07-07 20:00:39 +08:00
9ad11c4280 路径中斜杠替换为反斜杠 2022-07-07 19:11:29 +08:00
58a3b8c4fb 在README文件中添加了徽章
修改CI文件
2022-07-07 18:14:36 +08:00
bd5d52949c 文件路径中缺失了Release 2022-07-07 18:03:04 +08:00
9f0ce782e4 删除了Cmake配置文件中多余的部分 2022-07-07 17:55:40 +08:00
c38a9010c3 添加了CI文件 2022-07-07 17:46:26 +08:00
013ce3a434 完善了README文档 2022-07-05 18:10:54 +08:00
8657066b49 再次修复了代码
提高了代码的可读性
2022-07-04 17:17:49 +08:00
dc7635d8d0 添加了轨道和位置点 2022-07-04 17:09:22 +08:00
73b096aa3d 修复了到站不停车的问题
用nullptr替代了NULL
2022-07-01 20:00:30 +08:00
752ddf8a33 将Debug模式的生成子系统设为CONSOlE便于调试 2022-07-01 17:13:12 +08:00
21af2c0311 将tick的持续时间设置了全局常量 2022-07-01 16:38:07 +08:00
10505c38b4 将程序的生成子系统调整为Windows 2022-07-01 16:37:47 +08:00
8cd607ec75 完善了注释 2022-06-29 17:25:33 +08:00
a9c1d2dbf8 完善了README文件
重写了获得公交车位置的函数
2022-06-29 16:47:19 +08:00
79c3318faa 添加了停止公交车效果 2022-06-29 12:14:38 +08:00
1a0c65383b 添加了显示当前策略的标签
调整了公交车的位置
2022-06-29 11:33:43 +08:00
3ab2edf65c 添加了站点编号 2022-06-28 22:55:00 +08:00
2a5b4b3841 修复了车闪现的问题 2022-06-28 22:42:48 +08:00
ccf82dd0f5 这幽灵车终于跑起来了 2022-06-28 21:15:50 +08:00
ab830fcd9e 日志的打印完成
控制开始结束的流程完成
2022-06-28 18:44:55 +08:00
112299b02f 添加了公交车动画函数 2022-06-28 12:23:55 +08:00
35569b093d 将PosPair类独立出来
添加了公交车显示类
2022-06-28 11:10:49 +08:00
b2b043e227 重新设计控制器同GUI之间的关系
重写了GetBusDirection函数
2022-06-28 09:57:43 +08:00
e5d7f0b238 添加了README文件 2022-06-27 17:02:31 +08:00
672e26d175 新建了策略工厂类 2022-06-27 14:21:07 +08:00
ad37da5974 新建了策略控制基类
实现了三种策略的策略控制类
2022-06-27 13:59:58 +08:00
ce7986b5a6 删除了冗长的公交车控制类
设计了单独的公交车类
2022-06-27 13:18:50 +08:00
50aa9d9c6a 添加了获得公交车在画布中位置的函数 2022-06-27 11:00:00 +08:00
6c9328d783 重写了删除请求列表中对象的函数 2022-06-26 19:44:52 +08:00
c9b7908e4c 获得方向与处理请求两个槽函数完成 2022-06-26 18:10:47 +08:00
04d6ab09ee 创建请求相关动作完成 2022-06-26 17:21:24 +08:00
54c4521fb2 读取配置文件后重绘站点图重设下拉栏
修复了释放轨道链表内存空间时未判断指针是否为空的问题
修复了绘制站点图部分站点位置计算错误的问题
2022-06-26 15:02:43 +08:00
48cd806197 多线程开始 2022-06-26 13:57:45 +08:00
4709b1ad7c 重新设计了轨道管理类 2022-06-26 13:06:22 +08:00
a044ff1044 完善了请求列表的相关槽函数 2022-06-26 12:09:19 +08:00
7cbdf5963e 展示请求队列的widget 2022-06-26 11:02:21 +08:00
ac6a9c9a68 添加了打开配置文件的功能 2022-06-25 16:35:07 +08:00
d67c91f4c8 移植了所有的策略控制函数 2022-06-17 12:18:43 +08:00
a464744bda 移植了读取配置文件 获得请求距离 判断是否到站三个函数 2022-06-17 11:25:02 +08:00
f18f545618 显示了站点的图片 2022-06-17 10:33:28 +08:00
5b2045675d 成功显示了公交车的图片 2022-06-16 22:42:55 +08:00
fa843258ce 添加了资源文件 2022-06-16 21:45:49 +08:00
48947253f2 添加了公交车控制类 2022-06-11 19:05:06 +08:00
2c73b1d2ed 添加了常量定义头文件 2022-06-11 19:04:47 +08:00
35fa35de3f 添加了请求控制类
添加了注释
2022-06-10 23:33:20 +08:00
6380265faa 添加了轨道类 2022-06-10 21:21:35 +08:00
2eb368ddfa Create GUI Branch 2022-06-10 19:52:43 +08:00
369 changed files with 3203 additions and 106760 deletions

55
.github/workflows/build.yml vendored Normal file
View File

@@ -0,0 +1,55 @@
name: windows-build
on:
# 在设置git tag时触发执行
push:
tags:
- 'v*'
env:
# 设置编译的类型
BUILD_TYPE: Release
jobs:
build:
name: "Build the application"
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Install Qt
# 安装Qt
uses: jurplel/install-qt-action@v2
with:
version: '6.1.3'
host: 'windows'
target: 'desktop'
arch: 'win64_msvc2019_64'
- name: Config Cmake
# 设置cmake
env:
CMAKE_PREFIX_PATH: ${{env.Qt6_Dir}}
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
- name: Compile
# 编译程序
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: Deploy Qt
# 寻找需要的dll并压缩为单个文件
run: |
mkdir release
cp build/Release/auto_bus_gui.exe release
windeployqt release/auto_bus_gui.exe
7z a release.zip .\release\*
- name: Upload Release
# 上传发布
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
files: |
release.zip

8
.gitignore vendored
View File

@@ -6,10 +6,4 @@ cmake-build-*/
.vscode/
# CLion的配置文件夹
.idea/
# draw.io的缓存文件
*.bkp
# 合成的全部代码文件
all.c
.idea/

View File

@@ -1,22 +1,38 @@
cmake_minimum_required(VERSION 3.10) # 设置cmake项目需要的cmake最小版本
cmake_minimum_required(VERSION 3.10)
project(auto_bus_gui)
add_subdirectory(third_party/GTest)
add_subdirectory(test)
add_subdirectory(all_test)
file(GLOB_RECURSE QRC_SOURCE_FILES ${PROJECT_SOURCE_DIR}/*.qrc)
project(auto_pilot_bus) # 设置项目的名称
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
set(QRC_SOURCE_FILES Resources.qrc)
set(CMAKE_C_STANDARD 11) # 设置项目的C语言标准版本
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
find_package(Qt6 COMPONENTS
Core
Gui
Widgets
REQUIRED)
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/build) # 设置项目的产生的库的路径,这里直接设为二进制文件处
qt6_add_resources(QRC_FILES ${QRC_SOURCE_FILES})
SOURCE_GROUP("Resource Files" FILES ${QRC_SOURCE_FILES})
# 设置项目的头文件目录
include_directories(
${PROJECT_SOURCE_DIR}/include/
${PROJECT_SOURCE_DIR}/include
${PROJECT_SOURCE_DIR}/src/header
)
aux_source_directory(./src SRC)
aux_source_directory(${PROJECT_SOURCE_DIR}/src SRCS)
# 产生可执行文件
add_executable(bus main.c ${SRC})
if (CMAKE_BUILD_TYPE MATCHES "Debug")
add_executable(auto_bus_gui main.cpp ${SRCS} ${QRC_FILES})
else()
add_executable(auto_bus_gui WIN32 main.cpp ${SRCS} ${QRC_FILES})
endif ()
target_link_libraries(auto_bus_gui
Qt::Core
Qt::Gui
Qt::Widgets
)

128
README.md
View File

@@ -1,105 +1,63 @@
# Auto Pilot Bus
# Auto Bus GUI
北京邮电大学计算机学院2021级《计算导论与程序设计》实践大作业项目仓库本次课程的题目为“自动公交车调度”。
[![windows-build](https://github.com/jackfiled/auto_bus/actions/workflows/build.yml/badge.svg)](https://github.com/jackfiled/auto_bus/actions/workflows/build.yml)
> `master`分支为控制台输出的核心版
>
> `gui`分支为采用`Qt`实现的动画版
北京邮电大学计算机学院2021级《计算导论与程序设计》实践大作业“公交车调度”的GUI分支。
### 特点
- 采用`cmake`进行项目管理,编译轻松快捷。
- 程序模块化设计,注释详尽代码可读性高
- 含有`GTest`单元测试模块和自行设计的全局测试模块,还提供了不少测试用例。
- 完全使用`markdown`撰写的文档
- 采用`CMake`进行项目管理
- 注释详尽代码可读性高
## 项目使用
## 构建
### 结构
> 可以直接下载Release界面中的二进制文件压缩包
```
auto_pilot_bus
|
+-all_test //本地全局测试文件夹
|
+-docs // 文档文件夹
|
+-include // 头文件文件夹
|
+-src // 源代码文件夹
|
+-test //单元测试文件夹
|
+-main.c // 程序入口
+-convert.py //产生测试集的Python脚本
+-main.py //将C代码合并到同一个文件的Python脚本
+-CMakeLists.txt // CMake文件
+-.gitignore //git的忽略文件名录
+-README.md // 项目介绍文件
### 构建环境
- 编译器`Visual Studio 2022 MSVC++ 14.3`
- Qt` 6.1.3`
- CMake `3.22`
### 构建
```bash
git clone https://github.com/jackfiled/auto_bus.git
git checkout -b gui origin/gui
```
### 编译环境
使用文本编辑器打开`CMakeLists.txt`文件,修改文件中`CMAKE_PREFIX_PATH`变量所指定的路劲为当前安装Qt的位置。
- 编译工具 `cmake 3.23.1`
- 理论上不依赖特定的编译器
```bash
mkdir build
cd build
cmake .. -G "Visual Studio 17 2022"
```
> `MinGW64 GCC`和`GNU GCC`编译器经过测试可正常编译
使用`Visual Studio`打开`CMake`生成的解决方案文件,即可编译运行
> 或者直接使用VS打开签出分支之后的项目文件夹也可编译使用。
>
> Visual Studio 2022已经支持用`cmake`管理并编译`C/C++`项目。
## 使用
![主界面截图](md_pic/main.png)
### 主界面
主界面由四个部分组成,分别是最上方的菜单栏,左侧的动画区,右侧的控制面板,下方的日志输出。
### 使用
使用
首先使用`File-Read ConfigFile`读取一个配置文件,在读取结束后动画区会显示公交车与公交站台,在控制面板的上方会显示当前选择的策略种类。
```bash
git clone https://github.com/jackfiled/auto_bus.git
```
使用`Run-Run Bus``Run-Stop Bus`控制公交的启动和停止。在开始运行之后,在日志输出区会打印当前的状态。
下载完成后文件夹`auto_bus`即为项目的文件夹
在控制面板的下方可以查看当前存在的请求与添加请求
使用
![运行时截图](md_pic/running.png)
> 可自行指定使用的编译器
```bash
cd auto_bus
mkdir build # 创建编译的文件夹
cd build
cmake .. -G "MinGW Makefiles" # 在第一次生成之后就不必再使用"-G"参数指定编译类型
cmake --build .
```
在编译执行完成之后,`build`文件下的`bus.exe`即为编译产生的程序。
程序具体支持的指令可以查看文档中的说明文档。
### 测试
#### 单元测试
在编译之后,`build/test`文件夹内即为`google test`框架生成的单元测试。
#### 全局测试
在编译之后,`build/all_test`内的`bus_all_test.exe`就是全局本地测试程序。
运行这个程序,根据程序的提示选择适当的测试集,程序会自动读取选定的测试集中的配置文件和输入文件,并且将程序的输出和测试集中的输出文件进行对比,输出比对的结果。
程序现有的测试集存储在`all_test/test_cases`下面目前已有18个测试集对应测试集采用的调度策略可以查看测试集中的配置文件。
## 支持
如果你在学习/使用的过程中遇到的任何问题,或者有任何的意见与建议,可以在仓库中提交`Issue`和`Pull Request`同我们讨论。
当然,也可以给我发电子邮件。
## 贡献者
[jackfiled](https://github.com/jackfiled)
[nvhaizi1](https://github.com/nvhaizi1)
[Yerolling](https://github.com/Yerolling)
## 鸣谢
[GoogleTest](https://github.com/google/googletest)
### 策略上的补充说明
由于GUI的性质所有的请求都是立即调度的不同于OJ版的等待一个clock结束之后在进行调度。

8
Resources.qrc Normal file
View File

@@ -0,0 +1,8 @@
<RCC>
<qresource prefix="/">
<file>picture/stop.png</file>
</qresource>
<qresource prefix="/">
<file>picture/bus.png</file>
</qresource>
</RCC>

View File

@@ -1,15 +0,0 @@
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_directory
"${CMAKE_CURRENT_SOURCE_DIR}/test_cases"
"$<TARGET_FILE_DIR:bus_all_test>/test_cases")

View File

@@ -1,24 +0,0 @@
//
// 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

View File

@@ -1,258 +0,0 @@
//
// 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", &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;
PrintStateInner(output);
ReadOutputFile(read_output, output_file);
if(CheckOutput(output, read_output) == BUS_FAlSE)
{
printf("Right:\n");
printf("%s", read_output);
printf("Wrong:\n");
printf("%s", output);
printf("\n"); // 打印一个空白作为分界线
}
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();
}
// 请求处理完再进行方向的判断
direction = FCFSDirection();
}
else //如果没有请求就继续前进
{
RunBus(direction);
}
}
else
{
RunBus(direction);
}
break;
case BUS_SSTF:
if(JudgeOnStation() == BUS_TRUE)
{
// 在没有目标请求的时候,获取一个目标站点
if(target_query == NULL)
{
target_query = SSTFGetQuery();
direction = SSTFDirection(target_query);
// 处理下一个需要处理的请求就在脚底下的情况
if(target_query != NULL && direction == BUS_STOP && target_query->node == the_bus->rail_node_pos)
{
while (target_query != NULL && direction == BUS_STOP && target_query->node == the_bus->rail_node_pos)
{
DeleteQuery(target_query);
target_query = SSTFGetQuery();
direction = SSTFDirection(target_query);
}
}
RunBus(direction);
}
else
{
bus_query_t *btw_query = SSTFBTWQuery(direction);
// 如果到站了
if(target_query->node == the_bus->rail_node_pos)
{
// 如果刚好在站点上就有不少请求,处理一波
// 这里利用了&&运算符的短路特性,如果第一个判断为假,则不进行下一个判断,也就避免了段错误
while (target_query != NULL && target_query->node == the_bus->rail_node_pos)
{
DeleteQuery(target_query);
target_query = SSTFGetQuery();
direction = SSTFDirection(target_query);
}
}
else if(btw_query != NULL)
{
// 如果没有到站就看看能不能顺便服务
while (btw_query != NULL)
{
DeleteQuery(btw_query);
btw_query = SSTFBTWQuery(direction);
}
}
else
{
// 如果啥也不能做就走吧
RunBus(direction);
}
}
}
else
{
// 没到站的话那就走吧
RunBus(direction);
}
break;
case BUS_SCAN:
// 如果没有指定的请求就获得指定的请求
if(JudgeOnStation() == BUS_TRUE)
{
// 在没有目标请求的时候,获取一个目标站点
if(target_query == NULL)
{
target_query = SCANGetQuery(direction);
direction = SCANDirection(target_query, direction);
// 处理下一个需要处理的请求就在脚底下的情况
if(target_query != NULL && target_query->node == the_bus->rail_node_pos)
{
while (target_query != NULL && target_query->node == the_bus->rail_node_pos)
{
DeleteQuery(target_query);
target_query = SSTFGetQuery();
direction = SSTFDirection(target_query);
}
}
RunBus(direction);
}
else
{
bus_query_t *btw_query = SCANBTWQuery();
// 如果到站了
if(target_query->node == the_bus->rail_node_pos)
{
// 如果刚好在站点上就有不少请求,处理一波
// 这里利用了&&运算符的短路特性,如果第一个判断为假,则不进行下一个判断,也就避免了段错误
while (target_query != NULL && target_query->node == the_bus->rail_node_pos)
{
DeleteQuery(target_query);
target_query = SCANGetQuery(direction);
direction = SCANDirection(target_query, direction);
}
}
else if(btw_query != NULL)
{
// 如果没有到站就看看能不能顺便服务
while (btw_query != NULL)
{
DeleteQuery(btw_query);
btw_query = SCANBTWQuery();
}
}
else
{
// 如果啥也不能做就走吧
RunBus(direction);
}
}
}
else
{
// 没到站的话那就走吧
RunBus(direction);
}
break;
default:
// 这个分支只是为了符合代码规范而存在,理论上不会用到这个分支
break;
}
PrintStateInner(output);
ReadOutputFile(read_output, output_file);
if(CheckOutput(output, read_output) == BUS_FAlSE)
{
printf("Right:\n");
printf("%s", read_output);
printf("Wrong:\n");
printf("%s", output);
printf("\n"); // 打印一个空白行作为分界线
}
else
{
printf("%d Ok\n", bus_time);
}
}
else if(result == IO_END)
{
printf("end\n");
break;
}
else
{
//在读取到创建请求的情况下,不做任何事
}
}
}

View File

@@ -1,3 +0,0 @@
TOTAL_STATION = 10
STRATEGY = FCFS
DISTANCE = 3

View File

@@ -1,21 +0,0 @@
clock
counterclockwise 3
clock
clock
clock
clock
clock
clock
target 10
clock
clock
clock
clock
clock
clock
clock
clock
clock
clock
clock
end

View File

@@ -1,134 +0,0 @@
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

View File

@@ -1,3 +0,0 @@
TOTAL_STATION = 10
STRATEGY = SSTF
#end

View File

@@ -1,11 +0,0 @@
clock
clockwise 8
clock
clockwise 8
clock
clock
clock
clock
clock
clock
end

View File

@@ -1,64 +0,0 @@
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:19
target:0000000000
STATION:
clockwise:0000000100
counterclockwise:0000000000
TIME:3
BUS:
position:18
target:0000000000
STATION:
clockwise:0000000100
counterclockwise:0000000000
TIME:4
BUS:
position:17
target:0000000000
STATION:
clockwise:0000000100
counterclockwise:0000000000
TIME:5
BUS:
position:16
target:0000000000
STATION:
clockwise:0000000100
counterclockwise:0000000000
TIME:6
BUS:
position:15
target:0000000000
STATION:
clockwise:0000000100
counterclockwise:0000000000
TIME:7
BUS:
position:14
target:0000000000
STATION:
clockwise:0000000100
counterclockwise:0000000000
TIME:8
BUS:
position:14
target:0000000000
STATION:
clockwise:0000000000
counterclockwise:0000000000
end

View File

@@ -1,3 +0,0 @@
TOTAL_STATION = 10
STRATEGY = SSTF
#end

View File

@@ -1,14 +0,0 @@
clock
clockwise 8
clock
clockwise 9
clock
clock
clock
clock
clock
clock
clock
clock
clock
end

View File

@@ -1,85 +0,0 @@
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:19
target:0000000000
STATION:
clockwise:0000000100
counterclockwise:0000000000
TIME:3
BUS:
position:18
target:0000000000
STATION:
clockwise:0000000110
counterclockwise:0000000000
TIME:4
BUS:
position:17
target:0000000000
STATION:
clockwise:0000000110
counterclockwise:0000000000
TIME:5
BUS:
position:16
target:0000000000
STATION:
clockwise:0000000110
counterclockwise:0000000000
TIME:6
BUS:
position:15
target:0000000000
STATION:
clockwise:0000000110
counterclockwise:0000000000
TIME:7
BUS:
position:14
target:0000000000
STATION:
clockwise:0000000110
counterclockwise:0000000000
TIME:8
BUS:
position:14
target:0000000000
STATION:
clockwise:0000000010
counterclockwise:0000000000
TIME:9
BUS:
position:15
target:0000000000
STATION:
clockwise:0000000010
counterclockwise:0000000000
TIME:10
BUS:
position:16
target:0000000000
STATION:
clockwise:0000000010
counterclockwise:0000000000
TIME:11
BUS:
position:16
target:0000000000
STATION:
clockwise:0000000000
counterclockwise:0000000000
end

View File

@@ -1,3 +0,0 @@
TOTAL_STATION = 10
STRATEGY = SSTF
#end

View File

@@ -1,14 +0,0 @@
clock
clockwise 4
clock
clock
clock
target 3
clock
clock
clock
clock
clock
clock
clock
end

View File

@@ -1,85 +0,0 @@
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:0001000000
counterclockwise:0000000000
TIME:3
BUS:
position:2
target:0000000000
STATION:
clockwise:0001000000
counterclockwise:0000000000
TIME:4
BUS:
position:3
target:0000000000
STATION:
clockwise:0001000000
counterclockwise:0000000000
TIME:5
BUS:
position:4
target:0010000000
STATION:
clockwise:0001000000
counterclockwise:0000000000
TIME:6
BUS:
position:4
target:0000000000
STATION:
clockwise:0001000000
counterclockwise:0000000000
TIME:7
BUS:
position:5
target:0000000000
STATION:
clockwise:0001000000
counterclockwise:0000000000
TIME:8
BUS:
position:6
target:0000000000
STATION:
clockwise:0001000000
counterclockwise:0000000000
TIME:9
BUS:
position:6
target:0000000000
STATION:
clockwise:0000000000
counterclockwise:0000000000
TIME:10
BUS:
position:6
target:0000000000
STATION:
clockwise:0000000000
counterclockwise:0000000000
TIME:11
BUS:
position:6
target:0000000000
STATION:
clockwise:0000000000
counterclockwise:0000000000
end

View File

@@ -1,3 +0,0 @@
TOTAL_STATION = 10
STRATEGY = SSTF
#end

View File

@@ -1,16 +0,0 @@
clock
clockwise 4
clock
clockwise 5
clock
counterclockwise 4
clock
target 4
clock
clock
clock
clock
clock
clock
clock
end

View File

@@ -1,85 +0,0 @@
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:0001000000
counterclockwise:0000000000
TIME:3
BUS:
position:2
target:0000000000
STATION:
clockwise:0001100000
counterclockwise:0000000000
TIME:4
BUS:
position:3
target:0000000000
STATION:
clockwise:0001100000
counterclockwise:0001000000
TIME:5
BUS:
position:4
target:0001000000
STATION:
clockwise:0001100000
counterclockwise:0001000000
TIME:6
BUS:
position:5
target:0001000000
STATION:
clockwise:0001100000
counterclockwise:0001000000
TIME:7
BUS:
position:6
target:0001000000
STATION:
clockwise:0001100000
counterclockwise:0001000000
TIME:8
BUS:
position:6
target:0000000000
STATION:
clockwise:0000100000
counterclockwise:0000000000
TIME:9
BUS:
position:7
target:0000000000
STATION:
clockwise:0000100000
counterclockwise:0000000000
TIME:10
BUS:
position:8
target:0000000000
STATION:
clockwise:0000100000
counterclockwise:0000000000
TIME:11
BUS:
position:8
target:0000000000
STATION:
clockwise:0000000000
counterclockwise:0000000000
end

View File

@@ -1,3 +0,0 @@
TOTAL_STATION = 10
STRATEGY = SSTF
#end

View File

@@ -1,12 +0,0 @@
clock
clockwise 2
counterclockwise 10
clock
clock
clock
clock
clock
clock
clock
clock
end

View File

@@ -1,71 +0,0 @@
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:0000000001
TIME:3
BUS:
position:2
target:0000000000
STATION:
clockwise:0100000000
counterclockwise:0000000001
TIME:4
BUS:
position:2
target:0000000000
STATION:
clockwise:0000000000
counterclockwise:0000000001
TIME:5
BUS:
position:1
target:0000000000
STATION:
clockwise:0000000000
counterclockwise:0000000001
TIME:6
BUS:
position:0
target:0000000000
STATION:
clockwise:0000000000
counterclockwise:0000000001
TIME:7
BUS:
position:19
target:0000000000
STATION:
clockwise:0000000000
counterclockwise:0000000001
TIME:8
BUS:
position:18
target:0000000000
STATION:
clockwise:0000000000
counterclockwise:0000000001
TIME:9
BUS:
position:18
target:0000000000
STATION:
clockwise:0000000000
counterclockwise:0000000000
end

View File

@@ -1,3 +0,0 @@
TOTAL_STATION = 10
STRATEGY = SSTF
#end

View File

@@ -1,48 +0,0 @@
clock
clockwise 6
clock
clockwise 5
clock
counterclockwise 9
clock
target 3
clock
clock
target 10
clockwise 7
clock
target 1
clock
counterclockwise 2
clock
target 4
clock
target 8
clock
clock
clock
clock
clock
clock
clock
clock
clock
clock
clock
clock
clock
clock
clock
clock
clock
clock
clock
clock
clock
clock
clock
clock
clock
clock
clock
end

View File

@@ -1,267 +0,0 @@
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:0000010000
counterclockwise:0000000000
TIME:3
BUS:
position:2
target:0000000000
STATION:
clockwise:0000110000
counterclockwise:0000000000
TIME:4
BUS:
position:3
target:0000000000
STATION:
clockwise:0000110000
counterclockwise:0000000010
TIME:5
BUS:
position:4
target:0010000000
STATION:
clockwise:0000110000
counterclockwise:0000000010
TIME:6
BUS:
position:4
target:0000000000
STATION:
clockwise:0000110000
counterclockwise:0000000010
TIME:7
BUS:
position:5
target:0000000001
STATION:
clockwise:0000111000
counterclockwise:0000000010
TIME:8
BUS:
position:6
target:1000000001
STATION:
clockwise:0000111000
counterclockwise:0000000010
TIME:9
BUS:
position:7
target:1000000001
STATION:
clockwise:0000111000
counterclockwise:0100000010
TIME:10
BUS:
position:8
target:1001000001
STATION:
clockwise:0000111000
counterclockwise:0100000010
TIME:11
BUS:
position:8
target:1001000101
STATION:
clockwise:0000011000
counterclockwise:0100000010
TIME:12
BUS:
position:9
target:1001000101
STATION:
clockwise:0000011000
counterclockwise:0100000010
TIME:13
BUS:
position:10
target:1001000101
STATION:
clockwise:0000011000
counterclockwise:0100000010
TIME:14
BUS:
position:10
target:1001000101
STATION:
clockwise:0000001000
counterclockwise:0100000010
TIME:15
BUS:
position:11
target:1001000101
STATION:
clockwise:0000001000
counterclockwise:0100000010
TIME:16
BUS:
position:12
target:1001000101
STATION:
clockwise:0000001000
counterclockwise:0100000010
TIME:17
BUS:
position:12
target:1001000101
STATION:
clockwise:0000000000
counterclockwise:0100000010
TIME:18
BUS:
position:13
target:1001000101
STATION:
clockwise:0000000000
counterclockwise:0100000010
TIME:19
BUS:
position:14
target:1001000101
STATION:
clockwise:0000000000
counterclockwise:0100000010
TIME:20
BUS:
position:14
target:1001000001
STATION:
clockwise:0000000000
counterclockwise:0100000010
TIME:21
BUS:
position:15
target:1001000001
STATION:
clockwise:0000000000
counterclockwise:0100000010
TIME:22
BUS:
position:16
target:1001000001
STATION:
clockwise:0000000000
counterclockwise:0100000010
TIME:23
BUS:
position:16
target:1001000001
STATION:
clockwise:0000000000
counterclockwise:0100000000
TIME:24
BUS:
position:17
target:1001000001
STATION:
clockwise:0000000000
counterclockwise:0100000000
TIME:25
BUS:
position:18
target:1001000001
STATION:
clockwise:0000000000
counterclockwise:0100000000
TIME:26
BUS:
position:18
target:1001000000
STATION:
clockwise:0000000000
counterclockwise:0100000000
TIME:27
BUS:
position:19
target:1001000000
STATION:
clockwise:0000000000
counterclockwise:0100000000
TIME:28
BUS:
position:0
target:1001000000
STATION:
clockwise:0000000000
counterclockwise:0100000000
TIME:29
BUS:
position:0
target:0001000000
STATION:
clockwise:0000000000
counterclockwise:0100000000
TIME:30
BUS:
position:1
target:0001000000
STATION:
clockwise:0000000000
counterclockwise:0100000000
TIME:31
BUS:
position:2
target:0001000000
STATION:
clockwise:0000000000
counterclockwise:0100000000
TIME:32
BUS:
position:2
target:0001000000
STATION:
clockwise:0000000000
counterclockwise:0000000000
TIME:33
BUS:
position:3
target:0001000000
STATION:
clockwise:0000000000
counterclockwise:0000000000
TIME:34
BUS:
position:4
target:0001000000
STATION:
clockwise:0000000000
counterclockwise:0000000000
TIME:35
BUS:
position:5
target:0001000000
STATION:
clockwise:0000000000
counterclockwise:0000000000
TIME:36
BUS:
position:6
target:0001000000
STATION:
clockwise:0000000000
counterclockwise:0000000000
TIME:37
BUS:
position:6
target:0000000000
STATION:
clockwise:0000000000
counterclockwise:0000000000
end

View File

@@ -1,3 +0,0 @@
TOTAL_STATION = 10
STRATEGY = SSTF
#end

View File

@@ -1,24 +0,0 @@
clock
clockwise 8
clock
counterclockwise 9
clock
clock
clock
clock
clock
clock
clock
clock
clock
clockwise 6
clock
counterclockwise 7
clock
clock
clock
clock
clock
clock
clock
end

View File

@@ -1,141 +0,0 @@
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:19
target:0000000000
STATION:
clockwise:0000000100
counterclockwise:0000000000
TIME:3
BUS:
position:18
target:0000000000
STATION:
clockwise:0000000100
counterclockwise:0000000010
TIME:4
BUS:
position:17
target:0000000000
STATION:
clockwise:0000000100
counterclockwise:0000000010
TIME:5
BUS:
position:16
target:0000000000
STATION:
clockwise:0000000100
counterclockwise:0000000010
TIME:6
BUS:
position:16
target:0000000000
STATION:
clockwise:0000000100
counterclockwise:0000000000
TIME:7
BUS:
position:15
target:0000000000
STATION:
clockwise:0000000100
counterclockwise:0000000000
TIME:8
BUS:
position:14
target:0000000000
STATION:
clockwise:0000000100
counterclockwise:0000000000
TIME:9
BUS:
position:14
target:0000000000
STATION:
clockwise:0000000000
counterclockwise:0000000000
TIME:10
BUS:
position:14
target:0000000000
STATION:
clockwise:0000000000
counterclockwise:0000000000
TIME:11
BUS:
position:14
target:0000000000
STATION:
clockwise:0000000000
counterclockwise:0000000000
TIME:12
BUS:
position:13
target:0000000000
STATION:
clockwise:0000010000
counterclockwise:0000000000
TIME:13
BUS:
position:12
target:0000000000
STATION:
clockwise:0000010000
counterclockwise:0000001000
TIME:14
BUS:
position:12
target:0000000000
STATION:
clockwise:0000010000
counterclockwise:0000000000
TIME:15
BUS:
position:11
target:0000000000
STATION:
clockwise:0000010000
counterclockwise:0000000000
TIME:16
BUS:
position:10
target:0000000000
STATION:
clockwise:0000010000
counterclockwise:0000000000
TIME:17
BUS:
position:10
target:0000000000
STATION:
clockwise:0000000000
counterclockwise:0000000000
TIME:18
BUS:
position:10
target:0000000000
STATION:
clockwise:0000000000
counterclockwise:0000000000
TIME:19
BUS:
position:10
target:0000000000
STATION:
clockwise:0000000000
counterclockwise:0000000000
end

View File

@@ -1,3 +0,0 @@
TOTAL_STATION = 10
STRATEGY = SSTF
#end

View File

@@ -1,15 +0,0 @@
clock
counterclockwise 6
clock
clock
clock
clock
clock
clock
clock
clock
clock
clock
clock
clock
end

View File

@@ -1,99 +0,0 @@
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:0000010000
TIME:3
BUS:
position:2
target:0000000000
STATION:
clockwise:0000000000
counterclockwise:0000010000
TIME:4
BUS:
position:3
target:0000000000
STATION:
clockwise:0000000000
counterclockwise:0000010000
TIME:5
BUS:
position:4
target:0000000000
STATION:
clockwise:0000000000
counterclockwise:0000010000
TIME:6
BUS:
position:5
target:0000000000
STATION:
clockwise:0000000000
counterclockwise:0000010000
TIME:7
BUS:
position:6
target:0000000000
STATION:
clockwise:0000000000
counterclockwise:0000010000
TIME:8
BUS:
position:7
target:0000000000
STATION:
clockwise:0000000000
counterclockwise:0000010000
TIME:9
BUS:
position:8
target:0000000000
STATION:
clockwise:0000000000
counterclockwise:0000010000
TIME:10
BUS:
position:9
target:0000000000
STATION:
clockwise:0000000000
counterclockwise:0000010000
TIME:11
BUS:
position:10
target:0000000000
STATION:
clockwise:0000000000
counterclockwise:0000010000
TIME:12
BUS:
position:10
target:0000000000
STATION:
clockwise:0000000000
counterclockwise:0000000000
TIME:13
BUS:
position:10
target:0000000000
STATION:
clockwise:0000000000
counterclockwise:0000000000
end

View File

@@ -1,3 +0,0 @@
TOTAL_STATION = 10
DISTANCE = 3
STRATEGY = SCAN

View File

@@ -1,57 +0,0 @@
clock
clockwise 7
clockwise 2
clock
clock
clock
target 7
clock
clock
counterclockwise 7
clockwise 2
clock
clock
clock
clock
clock
clock
clock
clock
clock
clock
clock
clock
clock
clock
target 2
target 3
clock
clock
clock
clock
clock
clock
clock
clock
clock
clock
clock
clock
clock
clock
clock
clock
target 1
clock
clock
clock
clock
clock
clock
clock
clock
clock
clock
clock
clock
end

View File

@@ -1,344 +0,0 @@
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:0100001000
counterclockwise:0000000000
TIME:3
BUS:
position:2
target:0000000000
STATION:
clockwise:0100001000
counterclockwise:0000000000
TIME:4
BUS:
position:3
target:0000000000
STATION:
clockwise:0100001000
counterclockwise:0000000000
TIME:5
BUS:
position:3
target:0000001000
STATION:
clockwise:0000001000
counterclockwise:0000000000
TIME:6
BUS:
position:4
target:0000001000
STATION:
clockwise:0000001000
counterclockwise:0000000000
TIME:7
BUS:
position:5
target:0000001000
STATION:
clockwise:0100001000
counterclockwise:0000001000
TIME:8
BUS:
position:6
target:0000001000
STATION:
clockwise:0100001000
counterclockwise:0000001000
TIME:9
BUS:
position:7
target:0000001000
STATION:
clockwise:0100001000
counterclockwise:0000001000
TIME:10
BUS:
position:8
target:0000001000
STATION:
clockwise:0100001000
counterclockwise:0000001000
TIME:11
BUS:
position:9
target:0000001000
STATION:
clockwise:0100001000
counterclockwise:0000001000
TIME:12
BUS:
position:10
target:0000001000
STATION:
clockwise:0100001000
counterclockwise:0000001000
TIME:13
BUS:
position:11
target:0000001000
STATION:
clockwise:0100001000
counterclockwise:0000001000
TIME:14
BUS:
position:12
target:0000001000
STATION:
clockwise:0100001000
counterclockwise:0000001000
TIME:15
BUS:
position:13
target:0000001000
STATION:
clockwise:0100001000
counterclockwise:0000001000
TIME:16
BUS:
position:14
target:0000001000
STATION:
clockwise:0100001000
counterclockwise:0000001000
TIME:17
BUS:
position:15
target:0000001000
STATION:
clockwise:0100001000
counterclockwise:0000001000
TIME:18
BUS:
position:16
target:0000001000
STATION:
clockwise:0100001000
counterclockwise:0000001000
TIME:19
BUS:
position:17
target:0000001000
STATION:
clockwise:0100001000
counterclockwise:0000001000
TIME:20
BUS:
position:18
target:0000001000
STATION:
clockwise:0100001000
counterclockwise:0000001000
TIME:21
BUS:
position:18
target:0110000000
STATION:
clockwise:0100000000
counterclockwise:0000000000
TIME:22
BUS:
position:19
target:0110000000
STATION:
clockwise:0100000000
counterclockwise:0000000000
TIME:23
BUS:
position:20
target:0110000000
STATION:
clockwise:0100000000
counterclockwise:0000000000
TIME:24
BUS:
position:21
target:0110000000
STATION:
clockwise:0100000000
counterclockwise:0000000000
TIME:25
BUS:
position:22
target:0110000000
STATION:
clockwise:0100000000
counterclockwise:0000000000
TIME:26
BUS:
position:23
target:0110000000
STATION:
clockwise:0100000000
counterclockwise:0000000000
TIME:27
BUS:
position:24
target:0110000000
STATION:
clockwise:0100000000
counterclockwise:0000000000
TIME:28
BUS:
position:25
target:0110000000
STATION:
clockwise:0100000000
counterclockwise:0000000000
TIME:29
BUS:
position:26
target:0110000000
STATION:
clockwise:0100000000
counterclockwise:0000000000
TIME:30
BUS:
position:27
target:0110000000
STATION:
clockwise:0100000000
counterclockwise:0000000000
TIME:31
BUS:
position:28
target:0110000000
STATION:
clockwise:0100000000
counterclockwise:0000000000
TIME:32
BUS:
position:29
target:0110000000
STATION:
clockwise:0100000000
counterclockwise:0000000000
TIME:33
BUS:
position:0
target:0110000000
STATION:
clockwise:0100000000
counterclockwise:0000000000
TIME:34
BUS:
position:1
target:0110000000
STATION:
clockwise:0100000000
counterclockwise:0000000000
TIME:35
BUS:
position:2
target:0110000000
STATION:
clockwise:0100000000
counterclockwise:0000000000
TIME:36
BUS:
position:3
target:0110000000
STATION:
clockwise:0100000000
counterclockwise:0000000000
TIME:37
BUS:
position:3
target:1010000000
STATION:
clockwise:0000000000
counterclockwise:0000000000
TIME:38
BUS:
position:4
target:1010000000
STATION:
clockwise:0000000000
counterclockwise:0000000000
TIME:39
BUS:
position:5
target:1010000000
STATION:
clockwise:0000000000
counterclockwise:0000000000
TIME:40
BUS:
position:6
target:1010000000
STATION:
clockwise:0000000000
counterclockwise:0000000000
TIME:41
BUS:
position:6
target:1000000000
STATION:
clockwise:0000000000
counterclockwise:0000000000
TIME:42
BUS:
position:5
target:1000000000
STATION:
clockwise:0000000000
counterclockwise:0000000000
TIME:43
BUS:
position:4
target:1000000000
STATION:
clockwise:0000000000
counterclockwise:0000000000
TIME:44
BUS:
position:3
target:1000000000
STATION:
clockwise:0000000000
counterclockwise:0000000000
TIME:45
BUS:
position:2
target:1000000000
STATION:
clockwise:0000000000
counterclockwise:0000000000
TIME:46
BUS:
position:1
target:1000000000
STATION:
clockwise:0000000000
counterclockwise:0000000000
TIME:47
BUS:
position:0
target:1000000000
STATION:
clockwise:0000000000
counterclockwise:0000000000
TIME:48
BUS:
position:0
target:0000000000
STATION:
clockwise:0000000000
counterclockwise:0000000000
end

View File

@@ -1,4 +0,0 @@
# first come first serve
STRATEGY = FCFS
TOTAL_STATION = 10
DISTANCE = 2

View File

@@ -1,30 +0,0 @@
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

View File

@@ -1,176 +0,0 @@
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

View File

@@ -1,4 +0,0 @@
# first come first serve
STRATEGY = FCFS
TOTAL_STATION = 10
DISTANCE = 2

View File

@@ -1,30 +0,0 @@
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

View File

@@ -1,183 +0,0 @@
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

View File

@@ -1,4 +0,0 @@
DISTANCE = 4
STRATEGY = SCAN
TOTAL_STATION = 6
# scan serve

View File

@@ -1,34 +0,0 @@
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

View File

@@ -1,211 +0,0 @@
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

View File

@@ -1,4 +0,0 @@
DISTANCE = 4
STRATEGY = SCAN
TOTAL_STATION = 6
# scan serve

View File

@@ -1,26 +0,0 @@
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

View File

@@ -1,155 +0,0 @@
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

View File

@@ -1,4 +0,0 @@
TOTAL_STATION = 5
DISTANCE = 3
# shortest seek time first
STRATEGY = SSTF

View File

@@ -1,47 +0,0 @@
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

View File

@@ -1,260 +0,0 @@
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

View File

@@ -1,4 +0,0 @@
TOTAL_STATION = 5
DISTANCE = 3
# shortest seek time first
STRATEGY = SSTF

View File

@@ -1,42 +0,0 @@
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

View File

@@ -1,239 +0,0 @@
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

View File

@@ -1,3 +0,0 @@
TOTAL_STATION = 10
STRATEGY = SSTF
#end

View File

@@ -1,16 +0,0 @@
clock
clockwise 3
clockwise 10
clock
clock
clock
clock
clock
clockwise 2
clock
clock
clock
clock
clock
clock
end

View File

@@ -1,92 +0,0 @@
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:19
target:0000000000
STATION:
clockwise:0010000001
counterclockwise:0000000000
TIME:3
BUS:
position:18
target:0000000000
STATION:
clockwise:0010000001
counterclockwise:0000000000
TIME:4
BUS:
position:18
target:0000000000
STATION:
clockwise:0010000000
counterclockwise:0000000000
TIME:5
BUS:
position:19
target:0000000000
STATION:
clockwise:0010000000
counterclockwise:0000000000
TIME:6
BUS:
position:0
target:0000000000
STATION:
clockwise:0010000000
counterclockwise:0000000000
TIME:7
BUS:
position:1
target:0000000000
STATION:
clockwise:0110000000
counterclockwise:0000000000
TIME:8
BUS:
position:2
target:0000000000
STATION:
clockwise:0110000000
counterclockwise:0000000000
TIME:9
BUS:
position:2
target:0000000000
STATION:
clockwise:0010000000
counterclockwise:0000000000
TIME:10
BUS:
position:3
target:0000000000
STATION:
clockwise:0010000000
counterclockwise:0000000000
TIME:11
BUS:
position:4
target:0000000000
STATION:
clockwise:0010000000
counterclockwise:0000000000
TIME:12
BUS:
position:4
target:0000000000
STATION:
clockwise:0000000000
counterclockwise:0000000000
end

View File

@@ -1,3 +0,0 @@
TOTAL_STATION = 10
STRATEGY = SSTF
#end

View File

@@ -1,12 +0,0 @@
clock
clockwise 3
clock
clock
clockwise 2
clock
clock
clock
clock
clock
clock
end

View File

@@ -1,71 +0,0 @@
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:0010000000
counterclockwise:0000000000
TIME:3
BUS:
position:2
target:0000000000
STATION:
clockwise:0010000000
counterclockwise:0000000000
TIME:4
BUS:
position:3
target:0000000000
STATION:
clockwise:0110000000
counterclockwise:0000000000
TIME:5
BUS:
position:4
target:0000000000
STATION:
clockwise:0110000000
counterclockwise:0000000000
TIME:6
BUS:
position:4
target:0000000000
STATION:
clockwise:0100000000
counterclockwise:0000000000
TIME:7
BUS:
position:3
target:0000000000
STATION:
clockwise:0100000000
counterclockwise:0000000000
TIME:8
BUS:
position:2
target:0000000000
STATION:
clockwise:0100000000
counterclockwise:0000000000
TIME:9
BUS:
position:2
target:0000000000
STATION:
clockwise:0000000000
counterclockwise:0000000000
end

View File

@@ -1,37 +0,0 @@
import os
path = "SSTF/"
dict_path = path + "dict.dic"
in_path = path + "{}.in"
out_path = path + "{}.out"
dict_file = open(dict_path, "r", encoding="utf8")
dict_str = dict_file.read()
dict_file.close()
for i in range(1, 11):
dir_path = "{}/".format(i + 7)
input_path = dir_path + "input.txt"
output_path = dir_path + "output.txt"
dict_path = dir_path + "dict.dic"
os.mkdir("{}".format(i + 7))
in_file = open(in_path.format(i), "r", encoding="utf8")
out_file = open(out_path.format(i), "r", encoding="utf8")
input_file = open(input_path, "w", encoding="utf8")
output_file = open(output_path, "w", encoding="utf8")
dict_file = open(dict_path, "w", encoding="utf8")
input_file.write(in_file.read())
output_file.write(out_file.read())
dict_file.write(dict_str)
in_file.close()
out_file.close()
input_file.close()
output_file.close()
dict_file.close()

Binary file not shown.

Before

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 174 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

View File

@@ -1,159 +0,0 @@
# 代码规范
### 命名规则
#### 变量命名规则
**所有**的局部变量都使用小写的下划线命名法。
```C
int bus_position;
char* output_string
```
在变量命名时应注意尽可能简洁清晰,但在不能为了简洁而导致变量意义的不明。
错误示范:
```C
// DO NOT DO THIS:
lv_indev_drv_t indev_drv;
```
正确示范:
```C
lv_input_device_driver_t mouse_input;
```
> 本例子来自LVGL库。
>
> lv表示这个类型来自LVGL库input_device表示这个一个输入设备driver表示这是一个驱动后缀t表示这是一个类型。
#### 常量命名规则
采用`#define`定义的常量采用全大写下划线命名法
```C
#define MAX_STR_LENGTH 1000
```
#### 函数命名规则
**所有**函数采用驼峰命名法。
```C
int StrLength(char* str);
```
### 代码风格
#### 缩进
统一使用`tab`,四个空格的缩进。
```C
#include <stdio.h>
int main()
{
printf("缩进是四格。\n");
return 0;
}
```
> 这点一般不需要注意现在流行的IDE都是四格缩进。
#### 大括号
所有的大括号都需要提行书写。
```C
if()
{
}
for()
{
}
int main()
{
}
```
同时注意在代码中所有的代码块都需要用大括号包裹,即使是一行的情形。
```c
// DO NOT DO THIS
if(1)
printf("...");
// DO THIS
if(1)
{
printf("...");
}
```
### 注释
采用`Doxygen`风格的注释
> 在`VSCode`中安装`Doxygen Documentation Generator`这个扩展。
>
> ![](1.png)
>
> 方便使用下列的功能。
在函数,变量的**上一行**输入`/**`后回车来创建模板。
```C
/**
* @brief 在stdin打印一个字符串
*
* @param str 指向需要打印的字符串指针
*/
void print(char* str)
{
printf("%s", str);
}
```
```C
#include "example.h"
int main()
{
/**
* @brief 需要输出的字符串
*
*/
char* string = "Good morning!\n";
print(string);
return 0;
}
```
`@brief`的后面输入函数的作用简述,在`@param`的输入每个参数的意义, 在`@return`的后面输入返回值的意义。
`VSCode`中将指针悬停在函数上时就可以查看这个注释。
![](2.png)
其他的注释都应该放在需要注释行的上一行。
> 在`Doxygen`规范中,所有的注释都是注释下一行的代码。
在文件开头的注释**不做要求**,我感觉应该没有什么用。
> 这里推荐一个`VSCode`插件`GitLens`,可以方便的查看提交信息,~~便于在发现问题时锤人~~。
>
> ![](4.png)
### 杂项
- 函数中的局部变量不必在函数的头部统一命名,但是建议比较重要的变量在头部先声明,并且使用注释注明变量的作用
- 循环的变量一般情况下都在`for`语句中声明,不在循环以外的地方使用。但如果较为特殊的地方使用到,请使用注释表明。并且循环变量使用`i`,`j`,`k`
- `switch`语句中必须要有`default`的部分。
- 每行代码不超过80个字符。

View File

@@ -1,54 +0,0 @@
# 开发指北
> 遇到任何问题都可以问。
## 任务一
> 布置时间2022-4-29
### 终端(命令行)界面入门
#### 背景
我们在开发过程中需要用到的大部分工具都是以命令行交互为主,比如`cmake`, `gcc`,`git`;而且我们编译出来的应用也是在命令行界面中运行,所以掌握一些基本的命令是必要的。
#### 目标
掌握命令行界面的基础知识。
### Git入门
#### 背景
`git`是版本管理和团队合作的利器,掌握`git`的基本使用也是必要的。
#### 目标
克隆本次的大作业的项目仓库,并且进行**至少一次**提交。
> 可以在`main.c`文件中调用`printf`函数输出一些内容作为提交的内容。
### 模块入门
#### 背景
多模块编译是一个比较困难的部分,但是也是我们开发中十分有用的技能。
#### 目标
在项目中新建一个模块,包括头文件和源文件,在模块中设计实现一个简单的函数,并在`main.c`中调用。
### 概要设计
#### 背景
大作业有点难,不能只让我一个人抠脑壳,你们也得一起想。
#### 目标
设计完成函数原型,数据结构,全局常量。

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 175 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 216 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 364 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

View File

@@ -1,291 +0,0 @@
# 生产环境
> 遇到任何的问题都可以告诉我!!
## 软件安装
![](1.png)
`Program.zip`压缩包中有两个程序,分别是`cmake``VSCode`
这两个软件的安装都比较的简单。先解压缩文件,分别双击两个安装程序安装就可以了。在安装的过程应该只用无脑下一步。
> 在安装`VSCode`的过程中可能需要选择为”所有用户“还是”当前用户“安装,一般选择当前用户就可以了。
## 编译器的安装
编译器的安装算是比较复杂的。
首先解压缩`mingw64.zip`这个压缩包,然后把这个文件夹放在一个**你自己记得到**而且**文件路径中间没有空格没有中文没有什么奇奇怪怪字符**的地方。
> 这里表示把工具添加进入环境变量,我们就不用再运行程序的时候指定程序所在的位置,系统会根据我们提供的名称在我们指定的路径下去搜索可执行的程序。
然后同时按下`win``s`组合键,打开搜索面板,搜索`环境变量`,选择`编辑系统环境变量`
![](2.png)
打开这个界面
![](3.png)
点击右下方的`环境变量...`,打开下面的界面
![](4.png)
我的界面可能和你们的看起来相当的不一样,尤其是里面的内容。
选中上面那一块区域,也就是“用户变量”中的`path`,就像下图所示
![](5.png)
然后点击中间那三个按钮中的“编辑”,打开下一个界面
![](6.png)
> 可能我们的界面看起来相当的不一样,我设置了相当数量的环境变量,这也侧面说明了设置这个是非常重要的(
点击右侧的“新建”按钮,
![](7.png)
然后再点击右边的“浏览”按钮,
![](8.png)
选择到之前解压的编译器路径下,指向`bin`文件夹。
![](9.png)
点击确定。
然后再次点击右侧的“新建”-“浏览”,但是这次选择`C:\Program Files\cmake\bin`这个文件夹,然后一路点击确定。
编译器的安装就算是结束了。
## 测试环境的安装
现在将第三个压缩包`auto_drived_bus.zip`解压到你打算写代码的地方,这个地方的路径同样需要具有**没有中文没有空格没有什么奇奇怪怪的字符**的buff。
然后打开`VSCode`,选择打开文件夹,打开刚才解压的那个文件,现在界面应该是这样的。
![](10.png)
然后按下`ctrl``~`组合键,打开终端。
![](11.png)
依次输入下列三条命令
```bash
cd build
```
```bash
cmake .. -G "MinGW Makefiles"
```
```bash
cmake --build .
```
> 在输入的时候不要遗漏了`.`这类符号。
![](12.png)
![](13.png)
然后输入
```bash
bus.exe
```
![](14.png)
说明everything works well。
## 原理的简单解释
### 多文件编译
在之前的学习中我们接触的都是单文件的编译
```bash
gcc example.c -o example.exe
```
在上面的命令中`gcc`是编译器,`example.c`是源文件,`example.exe`是编译之后生成的可执行文件。
但是如果我们现在是多文件编译呢?我们假设现在有两个文件`lib.c``main.c`,`lib.c`是一个库的源文件,里面有一些函数是我们需要的,我们会在`main.c`中调用这些函数。
那现在我们需要解决两个问题:
- `main.c`文件中没有`lib.c`中编写函数的定义
- 如何才能将两个文件编译为一个可以运行的可执行文件
对于第一个问题,我们使用头文件来解决,`lib.h`这个头文件中就包含了在`lib.c`中编写的所有函数的声明,当我们在`main.c`文件中添加
```C
#include "lib.h"
```
之后,我们就可以在`main.c`文件中愉快的使用`lib.c`中的函数了。
对于第二个问题,我们使用一种名叫“链接”的方法解决
```bash
gcc lib.c -o lib.o # 生成lib.c对应的可执行文件
gcc main.c -o main.o # 生成main.c对应的可执行文件
gcc mian.o lib.o -o main.exe # 将两个可执行文件链接在一个生成一个可执行文件
```
> 我们常常使用的`stdio.h`等的头文件对应的可执行文件通过差不多的原理实现的。
然后我们假设一下,如果我们的文件数一多,编译起来要输很多行代码,是不是就很崩溃!
然后我们使用了`cmake`工具。这是一个跨平台的编译工具,~~用过的人都说好~~。
我们只用在`CMakeLists.txt`这个文件中一次写明我们需要使用的文件,就可以一直套用这个模板编译软件。
```bash
cmake .. -G "MinGw Makefiles"
```
这一行的命令表示在我们目前所在的`build`文件夹中生成用于构建程序的一些文件,`..`是一个指针,指向当前文件的上一级目录,也就是`CMakeLists.txt`以及我们程序源代码所在的地方,`-G "MinGw Makefiles"`表示的是生成的文件是我们使用的编译器`mingw64`可以识别的格式。
```bash
cmake --build .
```
这一行是用我们刚刚生成的生成文件调用编译器生成可执行文件,`.`也是一个指针,它指向当前目录。
注意,如果在之后我们没有修改过`CMakeLists.txt`文件,那我们每次修改了源代码之后就只用执行
```bash
cmake --build .
```
来重新生成可执行文件;
如果我们修改了`CMakeLists.txt`文件,我们就需要在执行
```bash
cmake ..
```
来重新生成那个辅助文件。
> 这里我们不用加上 `-G "MinGw Makefiles"` ,编译器只用指定一次。
### 在工程的实际
在初步了解了相关的知识之后,我们就可以开始把他们运用在工程中了。
我们的实际项目结构如下
![](22.png)
`include`目录下是我们各个模块的头文件,现在的示例是`print`模块的`print.h`,而这个模块的源文件是在`src`目录下的`print.c`文件。
`src`目录下就是我们当前各个模块和主程序的源代码文件。
> CMakeLists.txt由我编写我会写上比较详尽的注释你们可以观摩。
那我们第一阶段的架构设计实际上就是头文件的编写。为啥?头文件包括我们各个模块中需要使用的函数的定义,在项目中会使用到的结构体、自行定义的类型等的都会写在我们的头文件里面,实际上,编写头文件的过程就是架构设计的过程。
在编写完成我们的头文件之后,我们只需在对应的源文件中实现相关的函数,我们的开发就算是完成了。
## VSCode的配置
### 安装扩展
为了能在`VSCode`中流畅的写`C\C++`,我们需要在`VSCode`中安装几个插件。
`VSCode`的主界面上选择“插件”图标,也就是右侧的最后一个
![](15.png)
> 图中的最下面那个图标
打开这个界面
![](16.png)
在搜索栏中只用数一个字母`C`
![](17.png)
选择这个`C/C++ Extension Pack`,这是一个辅助`C/C++`编写的扩展的合集,只用安装这个扩展我们就可以愉快~~并不~~的在`VSCode`中写代码了。
> 如果对`VSCode`的全英文界面感到不适,也可以搜索`Chinese`,安装简体中文的扩展包。
### 加载CMake项目
`VSCode`中也有扩展提供了对于`Cmake`的支持,让我们可以不用在一次次的输入命令来编译。
在安装完扩展之后,我们重新启动`VSCode`,再次打开我们的工程文件夹,这个时候左下角应该会弹出来一个气泡,
![](18.png)
这个气泡就是`cmake`插件在询问你是否设置这个名为`auto_drived_bus`的工程,我们选择"Yes" 这时`cmake`扩展就会使用系统中安装的`cmake`来设置我们的项目。
![](19.png)
这时在我们`VSCode`底部的状态栏就会出现一些`cmake`的选项,我们逐个来看
![](20.png)
第一个表示`cmake`目前使用的是`debug`模式,我们可以点击切换不同的生成模式
![](21.png)
第二个表示我们当前使用的编译器,如果我们在电脑上安装了不同的编译器,例如微软的`msvc`就可以在点击切换,当然,这里切换不仅是编译器的选项,生成的编译文件也从`makefile`变成了`vcporj`
第三个按钮`build`是编译按钮,点击这个按钮就会生成可执行文件。
第四个按钮`all`是选择生成的对象,在一般情况下不用改动。
> 在这里我们的生成对象主要有两个,一个是我们的库,另一个是我们的主程序。
第五六个是两个按钮,长得像虫一样的那个表示调试按钮,说明这是用来抓`bug`的,下一个的那个就是一个简单的运行按钮,点一下就会自动开始编译运行。
> 我们也可以使用一些快捷键来代替上面的一些东西,比如`F5`表示运行,`ctrl`和`F5`同时按表示运行,按`F7`表示编译。
> 我这边的建议是使用`F7`编译之后再在终端中执行这样和OJ上的执行比较的近似。
## 下一步...
### 关于Git
再实际使用Git之前先推荐这篇MIT的英文教程[VERSION CONTROL](https://missing.csail.mit.edu/2020/version-control/)这边文章没有像一般的Git教程一样扔给你一大堆的命令而是介绍了Git的原理我觉得这样可能更加易懂。
> 如果看英文有困难,可以看这个[翻译版](https://missing-semester-cn.github.io/2020/version-control/)
如果黄海还不发`Gitlab`的文档的话,我就会打算在`gitee`上建立仓库开始干活了,我们在实践中学习`git`
> 高情商:在实践中学习
>
> 低情商:你们自己摸索
### 关于typora
`markdown`撰写文档是我一直的习惯用word写东西实在不是碳基生物能干的活。不过由于我们需要叫word格式的文档我结合`markdown``word`的效果和大家的意见在做决定。
> 最后再次强调,有什么问题一定要问!!
## 写在最后
你们可能嫌我为啥要搞这么麻烦,为啥不直接简简单单的一个文件和`Dev C++`开发了事。
我当时想的是既然这是一次“大作业”,而且黄海也反复强调“软件工程”,那我们不如好好的体验一下“现代”的`C/C++`开发是什么样子的。
我最开始的想法仅仅是统一用`VSCode`进行开发,但是使用`VSCode`进行开发涉及到一个比较麻烦的环境配置问题。为了确保只用配置一次环境之后就可以在不同的电脑上获得流畅的编码体验,我就使用现在流行的`Cmake`工具进行统一的环境配置。
使用这个工具的好处有以下几点:
- 不必关心比较复杂的`VSCode`设置
- 可以进行比较舒适的模块化开发,避免的繁琐的编译
- 便于后期引入图形库进行图形界面的开发
- `CMake`是现在`C/C++`项目开发的事实标准。

View File

@@ -1,498 +0,0 @@
# 公交车调度说明OJ版
## 站点说明
环形轨道,一辆车,车辆可以双向任意行驶。我们规定**车辆的原始位置为0**(该位置**也是车站1的位置**按顺时针方向每个单位位置坐标加1。如果轨道总长为10则按顺时针方向走位置9的下一个为位置0。车站编号同理也是按顺时针方向依次递增。**车速固定,每秒一个单位**。停车接人或乘客下车时需要**停车一秒钟**。无论一次停站完成几个服务停留时间统一为1秒钟。各站之间距离相等车辆经过站点时根据调度策略车辆可以停也可以不停。其他位置不允许停车。车辆只能在站点停站时才能改变行驶方向。
## 配置文件
各站之间距离可配置,站点个数可配置,调度策略可配置。这三个参数保存在配置文件中,程序要通过读配置文件获取。**配置文件的名字为`dict.dic`**。
配置文件为**文本文件**,以#号开头的行是注释,井号只可能出现在每一行的开头。
每行一个参数,格式为:
参数 = 值
的形式。每个参数前无空格,参数名、等号、参数值用空格分隔。
其中参数有三个即TOTAL_STATION代表**站点总数为大于1且小于等于20的整数**DISTANCE代表**每站之间的距离为大于0且小于6的整数**STRATEGY代表调度策略只能是FCFS先来先服务SSTF最短寻找时间优先
SCAN顺便服务之一。
另外:
1、如果某个参数没有出现在配置文件中则该参数取缺省值。
三个参数的缺省值如下:
```
TOTAL_STATION = 5
STRATEGY = FCFS
DISTANCE = 2
```
2、**三个参数在文件中的顺序没有规定**。
3、显然**TOTAL_STATION与DISTANCE乘积就是轨道总长度**,所以配置文件中没有这个参数。
## 输入格式
若干行,每行一个指令。
指令共5种。分别为end、clock、counterclockwise、clockwise 和target。
**其中end是程序退出指令不是停运指令是时钟停止程序退出的意思只在最后一行出现一次**
clock是时钟指令每出现一次代表过了一秒钟
counterclockwise、clockwise、target为请求指令如果它们出现同一行内后边一定有一个整数。如果是counterclockwise和clockwise代表站台上的请求后边的整数代表请求发生的站点号counterclockwise表示逆时针方向乘车请求clockwise代表顺时针方向乘车请求。如果是target代表车厢内下车请求后边的整数代表要去的站点号。
## 输出格式
程序开始,**先输出一次初始状态**,然后**每个clock输出一次当前状态**;程序**退出时输出end**。每次输出的格式如下冒号后面没有空格最后一次输出end后有一个换行。
> **TIME:秒数**
>
> **BUS:**
>
> position:0
>
> target:0000000000
>
> STATION:
>
> clockwise:0000000000
>
> counterclockwise:0000000000
>
**首先输出当前的时间,即已过的秒数。**
然后三行代表车辆BUS:固定不变position:固定不变后边的数字代表当前车辆位置target:固定不变后边一排数字依次代表车内站点请求情况0表示没有请求1表示有请求。
最后三行代表各站点的状态,
STATION: 固定不变,
clockwise:固定不变后边的数字依次代表各站点顺时针方向的请求情况0表示没有请求1表示有请求。
counterclockwise:固定不变后边的数字依次代表各站点逆时针方向的请求情况0表示没有请求1表示有请求。
具体可参考输入样例。
## 策略补充说明
1. 公交车在没有任何请求时,留在当前位置静止不动,处于空闲状态;只有收到上车或下车请求,确定服务目标后,才进入行驶状态。
2. 每一个请求均为单独的服务,即车内请求与站台请求没有必然联系。
3. 当公交车在空闲状态,或者完成上次请求 (到达目标站点并停满1秒)后开始一次新的调度。调度时以之前收到的请求以及当前1秒内新发生的所有请求作为候选按照调度规则选择出目标请求整个调度过程执行时间忽略不计即公交车在1秒的最开始完成上述所有动作然后立即服务目标请求。
4. 当车服务目标时要选择路程短的方向行驶,如果两个方向路程相同则选择顺时针方向;
5. 如果在某个请求没有完成时再有相同的请求(请求类型和站点全部相同)发生,则该请求被抛弃。如果已完成的请求再次发生时应按新请求处理。
6. 对于先来先服务策略车一次停站只完成一个请求即使在这个站点上即有乘车请求车内也有到该站的请求也只能按策略完成已经调度的那个请求。但是完成当前请求后如果发现时间序列上后续的一个或多个连续请求都恰好在同一站点即连续的同站点请求位置相同但请求类型不同则可以立即完成这些连续的同站点请求也就是说特殊情况下一次停车的1秒内可完成多个请求。
7. 对于最短寻找时间优先策略一次服务的目标请求一旦确定即使中途产生更优的请求也不可以更改。但如果新的请求恰好可以顺便服务同方向的站台请求或车内请求可以为新的请求停站。具体为程序计算离当前车的位置最近的请求如果没有请求则原地不动否则按最近的路线顺、逆时针去接。如果车途中遇到与车目前同方向的上车或下车请求可以停下一秒解决反方向的上车请求不停车。车服务完目标后反复此过程直到end。特别地当车到达目标站点时可以停一次车(1秒钟)完成该站点已接收的所有类型请求(区别于顺便站停靠)。
8. 对于顺便服务策略。第一次行驶方向由时间最短请求站点决定。确定方向后,每次调度都按照当前方向,选择寻找时间最短的请求(不区分类型或方向)作为服务目标。如果去往服务目标站点行驶的距离超过轨道一半时,则需要切换行驶方向服务该请求。车辆行驶过程中,如果经过的站点有服务请求(上车或下车)则不管这个请求的类型或方向一律停站并完成此请求。这意味着一次停车可能同时完成3个服务请求(上车(顺时、逆时)和下车)。车辆没有请求时则原地不动,直到有新的请求时再按照上述规则继续运行。
9. 对于后两种策略(最短寻找时间、顺便服务),如果车辆途经某站点本没有停车计划,则新的请求只要在车辆到达该站点前产生,就能允许停车服务。
10. 车处于停止状态开始一次新调度时空闲状态或者完成上一次服务后如果本站有请求且根据规则可以为该请求服务则该请求立即完成不再停1秒钟。
### 不保熟的策略详细说明
**1调度策略配置**
公交车的调度策略只有如下三种:
a先来先服务策略FCFS所有请求按照发出时间先后顺序来逐一完成
b最短寻找时间优先策略SSTF每次寻找完成时间最短即距公交车位置最近的请求并完成。
c顺便服务策略SCAN依照车辆行驶方向来完成请求车辆行驶方向按照要求进行改变。
在默认情况下我们设置调度策略为先来先服务策略FCFS
**2策略详细说明**
a先来先服务策略FCFS
按照请求先后顺序来逐一完成,即谁请求在前,谁先执行。
> 就是按照文件输入中指令的先后顺序来执行
站点请求的顺逆方向对请求执行顺序无影响,车辆在完成请求时按照距离最近原则来选择行驶方向。
> 总共五站点公交车在2站点完成请求后下一请求是到达3站点则选择顺时针方向行驶而不是逆时针
在这种策略下,车一次停站只完成一个请求。
> 也就是说按照指令先后顺序来执行,在相邻请求所要求站点不同的情况下,车一次停站也就只能完成一个请求,即使在该站点有多个请求。
但是如果下一个请求恰好在同一站点则可以一次停站完成2个或2个以上的请求。
> 在相邻请求所要求站点相同的情况下可以完成多个请求例如公交车接下来请求分别是在clockwise2, counterclockwise2, target3则公交车到达2站点后可以一次性完成3个请求
>
> 请求之前夹杂着的clock指令无影响
b最短寻找时间优先策略SSTF
每次按照完成时间最短(即距离最近)来完成相应请求。
程序计算离当前车的位置最近的target、counterclockwise、clockwise请求
> 与先来先服务策略不同这种策略的执行顺序主要依靠公交车的当前状态即当前状态targetclockwise,counterclockwise中的请求判断哪一个请求离公交车当前位置最近然后执行
如果都没有请求则原地不动否则按最近的路线顺、逆时针去接直至完成请求。反复此过程直到end。
一次服务的请求(目标)一旦确定,即使中途产生更优的请求也不可以更改。
> 请求只能一个一个地完成,中途不能更改当前正在执行的请求
但如果新的请求恰好可以顺便服务,即如果车途中遇到与车目前同方向的上车请求或下车请求可以停下一秒解决,反方向的上车请求忽略。
当车到达目标地点时该站点恰好有两个相反的请求可以停一次车完成这2个服务。
>该站点有多个请求时,到达该站点之后可以同时完成
>
>与顺便服务不同在去往目标站点的行驶过程中如果有关于目标站点的新请求出现时则不必要求其一定要在到达目标站点前起码1秒钟前提出例如公交车当前目标是行驶到3站点如果车在到达3站点之后立刻有一个关于3站点的另一个新请求则这几个请求可以一起完成。
c顺便服务策略SCAN
依照车辆行驶方向来完成请求,可以顺便服务(对车辆行驶方向无要求)。
> 与SSTF不同这个策略中的顺便服务不会判断站台请求要求的方向与车辆行驶方向是否相同
第一次行驶方向由第一个请求出现后1秒钟内全部请求中时间最短即距离最短的那个请求决定。在行使过程中如果所有的请求按照当前的行驶方向找出的最短完成时间都超过跑完轨道一半距离时间时应该切换行驶方向。这是唯一的一个切换方向的规则。
> 分析:在确定最初行驶方向后,车辆切换方向有且仅有一种可能,即在当前请求完成之后再去改变方向。因为在车辆行驶至目标站点的过程中,其与目标站点的距离一定小于等于轨道总长度的一半,所以不能切换方向
>
> 每次执行完一次操作后都要判断当前行驶方向是否满足要求,不行就切换方向
车辆行驶过程中如果经过的站点有服务请求则不管这个请求的类型一律停站并认为此请求完成。这意味着一次停车可能完成3个服务。
> 公交车可以到达目标站点后一次性完成所有请求
**3策略补充说明**
a每一个请求均为单独的服务就是说车内请求与站台请求没有必然联系。
b在寻找时间最短即距离最近的请求时如果两个方向路程相同则选择顺时针方向。
c如果在某个请求没有完成时再有相同的请求发生则该请求被抛弃。如果已完成的请求再次发生时应按新请求处理。
d对于SSTF和SCAN策略如果车辆在某站点本没有停车计划新的请求要至少要提前1秒钟产生才能享受顺便服务忽略到达该请求地时再提出的请求。
## 样例
> 配置参数为TOTAL_STATION = 10、STRATEGY = FCFS、DISTANCE = 3
### 输入样例
clock
counterclockwise 3
clock
clock
clock
clock
clock
clock
target 10
clock
clock
clock
clock
clock
clock
clock
clock
clock
clock
clock
end
### 输出样例
**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

22
include/BusFCFSStrategy.h Normal file
View File

@@ -0,0 +1,22 @@
//
// Created by ricardo on 2022/6/27.
//
#ifndef AUTO_BUS_GUI_BUS_FCFS_STRATEGY_H
#define AUTO_BUS_GUI_BUS_FCFS_STRATEGY_H
#include "BusStrategyBase.h"
/**
* 实现先来先服务策略的控制器类
*/
class BusFCFSStrategy : public BusStrategyBase
{
int GetBusDirection() override;
bus_query_t *GetTargetQuery() override;
bus_query_t *HandleBTWQuery() override;
};
#endif //AUTO_BUS_GUI_BUS_FCFS_STRATEGY_H

23
include/BusSCANStrategy.h Normal file
View File

@@ -0,0 +1,23 @@
//
// Created by ricardo on 2022/6/27.
//
#ifndef AUTO_BUS_GUI_BUS_SCAN_STRATEGY_H
#define AUTO_BUS_GUI_BUS_SCAN_STRATEGY_H
#include "BusStrategyBase.h"
/**
* 实现顺便服务策略的控制器类
*/
class BusSCANStrategy : public BusStrategyBase
{
int GetBusDirection() override;
bus_query_t *GetTargetQuery() override;
bus_query_t *HandleBTWQuery() override;
};
#endif //AUTO_BUS_GUI_BUS_SCAN_STRATEGY_H

22
include/BusSSTFStrategy.h Normal file
View File

@@ -0,0 +1,22 @@
//
// Created by ricardo on 2022/6/27.
//
#ifndef AUTO_BUS_GUI_BUS_SSTF_STRATEGY_H
#define AUTO_BUS_GUI_BUS_SSTF_STRATEGY_H
#include "BusStrategyBase.h"
/**
* 实现最短寻找时间策略的控制器类
*/
class BusSSTFStrategy : public BusStrategyBase
{
int GetBusDirection() override;
bus_query_t *GetTargetQuery() override;
bus_query_t *HandleBTWQuery() override;
};
#endif //AUTO_BUS_GUI_BUS_SSTF_STRATEGY_H

142
include/BusStrategyBase.h Normal file
View File

@@ -0,0 +1,142 @@
//
// Created by ricardo on 2022/6/27.
//
#ifndef AUTO_BUS_GUI_BUS_CONTROLLER_BASE_H
#define AUTO_BUS_GUI_BUS_CONTROLLER_BASE_H
#include "QObject"
#include "QString"
#include "QTimer"
#include "railsModel.h"
#include "queryModel.h"
#include "busModel.h"
#include "Settings.h"
/**
* 策略控制基类
*/
class BusStrategyBase : public QObject
{
Q_OBJECT
public:
/**
* 轨道模型
*/
RailsModel *rails_model;
/**
* 请求模型
*/
QueryModel *query_model;
/**
* 公交车模型
*/
BusModel *bus_model;
/**
* 当前的计时时刻
*/
int bus_tick;
/**
* 当前的处理策略
*/
int strategy;
BusStrategyBase();
~BusStrategyBase() override;
/**
* 获得当前公交车应该前进的方向
* @return 公交车前进的方向
*/
virtual int GetBusDirection() = 0;
/**
* 获得公交车在当前指定的策略下应该处理的请求
* @return 请求指针
*/
virtual bus_query_t *GetTargetQuery() = 0;
/**
* 获取公交车现在可以顺便处理的请求
* @return 请求指针
*/
virtual bus_query_t *HandleBTWQuery() = 0;
signals:
/**
* 删除请求信号
* @param query 需要删除请求的指针
*/
void DeleteQuerySignal(int query_type, int node_id);
/**
* 打印状态信号
* @param string 状态字符串
*/
void PrintStateSignal(QString string);
/**
* 运行公交车的信号
* @param direction 公交车前进的方向
* @param duration 前进需要的时间
*/
void BusRunningSignal(int direction, int duration);
public slots:
/**
* 添加请求的槽函数
* @param query_type 请求的类别
* @param node_id 请求的站点ID
*/
void AppendQuerySlot(int query_type, int node_id);
/**
* 处理开始事件的槽函数
*/
void BusBeginSlot();
/**
* 处理结束事件的槽函数
*/
void BusEndSlot();
/**
* 处理tick事件的槽函数
*/
void OneTickSlot(int remaining_time);
/**
* 处理到站事件的槽函数
*/
void OnStopSlot();
private:
/**
* 储存当前的状态
*/
int status = BUS_END;
/**
* 打印当前状态
* @return 表示当前状态的字符串
*/
QString PrintState(int remaining_time) const;
/**
* 决定公交车状态的函数
*/
void DetermineBusStatus();
/**
* 处理请求
*/
void HandleQuery();
};
#endif //AUTO_BUS_GUI_BUS_CONTROLLER_BASE_H

83
include/BusWidget.h Normal file
View File

@@ -0,0 +1,83 @@
//
// Created by ricardo on 2022/6/28.
//
#ifndef AUTO_BUS_GUI_BUS_WIDGET_H
#define AUTO_BUS_GUI_BUS_WIDGET_H
#include "QGraphicsPixmapItem"
#include "QTransform"
#include "QPropertyAnimation"
#include "PosPair.h"
#include "define.h"
/**
* 显示公交车的对象
* 继承了QObject QGraphicsPixmapItem
* 用以使用qt的动画框架
*/
class BusItem: public QObject, public QGraphicsPixmapItem
{
// 调用这个宏使其qt对象化
Q_OBJECT
// 注册了一个QPointF类型的变量pos
// 读取这个变量通过 pos()函数
// 写入这个变量通过 setPos()函数
Q_PROPERTY(QPointF pos READ pos WRITE setPos)
public:
explicit BusItem(const QPixmap& pixmap);
};
/**
* 公交车显示动画控制类
*/
class BusWidget
{
public:
/**
* 真正的公交车显示对象
*/
BusItem *item;
explicit BusWidget();
~BusWidget();
/**
* 重置公交车
* @param s 位置对数组的头指针
* @param num 站点数目
*/
void ResetBusPos(PosPair *s, int num);
/**
* 开始公交车动画
* @param direction 动画的方向
* @param duration 动画持续的时间 ms
*/
void StartAnimation(int direction, int duration);
private:
/**
* 存储各个站点位置对的数组
*/
PosPair *pos_pairs = nullptr;
/**
* 动画对象
*/
QPropertyAnimation *animation;
/**
* 公交车所在的站点
*/
int pos = 0;
/**
* 站点总数
*/
int node_num = 0;
};
#endif //AUTO_BUS_GUI_BUS_WIDGET_H

80
include/PosPair.h Normal file
View File

@@ -0,0 +1,80 @@
//
// Created by ricardo on 2022/6/28.
//
#ifndef AUTO_BUS_GUI_POSPAIR_H
#define AUTO_BUS_GUI_POSPAIR_H
/**
* 储存每个站点位置的类
*/
class PosPair{
public:
/**
* 设定的轨道开始坐标x
*/
static const int stop_begin_x = 100;
/**
* 设定的轨道开始坐标y
*/
static const int stop_begin_y = 80;
/**
* 轨道的宽度
*/
static const int stop_rail_width = 300;
/**
* 轨道的高度
*/
static const int stop_rail_height = 200;
/*
* 站点位置的x坐标
*/
int pos_x;
/**
* 站点位置的y坐标
*/
int pos_y;
PosPair();
/**
* 获取两个站点之间的距离
* @param stop_number 站点的数量
* @return 站点之间的距离
*/
static int GetStopSpaceLength(int stop_number) ;
/**
* 加上一定的距离
* @param length 需要加上的距离
*/
void AddLength(int length);
/**
* 获得该站点公交车停车的位置x坐标
* @return
*/
int GetBusPosX() const;
/**
* 获得该站点公交车停车位置的y坐标
* @return
*/
int GetBusPosY() const;
private:
/**
* 公交车到站点的距离
*/
const int stop_bus_distance = 30;
int distance = 0;
};
#endif //AUTO_BUS_GUI_POSPAIR_H

19
include/Settings.h Normal file
View File

@@ -0,0 +1,19 @@
//
// Created by ricardo on 2022/7/1.
//
#ifndef AUTO_BUS_GUI_SETTINGS_H
#define AUTO_BUS_GUI_SETTINGS_H
/**
* 设置控制类
*/
class Settings
{
public:
/**
* 设置每一tick的持续时间
*/
const static int tick = 2000;
};
#endif //AUTO_BUS_GUI_SETTINGS_H

Some files were not shown because too many files have changed in this diff Show More