-
Notifications
You must be signed in to change notification settings - Fork 21
/
run_maros_meszaros_problems.py
60 lines (49 loc) · 1.83 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
'''
Run Maros-Meszaros problems for the OSQP paper
This code tests the solvers:
- OSQP
- GUROBI
- MOSEK
'''
from maros_meszaros_problems.maros_meszaros_problem import MarosMeszarosRunner
import solvers.solvers as s
from utils.benchmark import compute_stats_info
import os
import argparse
parser = argparse.ArgumentParser(description='Maros Meszaros Runner')
parser.add_argument('--high_accuracy', help='Test with high accuracy', default=False,
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 accurazy
if high_accuracy:
solvers = [s.OSQP_high, s.OSQP_polish_high, s.GUROBI_high, s.MOSEK_high]
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)
# DEBUG only: Choose only 2 problems
# maros_meszaros_runner.problems = ["STADAT1", "BOYD1"]
maros_meszaros_runner.solve(parallel=parallel, cores=12)
# Compute results statistics
compute_stats_info(solvers, OUTPUT_FOLDER,
high_accuracy=high_accuracy)