Skip to content

Comments

Update tests for SCS.jl@2#216

Merged
odow merged 6 commits intomasterfrom
od/scs-2
Feb 17, 2026
Merged

Update tests for SCS.jl@2#216
odow merged 6 commits intomasterfrom
od/scs-2

Conversation

@odow
Copy link
Member

@odow odow commented Feb 17, 2026

No description provided.

@odow
Copy link
Member Author

odow commented Feb 17, 2026

The SCS issue is unrelated to POI:

julia> import SCS

julia> import MathOptInterface as MOI

julia> model = MOI.instantiate(SCS.Optimizer; with_cache_type = Float64)
MOIU.CachingOptimizer
├ state: EMPTY_OPTIMIZER
├ mode: AUTOMATIC
├ model_cache: MOIU.UniversalFallback{MOIU.GenericModel{Float64, MOIU.ObjectiveContainer{Float64}, MOIU.VariablesContainer{Float64}, MOIU.MatrixOfConstraints{Float64, MOIU.MutableSparseMatrixCSC{Float64, Int64, MOIU.ZeroBasedIndexing}, SCS._SetConstants{Float64}, SCS._Cones{Float64}}}}
│ ├ ObjectiveSense: FEASIBILITY_SENSE
│ ├ ObjectiveFunctionType: MOI.ScalarAffineFunction{Float64}
│ ├ NumberOfVariables: 0
│ └ NumberOfConstraints: 0
└ optimizer: SCS.Optimizer
  ├ ObjectiveSense: unknown
  ├ ObjectiveFunctionType: unknown
  ├ NumberOfVariables: unknown
  └ NumberOfConstraints: unknown

julia> x = MOI.add_variable(model)
MOI.VariableIndex(1)

julia> f = MOI.Utilities.vectorize([1.0 * x - 1.0])
┌                               ┐
│-1.0 + 1.0 MOI.VariableIndex(1)│
└                               ┘

julia> c = MOI.add_constraint(model, f, MOI.Nonnegatives(1))
MathOptInterface.ConstraintIndex{MathOptInterface.VectorAffineFunction{Float64}, MathOptInterface.Nonnegatives}(1)

julia> MOI.modify(model, c, MOI.MultirowChange(x, [(1, 2.0)]))
ERROR: MathOptInterface.ModifyConstraintNotAllowed{MathOptInterface.VectorAffineFunction{Float64}, MathOptInterface.Nonnegatives, MathOptInterface.MultirowChange{Float64}}:

## Cause

Modifying the constraints MathOptInterface.ConstraintIndex{MathOptInterface.VectorAffineFunction{Float64}, MathOptInterface.Nonnegatives}(1) with MathOptInterface.MultirowChange{Float64}(MOI.VariableIndex(1), [(1, 2.0)]) cannot be performed

## Fixing this error

An `MOI.NotAllowedError` error occurs when you have tried to do something that
is not implemented by the solver.

The most common way to fix this error is to wrap the optimizer in a
`MOI.Utilities.CachingOptimizer`.

For example, if you are using `JuMP.Model` or `JuMP.set_optimizer`, do:
```julia
model = JuMP.Model(optimizer; with_cache_type = Float64)
model = JuMP.GenericModel{T}(optimizer; with_cache_type = T)
JuMP.set_optimizer(model, optimizer; with_cache_type = Float64)
```
Similarly, if you are using `MOI.instantiate`, do:
```julia
model = MOI.instantiate(optimizer; with_cache_type = Float64)
```

Stacktrace:
 [1] throw_modify_not_allowed(ci::MathOptInterface.ConstraintIndex{…}, args::MathOptInterface.MultirowChange{…})
   @ MathOptInterface ~/.julia/dev/MathOptInterface/src/modifications.jl:37
 [2] modify(model::MathOptInterface.Utilities.MatrixOfConstraints{…}, ci::MathOptInterface.ConstraintIndex{…}, change::MathOptInterface.MultirowChange{…})
   @ MathOptInterface ~/.julia/dev/MathOptInterface/src/modifications.jl:108
 [3] modify(model::MathOptInterface.Utilities.GenericModel{…}, ci::MathOptInterface.ConstraintIndex{…}, change::MathOptInterface.MultirowChange{…})
   @ MathOptInterface.Utilities ~/.julia/dev/MathOptInterface/src/Utilities/model.jl:565
 [4] modify(uf::MathOptInterface.Utilities.UniversalFallback{…}, ci::MathOptInterface.ConstraintIndex{…}, change::MathOptInterface.MultirowChange{…})
   @ MathOptInterface.Utilities ~/.julia/dev/MathOptInterface/src/Utilities/universalfallback.jl:863
 [5] modify(m::MathOptInterface.Utilities.CachingOptimizer{…}, cindex::MathOptInterface.ConstraintIndex{…}, change::MathOptInterface.MultirowChange{…})
   @ MathOptInterface.Utilities ~/.julia/dev/MathOptInterface/src/Utilities/cachingoptimizer.jl:596
 [6] top-level scope
   @ REPL[74]:1
Some type information was truncated. Use `show(err)` to see complete types.

@codecov
Copy link

codecov bot commented Feb 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.62%. Comparing base (4f90a84) to head (81361a0).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #216   +/-   ##
=======================================
  Coverage   99.62%   99.62%           
=======================================
  Files           9        9           
  Lines        1878     1882    +4     
=======================================
+ Hits         1871     1875    +4     
  Misses          7        7           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@odow odow merged commit 0032eb7 into master Feb 17, 2026
8 checks passed
@odow odow deleted the od/scs-2 branch February 17, 2026 23:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant