27 from qpoases
import PySQProblem
as SQProblem
28 from qpoases
import PySolutionAnalysis
as SolutionAnalysis
32 H = np.array([ 1.0, 0.0, 0.0, 0.5 ]).reshape((2,2))
33 A = np.array([ 1.0, 1.0 ]).reshape((2,1))
34 g = np.array([ 1.5, 1.0 ])
35 lb = np.array([ 0.5, -2.0 ])
36 ub = np.array([ 5.0, 2.0 ])
37 lbA = np.array([ -1.0 ])
38 ubA = np.array([ 2.0 ])
41 H_new = np.array([ 1.0, 0.5, 0.5, 0.5 ]).reshape((2,2))
42 A_new = np.array([ 1.0, 5.0 ]).reshape((2,1))
43 g_new = np.array([ 1.0, 1.5 ])
44 lb_new = np.array([ 0.0, -1.0 ])
45 ub_new = np.array([ 5.0, -0.5 ])
46 lbA_new = np.array([ -2.0 ])
47 ubA_new = np.array([ 1.0 ])
55 example.init(H, g, A, lb, ub, lbA, ubA, nWSR)
62 analyser.getKktViolation(example, maxStat, maxFeas, maxCmpl)
63 print(
"maxStat: %e, maxFeas:%e, maxCmpl: %e\n"%(maxStat, maxFeas, maxCmpl))
67 example.hotstart(H_new, g_new, A_new, lb_new, ub_new,
68 lbA_new, ubA_new, nWSR)
71 analyser.getKktViolation(example, maxStat, maxFeas, maxCmpl)
72 print(
"maxStat: %e, maxFeas:%e, maxCmpl: %e\n"%(maxStat, maxFeas, maxCmpl))
78 Primal_Dual_Var = np.zeros(5*5)
80 Var.reshape((5,5))[0,0] = 1.
81 Var.reshape((5,5))[1,1] = 1.
90 analyser.getVarianceCovariance(example, Var, Primal_Dual_Var)
91 print(
'Primal_Dual_Var=\n', Primal_Dual_Var.reshape((5,5)))
92 print(
"maxStat: %e, maxFeas:%e, maxCmpl: %e\n"%(maxStat, maxFeas, maxCmpl))
Implements the online active set strategy for QPs with varying matrices.
Provides additional tools for analysing QP solutions.
BEGIN_NAMESPACE_QPOASES returnValue print(const real_t *const v, int n)