blob: 23b48a972e8e65bd2eee9e2251d7dd7ede884ef9 [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([[11., 0.], [0., 0.]], format='csc')
6q = np.array([3., 4.])
7
8A = sparse.csc_matrix(np.array([[-1., 0.], [0., -1.], [-1., 3.],
9 [2., 5.], [3., 4]]))
10l = -np.inf * np.ones(A.shape[0])
11u = np.array([0., 0., -15., 100., 80.])
12
13n = P.shape[0]
14m = A.shape[0]
15
16# New data
17q_new = np.array([1., 1.])
18u_new = np.array([-2., 0., -20., 100., 80.])
19
20# Generate problem solutions
21sols_data = {'x_test': np.array([15., -0.]),
22 'y_test': np.array([0., 508., 168., 0., 0.]),
23 'obj_value_test': 1282.5,
24 'status_test': 'optimal',
25 'q_new': q_new,
26 'u_new': u_new,
27 'x_test_new': np.array([20., -0.]),
28 'y_test_new': np.array([0., 664., 221., 0., 0.]),
29 'obj_value_test_new': 2220.0,
30 'status_test_new': 'optimal'}
31
32
33# Generate problem data
34cu.generate_problem_data(P, q, A, l, u, 'basic_qp2', sols_data)