Skip to content

Commit

Permalink
[examples/julia] partial revert
Browse files Browse the repository at this point in the history
  • Loading branch information
ManifoldFR committed Aug 13, 2024
1 parent 1b3a72d commit 42acd8c
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions examples/julia/overview-simple.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,32 +19,33 @@ function generate_mixed_qp(n, seed=1)

P = spa.random(
n, n, density=0.85, data_rvs=np.random.randn, format="csc"
).toarray(order="C")
).toarray()
P = (P + np.transpose(P)) / 2.0

s = np.max(np.absolute(np.linalg.eigvals(P)))
P += (np.abs(s) + 1e-02) * spa.eye(n)
P = spa.coo_matrix(P).toarray(order="C")
P = spa.coo_matrix(P)
q = np.random.randn(n)
A = spa.random(m, n, density=0.85, data_rvs=np.random.randn, format="csc").toarray(order="C")
A = spa.random(m, n, density=0.85, data_rvs=np.random.randn, format="csc")
v = np.random.randn(n) # Fictitious solution
delta = np.random.rand(m) # To get inequality
u = A * v
l = -1.0e20 * np.ones(m)

return P, q, get(A, slice(0, n_eq)), get(u, slice(0, n_eq)), get(A, slice(n_in, m)), get(u, slice(n_in, m, )), l[n_in+1:end]
return P.toarray("C"), q, get(A, slice(0, n_eq)), get(u, slice(0, n_eq)), get(A, slice(n_in, m)), get(u, slice(n_in, m, )), l[n_in+1:end]
end

# generate a qp problem
n = 10
H, g, A, b, C, u, l = generate_mixed_qp(n)
n_eq = A.shape[1]
n_in = C.shape[1]
A = A.toarray("C")
C = C.toarray("C")
n_eq = size(A, 1)
n_in = size(C, 1)

# solve it
qp = proxsuite.proxqp.dense.QP(n, n_eq, n_in)
qp.settings.eps_abs = EPS
qp.init(H, g, A.toarray(), b, C.toarray(), l, u)
qp.init(H, g, A, b, C, l, u)
qp.solve()

x_res = qp.results.x
Expand Down

0 comments on commit 42acd8c

Please sign in to comment.