Compare commits

...

2 Commits

2 changed files with 3 additions and 4 deletions

View File

@@ -97,7 +97,7 @@ df_results = load_results()
def run_solver_subprocess(time_limit_sec, output_placeholder): def run_solver_subprocess(time_limit_sec, output_placeholder):
"""Spawns the optimization worker and streams logs to the UI.""" """Spawns the optimization worker and streams logs to the UI."""
process = subprocess.Popen( process = subprocess.Popen(
["uv", "run", "python", "-u", "solver_worker.py", str(time_limit_sec)], ["uv", "run", "python", "-u", "src/fleet_assignment/optimizer.py", str(time_limit_sec)],
stdout=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT, stderr=subprocess.STDOUT,
text=True, text=True,

View File

@@ -17,11 +17,10 @@ import sqlite3
# Ensure src module is visible if run standalone # Ensure src module is visible if run standalone
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))) sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
from src.fleet_assignment.config import DB_PATH, RESULTS_FILE, COST_FILE from src.fleet_assignment.config import DB_PATH, RESULTS_FILE, COST_FILE, JSON_AEROPORTOS, JSON_EMISSORES
def run_solver(time_limit_sec=300): def run_solver(time_limit_sec=300):
print(f"--- Starting Global Solver Worker (Limit: {time_limit_sec}s) ---") print(f"--- Starting Global Solver Worker (Limit: {time_limit_sec}s) ---")
JSON_AEROPORTOS = "airports.json"
conn = sqlite3.connect(DB_PATH) conn = sqlite3.connect(DB_PATH)
df_frota_db = pd.read_sql_query("SELECT * FROM frota", conn) df_frota_db = pd.read_sql_query("SELECT * FROM frota", conn)
@@ -34,7 +33,7 @@ def run_solver(time_limit_sec=300):
pax_demanda_completa = demands_db.groupby(['Data Apenas', 'Localidade Decolagem', 'Localidade Pouso'])['PAX'].sum().reset_index() pax_demanda_completa = demands_db.groupby(['Data Apenas', 'Localidade Decolagem', 'Localidade Pouso'])['PAX'].sum().reset_index()
demands = pax_demanda_completa[pax_demanda_completa['PAX'] > 0].copy() demands = pax_demanda_completa[pax_demanda_completa['PAX'] > 0].copy()
with open('emissores.json', 'r') as f: with open(JSON_EMISSORES, 'r') as f:
emissores_data = json.load(f)[0] emissores_data = json.load(f)[0]
icaos_emissores = list(emissores_data.values()) icaos_emissores = list(emissores_data.values())