-
Notifications
You must be signed in to change notification settings - Fork 41
dsos_horn #96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks Benoît. This is strange behaviour. It seems to be an issue with Does model = _model(factory)
orthant = @set x[1] ≥ 0 && x[2] ≥ 0 && x[3] ≥ 0 && x[4] ≥ 0 && x[5] ≥ 0
cref = @constraint(model, sum(x) * x' * H * x in cone, domain = orthant) create exactly the same MOI.model as model = _model(factory)
cref = @constraint(model, x' * H * x in CopositiveInner(cone))
delete(model, cref)
orthant = @set x[1] ≥ 0 && x[2] ≥ 0 && x[3] ≥ 0 && x[4] ≥ 0 && x[5] ≥ 0
cref = @constraint(model, sum(x) * x' * H * x in cone, domain = orthant) in terms of constraint indices, etc ? Edit: Both examples yield very different IndexMaps here: For Code 1 I get idxmap.conmap: Dict{MathOptInterface.ConstraintIndex,MathOptInterface.ConstraintIndex} with 17 entries:
ConstraintIndex{ScalarAffineFunction{Float64},LessThan{Float64}}(4) => ConstraintIndex{ScalarAffineFunction{Float64},LessThan{Float64}}(3)
ConstraintIndex{ScalarAffineFunction{Float64},LessThan{Float64}}(6) => ConstraintIndex{ScalarAffineFunction{Float64},LessThan{Float64}}(5)
ConstraintIndex{VectorOfVariables,PositiveSemidefiniteConeTriangle}(16) => ConstraintIndex{VectorOfVariables,PositiveSemidefiniteConeTriangle}(14)
ConstraintIndex{VectorAffineFunction{Float64},Zeros}(19) => ConstraintIndex{VectorAffineFunction{Float64},Zeros}(17)
ConstraintIndex{ScalarAffineFunction{Float64},LessThan{Float64}}(10) => ConstraintIndex{ScalarAffineFunction{Float64},LessThan{Float64}}(9)
ConstraintIndex{VectorOfVariables,PositiveSemidefiniteConeTriangle}(18) => ConstraintIndex{VectorOfVariables,PositiveSemidefiniteConeTriangle}(16)
ConstraintIndex{ScalarAffineFunction{Float64},LessThan{Float64}}(7) => ConstraintIndex{ScalarAffineFunction{Float64},LessThan{Float64}}(6)
ConstraintIndex{ScalarAffineFunction{Float64},LessThan{Float64}}(11) => ConstraintIndex{ScalarAffineFunction{Float64},LessThan{Float64}}(10)
ConstraintIndex{VectorOfVariables,PositiveSemidefiniteConeTriangle}(13) => ConstraintIndex{VectorOfVariables,PositiveSemidefiniteConeTriangle}(11)
ConstraintIndex{ScalarAffineFunction{Float64},LessThan{Float64}}(9) => ConstraintIndex{ScalarAffineFunction{Float64},LessThan{Float64}}(8)
ConstraintIndex{VectorOfVariables,PositiveSemidefiniteConeTriangle}(14) => ConstraintIndex{VectorOfVariables,PositiveSemidefiniteConeTriangle}(12)
ConstraintIndex{ScalarAffineFunction{Float64},LessThan{Float64}}(5) => ConstraintIndex{ScalarAffineFunction{Float64},LessThan{Float64}}(4)
ConstraintIndex{VectorOfVariables,PositiveSemidefiniteConeTriangle}(15) => ConstraintIndex{VectorOfVariables,PositiveSemidefiniteConeTriangle}(13)
ConstraintIndex{ScalarAffineFunction{Float64},LessThan{Float64}}(3) => ConstraintIndex{ScalarAffineFunction{Float64},LessThan{Float64}}(2)
ConstraintIndex{ScalarAffineFunction{Float64},LessThan{Float64}}(8) => ConstraintIndex{ScalarAffineFunction{Float64},LessThan{Float64}}(7)
ConstraintIndex{VectorOfVariables,PositiveSemidefiniteConeTriangle}(17) => ConstraintIndex{VectorOfVariables,PositiveSemidefiniteConeTriangle}(15)
ConstraintIndex{ScalarAffineFunction{Float64},LessThan{Float64}}(2) => ConstraintIndex{ScalarAffineFunction{Float64},LessThan{Float64}}(1) for Code 2 I get: Dict{MathOptInterface.ConstraintIndex,MathOptInterface.ConstraintIndex} with 7 entries:
ConstraintIndex{VectorOfVariables,PositiveSemidefiniteConeTriangle}(5) => ConstraintIndex{VectorOfVariables,PositiveSemidefiniteConeTriangle}(5)
ConstraintIndex{VectorOfVariables,PositiveSemidefiniteConeTriangle}(6) => ConstraintIndex{VectorOfVariables,PositiveSemidefiniteConeTriangle}(6)
ConstraintIndex{VectorOfVariables,PositiveSemidefiniteConeTriangle}(3) => ConstraintIndex{VectorOfVariables,PositiveSemidefiniteConeTriangle}(3)
ConstraintIndex{VectorOfVariables,PositiveSemidefiniteConeTriangle}(4) => ConstraintIndex{VectorOfVariables,PositiveSemidefiniteConeTriangle}(4)
ConstraintIndex{VectorOfVariables,PositiveSemidefiniteConeTriangle}(1) => ConstraintIndex{VectorOfVariables,PositiveSemidefiniteConeTriangle}(1)
ConstraintIndex{VectorOfVariables,PositiveSemidefiniteConeTriangle}(2) => ConstraintIndex{VectorOfVariables,PositiveSemidefiniteConeTriangle}(2)
ConstraintIndex{VectorAffineFunction{Float64},Zeros}(7) => ConstraintIndex{VectorAffineFunction{Float64},Zeros}(7) |
I think the only difference is that in the second case, the model will be emptied by the CachingOptimizer (instead of having a fresh new one) and the cache that will be copied to COSMO will have different indices (since it will have applied the deletion).
So the IndexMaps will be different indeed |
- The variable indices that appear as the column numbers in the constraint matrix `A` have to be mapped through the `idxmap` before assembling the matrix.
Fixed in f90cc62 The problem was that I didn't map the variable indices involved in the constraints through the |
COSMO v0.5.0 is failing the
dsos_horn
test of SumOfSquares with:See https://github.com/JuliaOpt/SumOfSquares.jl/blob/master/test/Tests/horn.jl
The text was updated successfully, but these errors were encountered: