-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update OR-Tools to v9.11 #88
base: main
Are you sure you want to change the base?
Conversation
2985ab0
to
214f0d7
Compare
0660009
to
2c5f3be
Compare
I've run some more experiments comapring Then I run each of the models with the respective version five times with the following code: import os
from statistics import mean, median
import ortools
from ortools.sat.python import cp_model
from google.protobuf import text_format
TIMEOUT=300
ITERATIONS=5
def load_and_solve(file, i):
model = cp_model.CpModel()
with open(file, "r") as file:
text_format.Parse(file.read(), model.Proto())
print (f"[{i}]: Solve using OR-Tools v{ortools.__version__} ... ", end='', flush=True)
solver = cp_model.CpSolver()
solver.parameters.max_time_in_seconds = TIMEOUT
# solver.parameters.search_branching = cp_model.FIXED_SEARCH
solver.parameters.num_workers = 16
status = solver.Solve(model)
status_str = solver.StatusName(status)
print(f"{status_str}, wall time: {solver.WallTime():.4f} s")
return solver.WallTime()
def do_it(file):
print(file)
times = []
for i in range(ITERATIONS):
walltime = load_and_solve(file, i)
times.append(walltime)
return times
measurements = []
def printit(o):
f = o["file"]
m = o["measurements"]
minimum = min(m)
maximum = max(m)
meanv = mean(m)
medianv = median(m)
m = ",".join([str(x) for x in m])
print(f"| {f} | {minimum} | {maximum} | {meanv} | {medianv} | {m} |")
for f in os.listdir("./"):
if not f.endswith(".txt"):
continue
if f == "results.txt" or f == "requirements.txt":
continue
times = do_it(f)
measurements.append({"file": f, "measurements": times})
printit(measurements[-1])
print("| model | minimum | maximum | mean | median | raw times |")
print("| ----- | ------- | ------- | ---- | ------ | --------- |")
for m in measurements:
printit(m) I attached the extracted models together with the results. Here are the results:
v9.11
|
afc3227
to
d08fe2f
Compare
d08fe2f
to
ec1d4a2
Compare
No description provided.