-
Notifications
You must be signed in to change notification settings - Fork 3
/
run_maros_meszaros_problems.py
executable file
·61 lines (52 loc) · 1.97 KB
/
run_maros_meszaros_problems.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
'''
Run Maros-Meszaros problems for the PROXQP paper
This code tests the solvers:
- PROXQP
- OSQP
- GUROBI
- MOSEK
- qpOASES
'''
from maros_meszaros_problems.maros_meszaros_problem import MarosMeszarosRunner
import solvers.solvers as s
from utils.benchmark import compute_stats_info,plot_performance_profiles,compute_performance_profiles
import os
import argparse
parser = argparse.ArgumentParser(description='Maros Meszaros Runner')
parser.add_argument('--high_accuracy', help='Test with high accuracy', default=True,
action='store_true')
parser.add_argument('--verbose', help='Verbose solvers', default=False,
action='store_true')
parser.add_argument('--parallel', help='Parallel solution', default=False,
action='store_true')
args = parser.parse_args()
high_accuracy = args.high_accuracy
verbose = args.verbose
parallel = args.parallel
print('high_accuracy', high_accuracy)
print('verbose', verbose)
print('parallel', parallel)
# Add high accuracy solvers when accuracy
if high_accuracy:
solvers = [s.PROXQP,s.OSQP,s.qpOASES,s.GUROBI,s.quadprog,s.MOSEK]
OUTPUT_FOLDER = 'maros_meszaros_problems_high_accuracy'
for key in s.settings:
s.settings[key]['high_accuracy'] = True
else:
solvers = [s.OSQP, s.OSQP_polish, s.GUROBI, s.MOSEK]
OUTPUT_FOLDER = 'maros_meszaros_problems'
# Shut up solvers
if verbose:
for key in s.settings:
s.settings[key]['verbose'] = True
# Run all examples
maros_meszaros_runner = MarosMeszarosRunner(solvers,
s.settings,
OUTPUT_FOLDER)
eps = 1.E-9 # accuracy asked
maros_meszaros_runner.solve(parallel=parallel, cores=12,n_average=1,eps=eps)
# Compute results statistics
compute_stats_info(solvers, OUTPUT_FOLDER,
high_accuracy=high_accuracy)
compute_performance_profiles(solvers, OUTPUT_FOLDER,'')
plot_performance_profiles(OUTPUT_FOLDER, solvers , '')