How to save the time column in the solution log to a variable? #4117
Replies: 4 comments 4 replies
-
scip outputs to stdout. You need to intercept this. Math-opt will allow to intercept this with a callback. |
Beta Was this translation helpful? Give feedback.
1 reply
-
I do not know. This is a python question, not an OR-Tools one.
Laurent Perron | Operations Research | ***@***.*** | (33) 1 42 68 53
00
Le jeu. 7 mars 2024 à 10:55, xiaoyezi55 ***@***.***> a écrit :
… May I ask how to implement it
—
Reply to this email directly, view it on GitHub
<#4117 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACUPL3KPF332XLAL6V74W3LYXA2SJAVCNFSM6AAAAABEKUS5P6VHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4DOMBUHA4TA>
.
You are receiving this because you modified the open/close state.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
1 reply
-
the question makes no sense.
there is not a 'ortools optimization time progress'.
You create the time limit. Why don't you check time in python and compare
it with the time limit you set ?
Laurent Perron | Operations Research | ***@***.*** | (33) 1 42 68 53
00
Le jeu. 7 mars 2024 à 11:11, xiaoyezi55 ***@***.***> a écrit :
… Is there any way to obtain the OR-Tools optimization time progress
percentage?
—
Reply to this email directly, view it on GitHub
<#4117 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACUPL3MPNXN7NI3QHVUN4GTYXA4NXAVCNFSM6AAAAABEKUS5P6VHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4DOMBVGA4DA>
.
You are receiving this because you modified the open/close state.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
xiaoyezi55
-
is your problem integral ?
If so, use CP-SAT. It is a better ILP solver, and it supports solution
callbacks in all languages.
Laurent Perron | Operations Research | ***@***.*** | (33) 1 42 68 53
00
Le jeu. 7 mars 2024 à 11:24, xiaoyezi55 ***@***.***> a écrit :
… import time
from ortools.linear_solver import pywraplp
创建求解器并设置时间限制
solver = pywraplp.Solver.CreateSolver('SCIP')
solver.set_time_limit(300000) # 设置时间限制为300秒
定义你的优化问题 ... 记录开始时间
start_time = time.time()
求解问题
status = solver.Solve()
if status == pywraplp.Solver.OPTIMAL or status == pywraplp.Solver.FEASIBLE:
end_time = time.time()
elapsed_time = end_time - start_time
progress_percentage = 100
print(f"Optimization completed in {elapsed_time} seconds. Progress:
{progress_percentage}%")
else:
end_time = time.time()
elapsed_time = end_time - start_time
progress_percentage = (elapsed_time / 300000) * 100
print(f"Optimization still running. Elapsed time: {elapsed_time} seconds. Estimated progress: {progress_percentage}%")
The above code can only output optimization progress after optimization is
completed. How to output optimization time progress percentage during the
optimization process
—
Reply to this email directly, view it on GitHub
<#4117 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACUPL3N74EU7YRZV7EY7MEDYXA54JAVCNFSM6AAAAABEKUS5P6VHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4DOMBVGI3DO>
.
You are receiving this because you modified the open/close state.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
solver = pywraplp.Solver.CreateSolver('SCIP')
solver.EnableOutput()
How to save the time column in the solution log to a variable?
Beta Was this translation helpful? Give feedback.
All reactions