Ask performance tips #13
-
Dear developers of PyOptInterface, I recently used Thank you very much. Best regards, |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 8 replies
-
Thanks for trying out our project. |
Beta Was this translation helpful? Give feedback.
-
Thank you for your reply! Please follow the procedure below to download the benchmark script. I apologize for any inconvenience, but I want to use an example that approximates a real-world and challenging scenario. git clone -b PyOptInterface https://github.com/PREP-NexT/PREP-SHOT.git
cd PREP-SHOT
conda env create -f prep-shot.yml
conda activate prep-shot
python run.py You can modify the solving configuration in the solve_parameters section of Thank you very much! |
Beta Was this translation helpful? Give feedback.
-
I fix some performance issues in this commit. The main issue is to avoid using code like this: expr = poi.quicksum(...)
lhs = x - expr Use in-place operation instead: expr = poi.quicksum(...)
lhs = expr
lhs -= x Because the On my computer, the model building time decreases from 374s to 248s (with Gurobi optimizer). You can try it and share your results. |
Beta Was this translation helpful? Give feedback.
-
@Zhanwei-Liu Would you like to test my latest commit febd996 and change your local |
Beta Was this translation helpful? Give feedback.
Thank you!
I modified my timer decorator function by using a
Python
built-in library calledtracemalloc
to test peak memory usage due to its convenience. Below is the code I used: