├── .gitignore ├── project └── project.exe ├── .idea ├── untitled.iml ├── misc.xml ├── .gitignore ├── vcs.xml └── modules.xml ├── CMakeLists.txt ├── main.cpp ├── README.md ├── Optimization.h ├── Optimization.cpp ├── LICENSE └── flowshop-test-10-student.txt /.gitignore: -------------------------------------------------------------------------------- 1 | # 项目排除路径 2 | /cmake-build-debug/ 3 | /cmake-build-release/ 4 | /.idea/ 5 | -------------------------------------------------------------------------------- /project/project.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gzh0821/Optimization_project/HEAD/project/project.exe -------------------------------------------------------------------------------- /.idea/untitled.iml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # 默认忽略的文件 2 | /shelf/ 3 | /workspace.xml 4 | # 基于编辑器的 HTTP 客户端请求 5 | /httpRequests/ 6 | # Datasource local storage ignored files 7 | /dataSources/ 8 | /dataSources.local.xml 9 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.22) 2 | project(Optimization_project) 3 | 4 | set(CMAKE_CXX_STANDARD 17) 5 | set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libstdc++ -static-libgcc") 6 | 7 | add_executable(Optimization_project main.cpp Optimization.h Optimization.cpp) 8 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /main.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Gzh0821/Gaozih 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "Optimization.h" 16 | #include 17 | #include 18 | #include 19 | //主函数 20 | using namespace std; 21 | using namespace chrono; 22 | 23 | int cal_func(Solution &&s, int compare_ans) { 24 | auto startTime = system_clock::now(); 25 | int ans = s.SA(make_tuple(250, 5, 0.95, 25));//SA算法,参数设置分别为起始温度,温度阈值,退火速度和允许相同数 26 | //int ans = s.HCS();//HCS算法 27 | auto endTime = system_clock::now(); 28 | if (ans <= compare_ans) {//若结果比上一次优,输出 29 | cout << ans << endl; 30 | for (auto &i: s.next_order) 31 | cout << i << ','; 32 | cout << endl << "Time:" << duration_cast(endTime - startTime).count() << endl;//时间 33 | } 34 | return min(ans, compare_ans); 35 | } 36 | 37 | int main(int argc, char *argv[]) { 38 | int id, last_ans = INT_MAX; 39 | if (argc == 1) 40 | cin >> id; 41 | else 42 | id = strtol(argv[1], nullptr, 10); 43 | Solution sol; 44 | sol.setup(id);//设置id 45 | auto startTime = system_clock::now(); 46 | for (int i = 0; i < 20; ++i) { 47 | Solution s(sol);//复制构造Solution对象 48 | last_ans = cal_func(move(s), last_ans);//计算 49 | } 50 | auto endTime = system_clock::now(); 51 | cout << endl << "TotalTime:" << duration_cast(endTime - startTime).count() << endl;//输出总时间 52 | cout << "Press any button to exit." << endl; 53 | } 54 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SA and HCS Optimization Project 2 | 3 | 一个使用模拟退火算法和登山算法解决流水车间调度问题的最优化实验。 4 | 5 | 基于`C++ 17`标准库。 6 | 7 | ![](https://img.shields.io/badge/author-Gaozih-%2366ccff) 8 | ![](https://img.shields.io/github/license/Gzh0821/Optimization_project) 9 | ![](https://img.shields.io/github/stars/Gzh0821/Optimization_project) 10 | 11 | 12 | ## 简介 13 | - 本项目来源于最优化方法课程的大作业。 14 | 15 | - 本项目实现了使用`HCS`(登山算法)和`SA`(模拟退火算法)解决流水车间调度问题。 16 | 17 | - 仅使用C++17标准库,可直接编译运行。 18 | 19 | - 代码重要处均附有注释,易于复现和修改。 20 | 21 | ## 项目结构 22 | - `Optimization.h`为项目头文件,包含解决方案类声明,算法参数格式声明和随机数生成器。 23 | - `Optimization.cpp`为项目解决方案文件,包含`SA`算法,`HCS`算法的实现及文件预处理方法。 24 | - `main.cpp`为主文件,包含项目入口`main`函数和调用算法的`cal_func`函数。 25 | 26 | ## 选择数据集 27 | - 本项目使用给出的数据集`flowshop-test-10-student.txt`,包含11组原始数据。 28 | - 执行程序时,需输入数字0-10选择要处理的数据组。 29 | - 或调用程序时直接输入数字参数。 30 | 31 | ## 简易的复现 32 | ### 直接运行 33 | - 本项目已使用默认参数(SA算法,起始温度=250,温度阈值=5,退火速度=0.95,允许相同数=2),重复20次, 34 | 构建了`exe`可执行文件(`Windows`平台),可在`project`目录下,打开`cmd`命令行窗口,输入`.\project.exe`运行程序。 35 | 36 | ### 使用CMake构建(建议) 37 | - 使用项目内`CMakeLists.txt`配置文件即可。 38 | 39 | ### 使用GNU-g++ 40 | 41 | - 使用g++编译文件。 42 | ``` 43 | g++ main.cpp Optimization.cpp -O3 -std=c++17 -o Test.exe 44 | ``` 45 | - 将生成的`Test.exe`置入项目的`project`目录下,并在`project`目录下打开命令行窗口,输入`.\Test.exe`运行程序。 46 | 47 | ## 计算结果 48 | - 程序会打印每次算出的最优(最短时间)结果,仅需查看最后一次输出的结果即可。 49 | - 输出结果格式如下(以第0组数据为例): 50 | ``` 51 | 7038 52 | 7,4,8,2,6,1,0,3,10,9,5, 53 | Time:59 54 | ``` 55 | - 第一行为计算出的最短时间,即工件最优顺序的总加工时间为7038。 56 | - 第二行为此时间对应的工件加工顺序。工件编号按原始数据顺序。从0号开始。 57 | - 第三行为此次计算所耗费的时间,单位为毫秒(ms)。 58 | 59 | ## 修改算法和参数 60 | - 若需修改每次执行程序时算法的执行次数,只需修改`main.cpp`中的`main`函数: 61 | ```cpp 62 | for (int i = 0; i < 20; ++i) { 63 | Solution s(sol);//复制构造Solution对象 64 | last_ans = cal_func(move(s), last_ans);//计算 65 | } 66 | ``` 67 | - 将`i < 20`中的20修改为需要的值即可。 68 | --------- 69 | - 若需修改使用的算法或参数,只需修改`main.cpp`中的`cal_func`函数: 70 | ```cpp 71 | int ans = s.SA(make_tuple(250, 5, 0.95, 25));//SA算法,参数设置分别为起始温度,温度阈值,退火速度和允许相同数 72 | //int ans = s.HCS();//HCS算法 73 | ``` 74 | - 若需修改`SA`算法的参数,修改`make_tuple()`内的四个参数即可。 75 | - 若需使用`HCS`算法,将`s.SA`所在行注释掉,并解除`s.HCS`所在行注释即可。 76 | -------------------------------------------------------------------------------- /Optimization.h: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Gzh0821/Gaozih 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | //最优化头文件 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | using para_format = std::tuple;//SA参数格式 25 | 26 | class random_num_engine {//随机数生成引擎 27 | std::random_device rand_source;//随机熵源 28 | std::mt19937_64 rand_eng;//64位梅森环绕生成器 29 | public: 30 | random_num_engine() : rand_source(), rand_eng(time(nullptr) + rand_source()) {}; 31 | //下为函数对象定义 32 | int operator()(int max) {//生成0-max的随机整数 33 | rand_eng.seed(rand_eng() ^ time(nullptr) + rand_source()); 34 | return std::uniform_int_distribution<>(0, max - 1)(rand_eng); 35 | } 36 | 37 | double operator()(double start = 0.0, double end = 1.0) {//生成start-end的随机浮点数 38 | rand_eng.seed(rand_eng() ^ time(nullptr) + rand_source()); 39 | return std::uniform_real_distribution<>(start, end)(rand_eng); 40 | } 41 | 42 | }; 43 | 44 | class Solution {//解决方案类 45 | public: 46 | static constexpr double e_v = 2.71828;//编译常量e 47 | 48 | Solution() : order_record(std::make_unique>>()), machines(0), workpieces(0) {} 49 | 50 | Solution(const Solution &other) : machines(other.machines), workpieces(other.workpieces), 51 | cost_table(other.cost_table), 52 | order_record(std::make_unique>>()) {} 53 | 54 | ~Solution() { 55 | order_record.reset(); 56 | } 57 | 58 | void setup(int id); 59 | 60 | [[maybe_unused, nodiscard]] int HCS(); 61 | 62 | [[maybe_unused, nodiscard]] int SA(para_format input_para); 63 | 64 | friend int cal_func(Solution &&,int); 65 | private: 66 | random_num_engine get_random_num;//随机数模块 67 | int machines, workpieces; //机器数量和工件数量 68 | std::vector last_order, order, next_order;//当前序列 69 | std::vector> cost_table;//工件耗时表 70 | std::unique_ptr>> order_record;//独占指针指向存储序列的红黑树 71 | 72 | 73 | inline void change_random_order();//随机换序 74 | 75 | inline void change_adjacent_order(int wa);//相邻两点调换 76 | 77 | int calc_order_time();//计算函数模块 78 | }; -------------------------------------------------------------------------------- /Optimization.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Gzh0821/Gaozih 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "Optimization.h" 16 | #include 17 | #include 18 | //最优化实现 19 | using namespace std; 20 | 21 | void Solution::setup(int id) //预处理数据读入 22 | { 23 | string line; 24 | int id_now; 25 | ifstream fin("../flowshop-test-10-student.txt"); 26 | if (!fin.is_open()) { 27 | throw ios_base::failure("unable to open file!"); 28 | } 29 | while (getline(fin, line)) { 30 | if(line.front()!='+') 31 | continue; 32 | fin >> line >> id_now; 33 | if (id_now == id) 34 | { 35 | fin >> workpieces >> machines;//存入工件与机器数量 36 | cost_table.resize(workpieces); 37 | int _; 38 | for (auto &&i: cost_table) { 39 | i.resize(machines); 40 | for (int &j: i) 41 | fin >> _ >> j;//写入工件耗时表 42 | } 43 | fin.close(); 44 | return; 45 | } 46 | } 47 | } 48 | 49 | void Solution::change_random_order() { 50 | int a = get_random_num(workpieces), b = get_random_num(workpieces); 51 | swap(order[a], order[b]);//随机交换 52 | } 53 | 54 | void Solution::change_adjacent_order(int wa) { 55 | if (wa < workpieces - 1 && wa >= 0) { 56 | swap(order[wa], order[wa + 1]);//交换相邻两项 57 | } else 58 | throw out_of_range("Out of range in order!"); 59 | } 60 | 61 | 62 | int Solution::calc_order_time() { 63 | vector order_time_dp(workpieces); //记录每个工件在当前步骤机器上加工结束时的时间 64 | order_time_dp.front() = cost_table[order.front()].front(); 65 | for (int i = 1; i < workpieces; ++i) 66 | order_time_dp[i] = order_time_dp[i - 1] + cost_table[order[i]][0]; 67 | for (int i = 1; i < machines; ++i) { 68 | order_time_dp[0] += cost_table[order[0]][i]; 69 | for (int j = 1; j < workpieces; ++j) { 70 | int res = max(order_time_dp[j - 1], order_time_dp[j]); 71 | order_time_dp[j] = res + cost_table[order[j]][i]; //动态规划计算当前序列耗时 72 | } 73 | } 74 | return order_time_dp[workpieces - 1]; 75 | } 76 | 77 | [[maybe_unused]] int Solution::HCS() { 78 | int last = INT_MAX; //上一次计算结果 79 | next_order.reserve(workpieces); 80 | order.reserve(workpieces); 81 | last_order.reserve(workpieces);//预分配空间 82 | for (int i = 0; i < workpieces; ++i) 83 | order.emplace_back(i); 84 | for (int i = 0; i < workpieces; ++i) //随机化初始顺序 85 | change_random_order(); 86 | int res = calc_order_time(); 87 | next_order = order; 88 | while (last > res) //邻域内所有解均小于上次迭代解则结束迭代 89 | { 90 | int now_min = res; 91 | last = res; 92 | last_order = order; 93 | for (int i = 0; i < workpieces - 1; i++) //计算邻域,即交换相邻位置,并取最小值 94 | { 95 | change_adjacent_order(i); 96 | res = calc_order_time(); 97 | if (res < now_min) { 98 | now_min = res; 99 | next_order = order; 100 | } 101 | order = last_order; //还原初始序列,继续迭代 102 | } 103 | res = now_min;//存储结果 104 | order = next_order; 105 | } 106 | return res; 107 | } 108 | 109 | [[maybe_unused]] int Solution::SA(para_format input_para) //模拟退火算法 110 | { 111 | auto &&[T, T_ed, velocity, same_threshold] = input_para;//参数元组,分别为起始温度,温度阈值,退火速度和允许相同数 112 | next_order.reserve(workpieces); 113 | order.reserve(workpieces); 114 | last_order.reserve(workpieces); 115 | int last = INT_MAX, res; //last用于记录上次迭代结果 116 | for (int i = 0; i < workpieces; ++i) 117 | order.emplace_back(i); 118 | for (int i = 0; i < workpieces; ++i) 119 | change_random_order(); 120 | last_order = order; 121 | while (T > T_ed) //温度低于阈值时推出 122 | { 123 | int count_same = 0, count_cycle = 1; //记录循环次数和相同解重复次数 124 | T *= velocity; //降温 125 | do { 126 | res = calc_order_time(); 127 | if (res < last) { 128 | last = res; 129 | count_same = 0; 130 | next_order = order; 131 | } else if (res == last) 132 | ++count_same; 133 | else 134 | { 135 | double randtmp = get_random_num(), threshold = pow(e_v, ((last - res) / T)); // log(count_cycle+2)用于规避临近值反复 136 | if (randtmp < threshold) { 137 | last = res; 138 | count_same = 0; 139 | next_order = order; 140 | } else { 141 | ++count_same; 142 | order = last_order; 143 | }//使用Metropolis准则判断是否接受 144 | } 145 | order_record->emplace(order);//记录当前序列 146 | last_order = order; 147 | do { 148 | change_random_order();//获得从未出现的序列 149 | } while (order_record->count(order)); 150 | 151 | ++count_cycle; 152 | } while (count_same < same_threshold && 153 | count_cycle < workpieces * 250); //结束迭代,count_cycle为了防止出现循环跳跃 154 | } 155 | order_record->clear();//清除集合内的序列 156 | return last; 157 | } 158 | 159 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /flowshop-test-10-student.txt: -------------------------------------------------------------------------------- 1 | +++++++++++++++++++++++++++++ 2 | instance 0 3 | 11 5 4 | 0 375 1 12 2 142 3 245 4 412 5 | 0 632 1 452 2 758 3 278 4 398 6 | 0 12 1 876 2 124 3 534 4 765 7 | 0 460 1 542 2 523 3 120 4 499 8 | 0 528 1 101 2 789 3 124 4 999 9 | 0 796 1 245 2 632 3 375 4 123 10 | 0 532 1 230 2 543 3 896 4 452 11 | 0 14 1 124 2 214 3 543 4 785 12 | 0 257 1 527 2 753 3 210 4 463 13 | 0 896 1 896 2 214 3 258 4 259 14 | 0 532 1 302 2 501 3 765 4 988 15 | +++++++++++++++++++++++++++++ 16 | instance 1 17 | 8 8 18 | 0 456 1 654 2 852 3 145 4 632 5 425 6 214 7 654 19 | 0 789 1 123 2 369 3 678 4 581 5 396 6 123 7 789 20 | 0 654 1 123 2 632 3 965 4 475 5 325 6 456 7 654 21 | 0 321 1 456 2 581 3 421 4 32 5 147 6 789 7 123 22 | 0 456 1 789 2 472 3 365 4 536 5 852 6 654 7 123 23 | 0 789 1 654 2 586 3 824 4 325 5 12 6 321 7 456 24 | 0 654 1 321 2 320 3 758 4 863 5 452 6 456 7 789 25 | 0 789 1 147 2 120 3 639 4 21 5 863 6 789 7 654 26 | +++++++++++++++++++++++++++++ 27 | instance 2 28 | 13 4 29 | 0 654 1 147 2 345 3 447 30 | 0 321 1 520 2 789 3 702 31 | 0 12 1 147 2 630 3 255 32 | 0 345 1 586 2 214 3 866 33 | 0 678 1 532 2 275 3 332 34 | 0 963 1 145 2 302 3 225 35 | 0 25 1 24 2 142 3 589 36 | 0 874 1 517 2 24 3 996 37 | 0 114 1 896 2 520 3 541 38 | 0 785 1 543 2 336 3 234 39 | 0 203 1 210 2 699 3 784 40 | 0 696 1 784 2 855 3 512 41 | 0 302 1 512 2 221 3 345 42 | +++++++++++++++++++++++++++++ 43 | instance 3 44 | 12 5 45 | 0 210 1 145 2 114 3 401 4 876 46 | 0 123 1 214 2 332 3 856 4 543 47 | 0 124 1 247 2 753 3 214 4 543 48 | 0 210 1 785 2 966 3 147 4 876 49 | 0 543 1 532 2 100 3 321 4 789 50 | 0 876 1 632 2 588 3 896 4 456 51 | 0 789 1 854 2 225 3 528 4 123 52 | 0 876 1 698 2 322 3 546 4 456 53 | 0 543 1 145 2 669 3 325 4 789 54 | 0 456 1 752 2 144 3 321 4 210 55 | 0 789 1 143 2 755 3 427 4 123 56 | 0 456 1 537 2 123 3 214 4 234 57 | +++++++++++++++++++++++++++++ 58 | instance 4 59 | 14 4 60 | 0 456 1 856 2 963 3 696 61 | 0 789 1 930 2 21 3 320 62 | 0 630 1 214 2 475 3 142 63 | 0 214 1 257 2 320 3 753 64 | 0 573 1 896 2 124 3 214 65 | 0 218 1 532 2 752 3 528 66 | 0 653 1 142 2 147 3 653 67 | 0 214 1 547 2 532 3 214 68 | 0 204 1 865 2 145 3 527 69 | 0 785 1 321 2 763 3 536 70 | 0 696 1 124 2 214 3 214 71 | 0 532 1 12 2 257 3 528 72 | 0 12 1 345 2 854 3 888 73 | 0 457 1 678 2 123 3 999 74 | +++++++++++++++++++++++++++++ 75 | instance 5 76 | 10 6 77 | 0 333 1 991 2 996 3 123 4 145 5 234 78 | 0 333 1 111 2 663 3 456 4 785 5 532 79 | 0 252 1 222 2 222 3 789 4 214 5 586 80 | 0 222 1 204 2 114 3 876 4 752 5 532 81 | 0 255 1 477 2 123 3 543 4 143 5 142 82 | 0 555 1 566 2 456 3 210 4 698 5 573 83 | 0 558 1 899 2 789 3 124 4 532 5 12 84 | 0 888 1 965 2 876 3 537 4 145 5 14 85 | 0 889 1 588 2 543 3 854 4 247 5 527 86 | 0 999 1 889 2 210 3 632 4 451 5 856 87 | +++++++++++++++++++++++++++++ 88 | instance 6 89 | 20 10 90 | 0 96 1 80 2 56 3 48 4 14 5 88 6 50 7 15 8 67 9 65 91 | 0 25 1 44 2 10 3 41 4 64 5 52 6 19 7 28 8 72 9 27 92 | 0 76 1 62 2 48 3 54 4 47 5 35 6 72 7 54 8 27 9 56 93 | 0 41 1 6 2 3 3 33 4 77 5 44 6 43 7 50 8 19 9 43 94 | 0 65 1 91 2 75 3 30 4 47 5 55 6 51 7 1 8 36 9 73 95 | 0 81 1 69 2 65 3 93 4 61 5 3 6 44 7 17 8 6 9 14 96 | 0 49 1 9 2 12 3 54 4 75 5 66 6 34 7 12 8 32 9 6 97 | 0 93 1 89 2 31 3 14 4 37 5 57 6 33 7 96 8 32 9 45 98 | 0 39 1 83 2 55 3 32 4 18 5 9 6 93 7 65 8 75 9 73 99 | 0 52 1 46 2 64 3 13 4 54 5 62 6 45 7 80 8 19 9 65 100 | 0 72 1 4 2 29 3 94 4 85 5 51 6 29 7 65 8 50 9 16 101 | 0 55 1 43 2 47 3 32 4 87 5 97 6 41 7 86 8 17 9 30 102 | 0 8 1 91 2 81 3 93 4 14 5 86 6 64 7 42 8 70 9 3 103 | 0 27 1 11 2 94 3 38 4 33 5 67 6 8 7 55 8 99 9 18 104 | 0 34 1 86 2 87 3 10 4 64 5 30 6 47 7 51 8 69 9 26 105 | 0 15 1 5 2 39 3 23 4 16 5 1 6 57 7 55 8 62 9 35 106 | 0 59 1 55 2 43 3 49 4 23 5 25 6 51 7 72 8 9 9 1 107 | 0 93 1 4 2 43 3 5 4 84 5 55 6 22 7 78 8 31 9 11 108 | 0 20 1 91 2 73 3 41 4 100 5 38 6 75 7 9 8 76 9 71 109 | 0 59 1 13 2 93 3 26 4 11 5 7 6 66 7 42 8 54 9 99 110 | +++++++++++++++++++++++++++++ 111 | instance 7 112 | 20 15 113 | 0 60 1 70 2 51 3 74 4 6 5 4 6 27 7 5 8 30 9 79 10 58 11 49 12 91 13 20 14 63 114 | 0 79 1 53 2 74 3 87 4 18 5 16 6 44 7 95 8 41 9 3 10 20 11 59 12 74 13 33 14 42 115 | 0 94 1 57 2 19 3 77 4 70 5 90 6 36 7 73 8 37 9 24 10 28 11 23 12 16 13 97 14 75 116 | 0 23 1 3 2 82 3 87 4 45 5 54 6 76 7 60 8 61 9 98 10 68 11 14 12 10 13 17 14 9 117 | 0 38 1 32 2 68 3 7 4 49 5 49 6 72 7 31 8 70 9 8 10 26 11 81 12 86 13 60 14 74 118 | 0 27 1 14 2 77 3 20 4 92 5 74 6 33 7 44 8 43 9 52 10 10 11 81 12 30 13 93 14 71 119 | 0 23 1 55 2 67 3 6 4 64 5 68 6 19 7 73 8 92 9 96 10 3 11 21 12 51 13 3 14 25 120 | 0 41 1 91 2 90 3 43 4 37 5 96 6 99 7 46 8 41 9 51 10 33 11 49 12 17 13 64 14 68 121 | 0 92 1 44 2 12 3 37 4 75 5 20 6 14 7 43 8 26 9 64 10 85 11 14 12 54 13 54 14 97 122 | 0 69 1 69 2 71 3 54 4 36 5 96 6 3 7 27 8 16 9 61 10 94 11 96 12 85 13 34 14 34 123 | 0 16 1 38 2 36 3 48 4 92 5 20 6 55 7 89 8 75 9 57 10 89 11 62 12 36 13 36 14 69 124 | 0 37 1 19 2 55 3 2 4 96 5 10 6 81 7 29 8 2 9 34 10 83 11 1 12 45 13 23 14 64 125 | 0 4 1 57 2 26 3 29 4 91 5 94 6 21 7 30 8 30 9 51 10 31 11 62 12 53 13 29 14 51 126 | 0 55 1 65 2 21 3 99 4 27 5 53 6 42 7 78 8 63 9 25 10 86 11 60 12 64 13 76 14 69 127 | 0 17 1 70 2 33 3 81 4 24 5 35 6 77 7 21 8 83 9 19 10 44 11 70 12 90 13 34 14 90 128 | 0 76 1 94 2 54 3 34 4 12 5 28 6 24 7 5 8 59 9 4 10 46 11 93 12 32 13 78 14 48 129 | 0 81 1 49 2 83 3 72 4 31 5 72 6 91 7 8 8 40 9 93 10 84 11 63 12 67 13 36 14 84 130 | 0 63 1 70 2 14 3 85 4 66 5 41 6 64 7 54 8 10 9 65 10 26 11 58 12 20 13 64 14 41 131 | 0 98 1 39 2 91 3 5 4 55 5 28 6 43 7 97 8 35 9 23 10 50 11 99 12 59 13 63 14 95 132 | 0 47 1 48 2 89 3 33 4 99 5 10 6 54 7 94 8 52 9 44 10 73 11 67 12 44 13 36 14 98 133 | +++++++++++++++++++++++++++++ 134 | instance 8 135 | 20 5 136 | 0 34 1 6 2 63 3 85 4 60 137 | 0 11 1 65 2 4 3 1 4 73 138 | 0 63 1 67 2 3 3 73 4 100 139 | 0 22 1 46 2 88 3 1 4 66 140 | 0 76 1 4 2 34 3 9 4 76 141 | 0 20 1 22 2 7 3 3 4 28 142 | 0 44 1 30 2 55 3 68 4 92 143 | 0 29 1 89 2 12 3 96 4 71 144 | 0 54 1 12 2 21 3 74 4 2 145 | 0 62 1 96 2 61 3 79 4 53 146 | 0 50 1 13 2 48 3 40 4 37 147 | 0 89 1 69 2 57 3 1 4 70 148 | 0 50 1 56 2 8 3 67 4 46 149 | 0 32 1 24 2 23 3 87 4 62 150 | 0 12 1 88 2 64 3 14 4 13 151 | 0 59 1 78 2 95 3 59 4 48 152 | 0 41 1 20 2 83 3 65 4 20 153 | 0 94 1 48 2 26 3 93 4 3 154 | 0 28 1 59 2 10 3 81 4 20 155 | 0 66 1 33 2 34 3 8 4 5 156 | +++++++++++++++++++++++++++++ 157 | instance 9 158 | 20 15 159 | 0 59 1 11 2 4 3 79 4 94 5 31 6 74 7 82 8 53 9 51 10 19 11 31 12 46 13 47 14 10 160 | 0 72 1 54 2 36 3 3 4 59 5 23 6 40 7 59 8 89 9 37 10 85 11 67 12 39 13 65 14 60 161 | 0 92 1 26 2 15 3 81 4 86 5 56 6 92 7 47 8 93 9 21 10 40 11 77 12 84 13 10 14 91 162 | 0 49 1 27 2 99 3 64 4 30 5 51 6 26 7 89 8 40 9 64 10 60 11 67 12 67 13 100 14 3 163 | 0 42 1 12 2 55 3 62 4 37 5 24 6 24 7 42 8 41 9 88 10 14 11 33 12 85 13 4 14 20 164 | 0 21 1 61 2 52 3 49 4 44 5 98 6 26 7 68 8 61 9 25 10 6 11 46 12 75 13 37 14 5 165 | 0 80 1 99 2 88 3 83 4 11 5 93 6 47 7 80 8 100 9 87 10 84 11 17 12 43 13 93 14 58 166 | 0 4 1 54 2 43 3 63 4 44 5 78 6 44 7 39 8 76 9 99 10 29 11 38 12 14 13 75 14 25 167 | 0 46 1 23 2 54 3 77 4 60 5 53 6 42 7 72 8 90 9 11 10 22 11 68 12 94 13 24 14 14 168 | 0 23 1 84 2 92 3 94 4 8 5 10 6 77 7 58 8 64 9 95 10 55 11 15 12 19 13 62 14 67 169 | 0 53 1 91 2 80 3 8 4 41 5 89 6 3 7 87 8 57 9 75 10 37 11 8 12 23 13 88 14 65 170 | 0 72 1 17 2 53 3 36 4 9 5 24 6 80 7 9 8 28 9 60 10 94 11 99 12 67 13 10 14 44 171 | 0 5 1 44 2 96 3 37 4 21 5 44 6 49 7 13 8 86 9 74 10 89 11 3 12 82 13 85 14 61 172 | 0 80 1 19 2 73 3 95 4 78 5 78 6 31 7 13 8 50 9 93 10 98 11 80 12 46 13 9 14 37 173 | 0 7 1 16 2 46 3 82 4 97 5 82 6 41 7 21 8 11 9 50 10 5 11 28 12 95 13 84 14 45 174 | 0 68 1 73 2 57 3 4 4 66 5 71 6 87 7 43 8 60 9 56 10 30 11 21 12 14 13 37 14 61 175 | 0 77 1 2 2 1 3 82 4 2 5 49 6 89 7 27 8 34 9 52 10 85 11 26 12 80 13 87 14 58 176 | 0 17 1 86 2 32 3 35 4 6 5 50 6 53 7 39 8 94 9 89 10 22 11 75 12 59 13 74 14 27 177 | 0 61 1 14 2 70 3 58 4 24 5 36 6 70 7 57 8 31 9 100 10 21 11 76 12 54 13 94 14 57 178 | 0 29 1 6 2 6 3 12 4 78 5 28 6 40 7 13 8 61 9 19 10 39 11 98 12 69 13 14 14 3 179 | +++++++++++++++++++++++++++++ 180 | instance 10 181 | 50 10 182 | 0 100 1 72 2 76 3 100 4 16 5 9 6 5 7 87 8 34 9 15 183 | 0 19 1 3 2 19 3 68 4 29 5 22 6 16 7 13 8 87 9 70 184 | 0 70 1 56 2 39 3 71 4 29 5 91 6 100 7 86 8 88 9 99 185 | 0 50 1 93 2 100 3 71 4 84 5 64 6 67 7 29 8 28 9 81 186 | 0 80 1 97 2 3 3 10 4 14 5 32 6 92 7 67 8 72 9 68 187 | 0 47 1 59 2 29 3 3 4 26 5 20 6 50 7 26 8 1 9 70 188 | 0 40 1 63 2 69 3 21 4 56 5 73 6 56 7 10 8 46 9 40 189 | 0 84 1 80 2 68 3 82 4 4 5 45 6 100 7 96 8 29 9 67 190 | 0 85 1 46 2 59 3 35 4 68 5 84 6 89 7 18 8 97 9 58 191 | 0 60 1 60 2 2 3 50 4 90 5 20 6 78 7 56 8 62 9 27 192 | 0 78 1 64 2 21 3 5 4 85 5 55 6 15 7 23 8 36 9 87 193 | 0 98 1 31 2 42 3 73 4 83 5 48 6 71 7 49 8 72 9 30 194 | 0 4 1 57 2 30 3 11 4 67 5 4 6 82 7 77 8 98 9 21 195 | 0 45 1 45 2 25 3 45 4 7 5 59 6 88 7 42 8 57 9 81 196 | 0 73 1 94 2 83 3 59 4 1 5 72 6 65 7 62 8 45 9 76 197 | 0 77 1 84 2 11 3 82 4 10 5 9 6 67 7 27 8 43 9 8 198 | 0 22 1 66 2 5 3 77 4 97 5 28 6 61 7 82 8 62 9 96 199 | 0 90 1 51 2 87 3 27 4 65 5 76 6 67 7 20 8 75 9 67 200 | 0 12 1 92 2 43 3 21 4 92 5 64 6 94 7 67 8 60 9 46 201 | 0 9 1 76 2 62 3 46 4 71 5 65 6 76 7 65 8 30 9 38 202 | 0 29 1 12 2 71 3 70 4 46 5 96 6 12 7 70 8 76 9 19 203 | 0 83 1 15 2 73 3 32 4 51 5 6 6 3 7 29 8 3 9 24 204 | 0 83 1 95 2 87 3 29 4 46 5 67 6 89 7 73 8 69 9 33 205 | 0 83 1 46 2 82 3 2 4 55 5 54 6 85 7 3 8 20 9 57 206 | 0 11 1 32 2 15 3 27 4 2 5 43 6 23 7 79 8 28 9 29 207 | 0 10 1 74 2 73 3 99 4 54 5 89 6 83 7 5 8 28 9 90 208 | 0 73 1 40 2 4 3 20 4 51 5 18 6 37 7 18 8 61 9 75 209 | 0 85 1 30 2 58 3 89 4 48 5 15 6 82 7 77 8 2 9 3 210 | 0 56 1 63 2 26 3 87 4 53 5 8 6 80 7 46 8 5 9 62 211 | 0 59 1 67 2 73 3 65 4 60 5 61 6 94 7 86 8 38 9 1 212 | 0 70 1 66 2 80 3 32 4 93 5 56 6 26 7 41 8 21 9 9 213 | 0 4 1 66 2 79 3 43 4 39 5 83 6 55 7 25 8 62 9 13 214 | 0 51 1 42 2 90 3 85 4 84 5 29 6 73 7 8 8 95 9 57 215 | 0 18 1 30 2 61 3 67 4 57 5 60 6 25 7 10 8 20 9 95 216 | 0 61 1 9 2 3 3 2 4 61 5 18 6 44 7 78 8 38 9 74 217 | 0 25 1 91 2 31 3 2 4 14 5 97 6 91 7 84 8 88 9 26 218 | 0 84 1 8 2 95 3 61 4 85 5 41 6 88 7 4 8 86 9 51 219 | 0 74 1 2 2 24 3 42 4 33 5 24 6 62 7 13 8 62 9 10 220 | 0 33 1 7 2 62 3 68 4 42 5 41 6 78 7 67 8 99 9 6 221 | 0 38 1 43 2 2 3 4 4 62 5 95 6 76 7 91 8 67 9 78 222 | 0 43 1 98 2 28 3 51 4 43 5 84 6 13 7 71 8 64 9 81 223 | 0 15 1 19 2 50 3 30 4 75 5 90 6 94 7 35 8 51 9 83 224 | 0 75 1 98 2 42 3 67 4 24 5 63 6 15 7 45 8 92 9 44 225 | 0 29 1 60 2 80 3 86 4 70 5 13 6 100 7 86 8 88 9 6 226 | 0 14 1 49 2 78 3 93 4 45 5 94 6 35 7 46 8 18 9 85 227 | 0 29 1 20 2 27 3 66 4 70 5 95 6 7 7 11 8 75 9 52 228 | 0 73 1 19 2 33 3 36 4 93 5 21 6 44 7 51 8 4 9 24 229 | 0 87 1 79 2 52 3 85 4 24 5 89 6 50 7 4 8 37 9 50 230 | 0 86 1 99 2 31 3 25 4 78 5 10 6 41 7 66 8 35 9 1 231 | 0 2 1 41 2 41 3 88 4 6 5 77 6 89 7 80 8 21 9 54 232 | +++++++++++++++++++++++++++++ 233 | --------------------------------------------------------------------------------