1 Star 0 Fork 0

Hammer/code-for-gap

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
mainAlgo.py 2.35 KB
一键复制 编辑 原始数据 按行查看 历史
Hammer 提交于 2025-04-30 16:03 +08:00 . backup
"""
File Info:
@File name: mainAlgo.py
@Author: Wanghx
@Creation date: 2024/10/18 上午10:06
@Description: main Programme
Notes:
1. Before running the script, make sure the necessary dependencies have been installed.
2. [Other specific notes].
"""
from src.Proj import GlobalProj
from src.utils import Visualization as viz
from src.model.IntegerOptimization import IntegerOptimization as IntOpt
from src.model.DGraph import DGraph
from src.Solution.Solver import solve
from src.utils import ConsoleOutput as Conso
from src.utils.CommonUtils import CommonUtils as Utils
import src.utils.DocOutput as DO
from src.Solution.FarGateAlloc import FarGateAlloc
import config
import time
# 全局信息
airportInfo = GlobalProj.Airport()
# 绘制当前机位占用甘特图
# viz.draw_gantt_occupy(airportInfo.gateStatus.convertorToGanttData(), airportInfo.gateInfo, "甘特图")
# model-select
# MODEL = 'IntOpt'
MODEL = config.process['MODEL']
if MODEL == 'IntOpt':
intOptModel = IntOpt(airportInfo)
# 绘制机位占用
# viz.draw_gantt_gap(intOptModel.getGanttDataFromResult(), airportInfo.gateInfo, "甘特图")
if MODEL == 'DGraph':
start_time1 = time.time()
Conso.NearOptAllocModuleSetUp()
# 分布图建模
DG = DGraph(airportInfo)
# 计算最优的近机位分配方案【训练模式 | 推理模式】
nearSt, TargetList = solve(DG)
# 结果图像输出至文件夹-----------------------------------------------------
file_path = Utils.getResultFilePath()
# 绘制近机位机位分配的指标变化
viz.draw_nearAlloc_targets(TargetList, file_path, "近机位分配指标")
# ---------------------------------------------------------------------
# 近机位最优分配模块结束
durationNear = Conso.NearOptAllocModuleFinish(start_time1)
start_time2 = time.time()
Conso.FarOptAllocModuleSetUp()
# 根据最优的近机位分配方案,做相应的远机位分配
farSt = FarGateAlloc(nearSt)
durationFar = Conso.FarOptAllocModuleFinish(start_time2)
# 绘制远近机位分配甘特图
viz.draw_gantt(farSt.getGanttDataFromResult(), airportInfo.gateInfo, file_path, "机位分配方案")
# 总时间
durationTotal = time.time() - start_time1
# txt记录本次分配指标
DO.writeTargets(file_path, nearSt, farSt, durationNear, durationFar, durationTotal)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/Hammerzer/code-for-gap.git
git@gitee.com:Hammerzer/code-for-gap.git
Hammerzer
code-for-gap
code-for-gap
master

搜索帮助