You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a constraint of the form
$$ \Vert A \boldsymbol x + \boldsymbol b \Vert_2 \leq 1 $$ which seems to be a perfect fit for the COSMO.Constraint together with SecondOrderCone with $t=1$. However, there seems to be no way to supply the value of $t$, but only the dimensionality dimof the argument of the norm (in my case $A \boldsymbol x + \boldsymbol b$).
Unfortunately, there are no examples how to use theSecondOrderCone cone without using JuMP. I would like to avoid JuMP since it seems unnecessary overhead for my problem and also complicates (if not completely prevents) the use of higher precision types then Float64.
The text was updated successfully, but these errors were encountered:
DanielDoehring
changed the title
Usage of SecondOrderCone: Supply value of $t$
Usage of SecondOrderCone: Supply value of t
Jun 9, 2022
COSMO's native constraints are of the form $A x + b \in \mathcal{K}$
where $\mathcal{K}$ is one of the supported proper convex cones.
The second-order cone is defined as $(t,z) \in \mathcal{K}_{socp}$ such that $| z|_2 \leq t $.
Therefore, to get your norm constraint into the right form, we define the vector $s = (t,z) = (1,z)$ and model the constraint $| \hat{A} x + \hat{b} |_2 = z \leq 1$ as
where A = [sqrt(2)/4, 0; 0, \sqrt(2)/4] and b = [sqrt(2)/4; sqrt(2)/4], I would write the constraints natively like this:
using COSMO, SparseArrays, LinearAlgebra, Test
q = [-1; -1.];
P =spzeros(2, 2);
A = [sqrt(2)/40; 0sqrt(2)/4];
b = [√2/4; √2/4]
# We model the norm constraint using `COSMO.SecondOrderCone` as the convex set:
Aa = [0.0; A]
ba = [1; b]
constraint1 = COSMO.Constraint(Aa, ba, COSMO.SecondOrderCone(3));
# Next, we define the settings object, the model and then assemble everything:
settings = COSMO.Settings(verbose=true);
model = COSMO.Model();
assemble!(model, P, q, constraint1, settings = settings);
res = COSMO.optimize!(model);
The solution should be $x_1=x_2 = 1$ if I am not mistaken.
I have a constraint of the form$t=1$ . However, there seems to be no way to supply the value of $t$ , but only the dimensionality $A \boldsymbol x + \boldsymbol b$ ).
$$ \Vert A \boldsymbol x + \boldsymbol b \Vert_2 \leq 1 $$ which seems to be a perfect fit for the
COSMO.Constraint
together withSecondOrderCone
withdim
of the argument of the norm (in my caseUnfortunately, there are no examples how to use the
SecondOrderCone
cone without usingJuMP
. I would like to avoidJuMP
since it seems unnecessary overhead for my problem and also complicates (if not completely prevents) the use of higher precision types thenFloat64
.The text was updated successfully, but these errors were encountered: