Skip to content

A toy example went wrong #6

Description

@MisatoUehara

I use a toy example with depot [0] customer [1,2,3] and CS [4] with location at [0,0], [1,0], [2,0], [0,0], [2,0] respectively. Which means node 0 and 3, node 2 and 4 are at the same place.

Image

And I have two questions:

(1)
It is clear that it is optimal when max_q = 4 with the route [(0, None), (1, None), (2, None), (3, None)], but the solver shows the route is [(0, None), (1, None), (2, None), (4, 2.0), (3, None)], with extra 2 unit charging.

So I found that we might add a “ min_energy_at_departure[node_local_id_arr] = 0.0” in line 134 in "solver.py" to make sure the destination node should have no min_energy_at_departure like other nodes.

(2)
After modifying (1), max_q = 4 works right. But when I set max_q = 3.9 (where vehicle should have a "[(0, None), (1, None), (2, None), (4, 0.1), (3, None)]" route) but the solver also shows infeasible. Actually, max_q>=2 should be ok, because there is a CS 4 at the same place of 2.

I have tried my best to debug but failed because of too much code information. Could you please give me any debug idea or notes about (2)?

Detailed information is given below. I have carefully refered to the Montoya's xml data set and make the toy example. For simplification, I set time parameters as math.inf and 0 matrix. You can directly run the code to reproduce those error.

////////////////////////////////////////////////////////////////////////////////////////////////
from frvcpy.translator import translate
from frvcpy.solver import Solver
import math

frvcp_instance={'max_q': 4, 't_max': math.inf, 'css': [{'node_id': 4, 'cs_type': 0}], 'process_times': [0, 0.5, 0.5, 0.5, 0], 'breakpoints_by_type': [{'cs_type': 0, 'time': [0.0, 0.31, 0.39, 0.51], 'charge': [0.0, 13600.0, 15200.0, 16000.0]}], 'energy_matrix': [[0.0, 1.0, 2.0, 0.0, 2.0], [1.0, 0.0, 1.0, 1.0, 1.0], [2.0, 1.0, 0.0, 2.0, 0.0], [0.0, 1.0, 2.0, 0.0, 2.0], [2.0, 1.0, 0.0, 2.0, 0.0]], 'time_matrix': [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]]}
route = [0, 1, 2, 3]
q_init = frvcp_instance["max_q"] # EV begins with max battery capacity
frvcp_solver = Solver(frvcp_instance, route, q_init,multi_insert= False)

duration, feas_route = frvcp_solver.solve()
frvcp_solver.write_solution("results/my-solution.xml", instance_name="frvcpy-instance")
print(f"Duration: {duration:.4} hours")

print(f"Energy-feasible route:\n{feas_route}")
////////////////////////////////////////////////////////////////////////////////////////////////

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions