Skip to main content

Assigning charging stations that reduces the system's travel time

Answered

Comments

4 comments

  • Official comment
    Simranjit Kaur
    • Gurobi Staff
    This post is more than two years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum, or try Gurobot, our chatbot interface offering instant, expert-level support.
  • Simranjit Kaur
    • Gurobi Staff

    The num_xfc_constraint forces at least one of the variables is_xfc[2] or is_xfc[3] to be zero. The infeasibility comes as the associated indicator constraints set the variables xfc_dists[4,2] and xfc_dists[2,3]  to 1e+100. Is there a particular reason you need to set these variables to 1e+100?

    0
  • Sihang Li
    • Gurobi-versary
    • First Comment
    • First Question

    Thanks so much for helping!

     

    I am setting up the model so that the sum of all `xfc_min_distance[i]` is minimized, and the `xfc_min_distance[i]` is defined as the minimum distance from a non-xfc node to any xfc node.

    The distances from all node-to-node pairs were precomputed from Dijkstra algorithm, and I would like to exclude the non-xfc-node-to-non-xfc-node distances when calculating distances to closest xfc node, and that's why I set them to GRB.INFINITY when the destination node is not an xfc node.

    0
  • Simranjit Kaur
    • Gurobi Staff

    Hi Sihang, 

    Instead of using GRB.INFINITY, you can set the non-xfc-node-to-non-xfc-node distances to a finite value greater than the maximum of your precomputed node-to-node distances. This should also exclude them from calculating the distance to the closest xfc node.

    On another note, you perhaps would want to exclude xfc_dists[i,i] from the calculation of min_dist[i], as otherwise, your min_dist[i] values will always be zero. 

    Also, the following constraints can be modelled in a different way, which might be worth trying if the maximum of the precomputed node-to-node distances is small. 

     xfc_dist_constraint_1_4: is_xfc[4] = 1 -> xfc_dists[1,4] = 10.00000001
     non_xfc_dist_constraint_1_4: is_xfc[4] = 0 -> xfc_dists[1,4] = 1e+100

    can be replaced with

     xfc_dist_constraint_1_4: xfc_dists[1,4] = 10 * is_xfc[4] + M * (1-is_xfc[4])

    where M is just greater than the maximum of the precomputed node-to-node distances.

    Best regards,
    Simran

    0

Post is closed for comments.