Commit 9d228b9e authored by Julien Lin's avatar Julien Lin
Browse files

format code

parent 68085337
......@@ -7,14 +7,19 @@ from joblib import Parallel, delayed
num_cores = multiprocessing.cpu_count()
def get_args_parse():
can = argparse.ArgumentParser()
can.add_argument("--nb-run", type=int, default=10, help="number of runs")
can.add_argument("--quality-threshold", type=float, default=600, help="Quality threshold")
can.add_argument("--not-parallel", type=bool, default=False, help="launch runs sequentialy")
can.add_argument(
"--quality-threshold", type=float, default=600, help="Quality threshold"
)
can.add_argument(
"--not-parallel", type=bool, default=False, help="launch runs sequentialy"
)
can.add_argument("--solver", type=str, default="num_random", help="Solver to use.")
......@@ -23,7 +28,6 @@ def get_args_parse():
def main():
can = get_args_parse()
the = can.parse_args()
......@@ -34,14 +38,14 @@ def main():
results = []
for i in range(the.nb_run):
# print(f"{i}th run")
results.append(
run(args)
)
results.append(run(args))
else:
def f(i):
# print(f"{i}th run")
return run(args)
results = Parallel(n_jobs=num_cores)(delayed(f)(i) for i in range(the.nb_run))
return run(args)
results = Parallel(n_jobs=num_cores)(delayed(f)(i) for i in range(the.nb_run))
fig = plt.figure()
......@@ -51,9 +55,9 @@ def main():
values = sorted(values, key=lambda el: el[1])
t = [iter for _,iter in values]
values = np.array([ val for val, _ in values])
values = np.cumsum( values >= the.quality_threshold) / len(values)
t = [iter for _, iter in values]
values = np.array([val for val, _ in values])
values = np.cumsum(values >= the.quality_threshold) / len(values)
ax3.step(t, values)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment