代码拉取完成,页面将自动刷新
"""
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)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。