Example #1
0
        test_solve_KKT_P + test_solve_KKT_sigma * sparse.eye(test_solve_KKT_n),
        test_solve_KKT_A.T
    ]),
    sparse.hstack([
        test_solve_KKT_A,
        -1. / test_solve_KKT_rho * sparse.eye(test_solve_KKT_m)
    ])
],
                                   format='csc')
test_solve_KKT_rhs = rg.standard_normal(test_solve_KKT_m + test_solve_KKT_n)
test_solve_KKT_x = spla.splu(test_solve_KKT_KKT).solve(test_solve_KKT_rhs)

test_solve_KKT_x[test_solve_KKT_n:] = test_solve_KKT_rhs[test_solve_KKT_n:] + \
                                      test_solve_KKT_x[test_solve_KKT_n:] / test_solve_KKT_rho

# Generate test data and solutions
data = {
    'test_solve_KKT_n': test_solve_KKT_n,
    'test_solve_KKT_m': test_solve_KKT_m,
    'test_solve_KKT_A': test_solve_KKT_A,
    'test_solve_KKT_Pu': test_solve_KKT_Pu,
    'test_solve_KKT_rho': test_solve_KKT_rho,
    'test_solve_KKT_sigma': test_solve_KKT_sigma,
    'test_solve_KKT_KKT': test_solve_KKT_KKT,
    'test_solve_KKT_rhs': test_solve_KKT_rhs,
    'test_solve_KKT_x': test_solve_KKT_x
}

# Generate test data
cu.generate_data('solve_linsys', data)
Example #2
0
    'test_mat_ops_ew_abs': test_mat_ops_ew_abs,
    'test_mat_ops_inf_norm_cols': test_mat_ops_inf_norm_cols,
    'test_mat_ops_inf_norm_rows': test_mat_ops_inf_norm_rows,
    'test_mat_vec_n': test_mat_vec_n,
    'test_mat_vec_m': test_mat_vec_m,
    'test_mat_vec_A': test_mat_vec_A,
    'test_mat_vec_Pu': test_mat_vec_Pu,
    'test_mat_vec_x': test_mat_vec_x,
    'test_mat_vec_y': test_mat_vec_y,
    'test_mat_vec_Ax': test_mat_vec_Ax,
    'test_mat_vec_Ax_cum': test_mat_vec_Ax_cum,
    'test_mat_vec_ATy': test_mat_vec_ATy,
    'test_mat_vec_ATy_cum': test_mat_vec_ATy_cum,
    'test_mat_vec_Px': test_mat_vec_Px,
    'test_mat_vec_Px_cum': test_mat_vec_Px_cum,
    'test_mat_extr_triu_n': test_mat_extr_triu_n,
    'test_mat_extr_triu_P': test_mat_extr_triu_P,
    'test_mat_extr_triu_Pu': test_mat_extr_triu_Pu,
    'test_mat_extr_triu_P_inf_norm_cols': test_mat_extr_triu_P_inf_norm_cols,
    'test_qpform_n': test_qpform_n,
    'test_qpform_Pu': test_qpform_Pu,
    'test_qpform_x': test_qpform_x,
    'test_qpform_value': test_qpform_value,
    'test_mat_trace_P': test_mat_trace_P,
    'test_mat_trace_P_trace': test_mat_trace_P_trace,
    'test_mat_trace_P_fro_sq': test_mat_trace_P_fro_sq
}

# Generate test data
cu.generate_data('lin_alg', data)
Example #3
0
A12 = sparse.csc_matrix([[1., 1.], [1., 0.], [0., 1.]])
A34 = sparse.csc_matrix([[1., 0.], [1., 0.], [0., 1.]])
l = np.array([0., 1., 1.])
u1 = np.array([5., 3., 3.])
u2 = np.array([0., 3., 3.])
u3 = np.array([2., 3., np.inf])
u4 = np.array([0., 3., np.inf])

# Generate problem solutions
data = {
    'P': P,
    'q': q,
    'A12': A12,
    'A34': A34,
    'l': l,
    'u1': u1,
    'u2': u2,
    'u3': u3,
    'u4': u4,
    'x1': np.array([1., 3.]),
    'y1': np.array([0., -2., 1.]),
    'obj_value1': -1.5,
    'status1': 'optimal',
    'status2': 'primal_infeasible',
    'status3': 'dual_infeasible',
    'status4': 'primal_infeasible'
}

# Generate problem data
cu.generate_data('primal_dual_infeasibility', data)
Example #4
0
    'test_solve_P_new_x':
    np.array([-0.36033252, 0.10729745, 0.22965285, 0.06323582, 0.42301398]),
    'test_solve_P_new_y':
    np.zeros(m),
    'test_solve_P_new_obj_value':
    -0.36765,
    'test_solve_P_new_status':
    'optimal',
    'test_solve_A_new':
    test_solve_A_new,
    'test_solve_A_new_x':
    np.array([-0.34282147, 0.0260615, 0.27197987, -0.01202531, 0.44052732]),
    'test_solve_A_new_y':
    np.zeros(m),
    'test_solve_A_new_obj_value':
    -0.37221,
    'test_solve_A_new_status':
    'optimal',
    'test_solve_P_A_new_x':
    np.array([-0.36033252, 0.10729745, 0.22965285, 0.06323582, 0.42301398]),
    'test_solve_P_A_new_y':
    np.zeros(m),
    'test_solve_P_A_new_obj_value':
    -0.36765,
    'test_solve_P_A_new_status':
    'optimal'
}

# Generate test data
cu.generate_data('update_matrices', data)