blob: a8defb1f8b94c5f7b3296fc800a982ebbd9a4c6e [file] [log] [blame]
Austin Schuh9049e202022-02-20 17:34:16 -08001import numpy as np
2from scipy import sparse
3import utils.codegen_utils as cu
4
5P = sparse.triu([[4., 1.], [1., 2.]], format='csc')
6q = np.ones(2)
7
8A = sparse.csc_matrix(np.array([[1., 1.], [1., 0.], [0., 1.], [0., 1.]]))
9l = np.array([1., 0., 0., -np.inf])
10u = np.array([1., 0.7, 0.7, np.inf])
11
12n = P.shape[0]
13m = A.shape[0]
14
15# New data
16q_new = np.array([2.5, 3.2])
17l_new = np.array([0.8, -3.4, -np.inf, 0.5])
18u_new = np.array([1.6, 1.0, np.inf, 0.5])
19
20# Generate problem solutions
21sols_data = {'x_test': np.array([0.3, 0.7]),
22 'y_test': np.array([-2.9, 0.0, 0.2, 0.0]),
23 'obj_value_test': 1.88,
24 'status_test': 'optimal',
25 'q_new': q_new,
26 'l_new': l_new,
27 'u_new': u_new}
28
29# Generate problem data
30cu.generate_problem_data(P, q, A, l, u, 'basic_qp', sols_data)