1 Star 0 Fork 0

Miller Cy Chan / GASchedule.py

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
ConsoleApp.py 1.37 KB
一键复制 编辑 原始数据 按行查看 历史
Miller Cy Chan 提交于 2024-01-04 14:46 . Add files via upload
import codecs
import pathlib
import os
import sys
import tempfile
import time
import traceback
from model.Configuration import Configuration
# from algorithm.GeneticAlgorithm import GeneticAlgorithm
# from algorithm.APNsgaIII import APNsgaIII
from algorithm.Cso import Cso
# from algorithm.GaQpso import GaQpso
# from algorithm.Amga2 import Amga2
from HtmlOutput import HtmlOutput
def main(file_name):
start_time = int(round(time.time() * 1000))
configuration = Configuration()
target_file = str(pathlib.Path().absolute()) + file_name
configuration.parseFile(target_file)
alg = Cso(configuration)
# alg = GaQpso(configuration)
print("GaSchedule Version 1.2.5 . Making a Class Schedule Using", alg, ".\n")
print("Copyright (C) 2022 - 2024 Miller Cy Chan.\n")
alg.run()
html_result = HtmlOutput.getResult(alg.result)
temp_file_path = tempfile.gettempdir() + file_name.replace(".json", ".htm")
writer = codecs.open(temp_file_path, "w", "utf-8")
writer.write(html_result)
writer.close()
seconds = (int(round(time.time() * 1000)) - start_time) / 1000.0
print("\nCompleted in {} secs.\n".format(seconds))
os.startfile(temp_file_path)
if __name__ == "__main__":
file_name = "/GaSchedule.json"
if len(sys.argv) > 1:
file_name = sys.argv[1]
try:
main(file_name)
except:
traceback.print_exc()
Python
1
https://gitee.com/mcychan/GASchedule.py.git
git@gitee.com:mcychan/GASchedule.py.git
mcychan
GASchedule.py
GASchedule.py
master

搜索帮助