Use these in your src/env folder to create the EVRP simulator with battery/charging constraints.
-
Create a Gymnasium-compatible EVRP environment class in evrp_env.py. Depot at node 0, customers 1-m, chargers m+1 to g. State: graph with coords/distances/demands/node_types, dynamic remaining battery/cargo/visited mask. Actions: next node (customer/charger/depot). Rewards: -distance -charge_visits -depot_visits -max(0, negative_battery). Mask invalid actions (visited customers, cargo exceed, battery insufficient to depot). Reference EVRP formulation from instructions/Modular-*.pdf Section 3 and Reinforce-model-Paper.pdf Section III. Include step/reset methods, render for routes.
-
Implement battery update in EVRP env: bt+1 = B if charger else bt - f(t,t+1). Cargo qt+1 = Q if depot else qt - d_t if customer. Energy f(i,j) = euclidean dist. Penalize infeasible: transient mask if f(i,j) + f(j,0) > bi. Permanent mask visited customers/depot-complete. Add observation as dict with static graph, dynamic state. Use NetworkX for graph.
Use these in your src/env folder to create the EVRP simulator with battery/charging constraints.
Create a Gymnasium-compatible EVRP environment class in evrp_env.py. Depot at node 0, customers 1-m, chargers m+1 to g. State: graph with coords/distances/demands/node_types, dynamic remaining battery/cargo/visited mask. Actions: next node (customer/charger/depot). Rewards: -distance -charge_visits -depot_visits -max(0, negative_battery). Mask invalid actions (visited customers, cargo exceed, battery insufficient to depot). Reference EVRP formulation from instructions/Modular-*.pdf Section 3 and Reinforce-model-Paper.pdf Section III. Include step/reset methods, render for routes.
Implement battery update in EVRP env: bt+1 = B if charger else bt - f(t,t+1). Cargo qt+1 = Q if depot else qt - d_t if customer. Energy f(i,j) = euclidean dist. Penalize infeasible: transient mask if f(i,j) + f(j,0) > bi. Permanent mask visited customers/depot-complete. Add observation as dict with static graph, dynamic state. Use NetworkX for graph.