-
Notifications
You must be signed in to change notification settings - Fork 21
/
run_parametric_problems.py
49 lines (38 loc) · 1.33 KB
/
run_parametric_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
'''
Run all parametric problems of the OSQP paper
This code compares OSQP with warm-start and factorization caching and without
'''
from parametric_problems.lasso import LassoParametric
from parametric_problems.mpc import MPCParametric
from parametric_problems.portfolio import PortfolioParametric
from utils.parametric import print_results_parametric, compute_results_parametric
PROBLEMS_MAP = {'Lasso': LassoParametric,
'MPC': MPCParametric,
'Portfolio': PortfolioParametric}
problems = [
'Lasso',
'MPC',
'Portfolio'
]
# Problem dimensions
dimensions = {'Lasso': [50, 100, 150, 200],
'MPC': [20, 40, 60, 80],
'Portfolio': [100, 200, 300, 400]
}
# OSQP solver settings
osqp_settings = {'verbose': False,
'polish': False,
'rho': 0.1}
# Solve all problems
for problem in problems:
for dim in dimensions[problem]:
problem_instance = PROBLEMS_MAP[problem](osqp_settings,
dim)
problem_instance.solve()
# Compute results
compute_results_parametric(problems, dimensions)
# # Extract results info
# print("Results")
# print("-------")
# for problem in problems:
# print_results_parametric(problem, dimensions[problem])