khalil-research / PyEPO

A PyTorch-based End-to-End Predict-then-Optimize Library for Linear and Integer Programming
MIT License
429 stars 56 forks source link

Notice a possible typo in shortestpath.py #23

Closed Marseillors closed 7 months ago

Marseillors commented 7 months ago

Hi PyEPO Team,

Firstly, I'd like to express my appreciation for your helpful work on PyEPO. It's a fantastic tool which I've found very useful in my projects.

While working with the myShortestPathModel2 class designed for shortest path problems in grid networks, I noticed a small possible typo in the index check for the sink node within the _getModel method. The current check for the sink node is:

elif i == self.grid[0] - 1 and j == self.grid[0] - 1:

Given the context, it seems there's a minor typo in the column index check. The correct condition should reference self.grid[1] - 1 for the column's index, aligning with the grid's dimensions (self.grid[0] for rows and self.grid[1] for columns). The corrected line would be:

elif i == self.grid[0] - 1 and j == self.grid[1] - 1:

This minor correction ensures the sink node is accurately identified in all grid configurations, enhancing the model's reliability for pathfinding tasks.

Thank you for your dedication to developing and maintaining PyEPO. Looking forward to your response and any further discussion this might spark.

Best regards,

Haoran

LucasBoTang commented 7 months ago

Hi Haoran,

Thank you for your feedback on PyEPO. We are thrilled to hear that you find it useful in your projects.

We've reviewed your suggestion regarding the shortestPathModel class and you're right about the typo. We've updated the code to correct the sink node index check in commit 8e34d6b. Your keen observation is greatly appreciated.

Thank you once again for your valuable input and support.

Best regards, Bo