Compare commits
4 Commits
b2dc2b341b
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 3e513c7ef4 | |||
| 9d71b1f21b | |||
| 1a44b84d67 | |||
| 8d1101b235 |
50
APP.md
50
APP.md
@@ -1,50 +0,0 @@
|
|||||||
Você é um especialista em UI/UX usando Streamlit.
|
|
||||||
|
|
||||||
[OBJETIVO]
|
|
||||||
|
|
||||||
- Construir uma interface gráfica para o arquivo main.py.
|
|
||||||
|
|
||||||
[REGRAS]
|
|
||||||
|
|
||||||
- A interface deve ser clean, moderna e intuitiva.
|
|
||||||
- Não crie gráficos que não sejam úteis.
|
|
||||||
|
|
||||||
[WORKSPACE]
|
|
||||||
|
|
||||||
- Você está em um ambiente Linux;
|
|
||||||
- O shell é fish;
|
|
||||||
- Coloque 'rtk' antes de todos os comandos;
|
|
||||||
- O ambiente venv foi criado usando 'uv';
|
|
||||||
- Rode scripts python com 'uv run ...';
|
|
||||||
- Adicione bibliotecas com 'uv add ...';
|
|
||||||
|
|
||||||
[PROJETO]
|
|
||||||
|
|
||||||
- Faça a interface toda em inglês;
|
|
||||||
- Crie uma aba chamada 'Data' com uma tabela do csv após filtragem e tratamento das variáveis;
|
|
||||||
- Crie uma aba chamada 'Fleet' com a tabela df_frota;
|
|
||||||
- Crie uma aba chamada 'Demand' com a tabela tabela_pax;
|
|
||||||
- Crie uma aba chamada 'Solver' com sliders para os parâmetros do problema:
|
|
||||||
- Frota de aeronaves;
|
|
||||||
- Período de operação;
|
|
||||||
- Local de origem;
|
|
||||||
- Local de destino;
|
|
||||||
- Número de aeronaves de cada tipo;
|
|
||||||
- Número de dias;
|
|
||||||
- Número de voos;
|
|
||||||
- Número de passageiros;
|
|
||||||
- Número de tripulantes;
|
|
||||||
- Número de bagagens;
|
|
||||||
- Número de aeronaves de cada tipo;
|
|
||||||
- Dentro da aba Solver coloque também, antes dos slides, o problema em 'matematiques' usando latex;
|
|
||||||
- No final da aba Solver, coloque um botão para resolver e uma caixa de texto com a saída do solver;
|
|
||||||
- Crie uma aba chamada 'Mapa' com um mapa da localização dos aeroportos na solução, com um slider por dia do ano;
|
|
||||||
- Crie uma aba chamada 'Resultados' com os resultados do solver, em tabelas. Coloque também o resultado não otimizado;
|
|
||||||
- Eu preciso saber também a quantiade de pernoites de uma aeronave em cada aeroporto.
|
|
||||||
- Desenhe a rota, ao selecionar a rota, um pop-up deve aparecer com informações sobre a rota (incluindo a aeronave e quantidade de pax e dias fora de sede);
|
|
||||||
- Mude a cor da rota caso seja uma rota de algum dia fora de sede.
|
|
||||||
- Crie um novo arquivo para este projeto, chamado main_app.py
|
|
||||||
- Utilize somente o Modelo VII
|
|
||||||
- Deixe o código bem documento usando doxygen
|
|
||||||
- Programe como um programado Senior usando Lean Code
|
|
||||||
- Antes de prosseguir, me mostre uma comparação para este projeto: Streamlit ou Shiny e eu decidirei qual o melhor.
|
|
||||||
Binary file not shown.
@@ -207,20 +207,24 @@ with tab2:
|
|||||||
# --- TAB 3: SOLVER ---
|
# --- TAB 3: SOLVER ---
|
||||||
with tab3:
|
with tab3:
|
||||||
st.header("Mathematical Formulation")
|
st.header("Mathematical Formulation")
|
||||||
st.latex(r"\min \sum_{t} \sum_{r} (c_{r} \cdot x_{r,t}) + \sum_{t} \sum_{d} (M \cdot s_{d,t})")
|
st.latex(r"\min \sum_{m,e,r,t} (c_{m,e,r} \cdot x_{m,e,r,t})")
|
||||||
st.latex(r"\text{s.t.} \quad \sum_{m,e} (\text{cap}_{m} \cdot x_{m,e,r,t}) + s_{r,t} \ge \text{PAX}_{r,t} \quad \forall r, t")
|
st.latex(r"\text{s.t.} \quad \sum_{m,e} (\text{cap}_{m} \cdot x_{m,e,r,t}) \ge \text{PAX}_{r,t} \quad \forall r, t")
|
||||||
st.latex(r"\sum_{t_{start} \le T \le t_{start} + \text{pernoites}} x_{m,e,r,t_{start}} \le \text{MaxFleet}_{m,e} \quad \forall m, e, T")
|
st.latex(r"\sum_{t_{start} \le T \le t_{start} + \text{overnights}} x_{m,e,r,t_{start}} \le \text{MaxFleet}_{m,e} \quad \forall m, e, T")
|
||||||
|
st.latex(r"\text{FlightTime}_{m,r} \cdot x_{m,e,r,t} \le \text{MaxDailyHours} \quad \forall m,e,r,t")
|
||||||
|
st.latex(r"\text{MissionTime}_{m,r} \le \text{MaxDaysOut} \quad \forall m,r")
|
||||||
|
|
||||||
st.markdown(r"""
|
st.markdown(r"""
|
||||||
**Dictionary of Variables:**
|
**Dictionary of Variables & Constraints:**
|
||||||
- $x_{m,e,r,t}$: Decision Variable (Integer). Number of aircraft of model $m$, from squadron $e$, allocated to route $r$ on day $t$.
|
- $x_{m,e,r,t}$: Decision Variable (Integer). Number of aircraft of model $m$, from squadron $e$, allocated to route $r$ on day $t$.
|
||||||
- $c_r$: Estimated total fuel cost for the route $r$ mission, including overnight stay penalties if applicable.
|
- $c_{m,e,r}$: Total fuel cost function: $c_{m,e,r} = \left( \frac{\text{Dist}_r \cdot \text{RangePenalty}}{\text{FuelConsumption}_m} \right) + (\text{overnights} \cdot \text{DailyPenalty}_m)$.
|
||||||
- $s_{r,t}$: Slack Variable. Represents the passenger demand that could **not** be met on that day due to fleet limitations.
|
- $\text{RangePenalty}$: Applies a **25% penalty** multiplier ($1.25$) to the fuel burn if any leg of the mission exceeds the aircraft's maximum range.
|
||||||
- $M$: High Penalty (Big M). Imposed on the system for each unit of slack activated, forcing the solver to meet demand whenever possible.
|
- $\text{DailyPenalty}_m$: Equivalent to an extra daily fuel expenditure quota for each day the aircraft spends out of its base.
|
||||||
- $\text{cap}_m$: Maximum passenger capacity (seats) of aircraft $m$.
|
- $\text{cap}_m$: Maximum passenger capacity (seats) of aircraft $m$.
|
||||||
- $\text{PAX}_{r,t}$: Actual number of Air Force passengers needing to fly on route $r$ on day $t$.
|
- $\text{PAX}_{r,t}$: Actual number of Air Force passengers needing to fly on route $r$ on day $t$.
|
||||||
- $\text{MaxFleet}_{m,e}$: Total physical aircraft available in squadron $e$ for model $m$.
|
- $\text{MaxFleet}_{m,e}$: Total physical aircraft available in squadron $e$ for model $m$.
|
||||||
- $T$: Temporal inspection window. Ensures aircraft blockade during overnight stays, preventing fleet duplication.
|
- $T$: Temporal inspection window. Ensures aircraft blockade during overnight stays, preventing fleet duplication.
|
||||||
|
- $\text{MaxDailyHours}$: Maximum allowed flight time per day per aircraft (typically $12$ hours).
|
||||||
|
- $\text{MaxDaysOut}$: Maximum allowable time for a mission before returning to base (hard limit of $96$ hours / 4 days).
|
||||||
""")
|
""")
|
||||||
|
|
||||||
if st.button("🚀 Run Global Optimization", type="primary"):
|
if st.button("🚀 Run Global Optimization", type="primary"):
|
||||||
@@ -229,7 +233,8 @@ with tab3:
|
|||||||
|
|
||||||
if run_solver_subprocess(300, log_placeholder):
|
if run_solver_subprocess(300, log_placeholder):
|
||||||
st.success("Solver Finished! Results saved to CSV.")
|
st.success("Solver Finished! Results saved to CSV.")
|
||||||
st.session_state['new_results'] = True
|
load_results.clear()
|
||||||
|
st.rerun()
|
||||||
else:
|
else:
|
||||||
st.error("Solver Failed or was aborted.")
|
st.error("Solver Failed or was aborted.")
|
||||||
|
|
||||||
@@ -237,9 +242,6 @@ with tab3:
|
|||||||
with tab4:
|
with tab4:
|
||||||
st.header("Interactive Flight Map")
|
st.header("Interactive Flight Map")
|
||||||
|
|
||||||
if st.session_state.get('new_results'):
|
|
||||||
df_results = load_results()
|
|
||||||
|
|
||||||
view_state = pdk.ViewState(latitude=-15.78, longitude=-47.92, zoom=3.5, pitch=45)
|
view_state = pdk.ViewState(latitude=-15.78, longitude=-47.92, zoom=3.5, pitch=45)
|
||||||
layers = []
|
layers = []
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user