MosekTools.jl
MosekTools.jl copied to clipboard
`MOSEK error 3915: There is no barx available for the solution type 2.`
This issue is probably related to #71.
The following PowerModelsDistribution
problem throws the following exception when using the Mosek solver. The issue is not present with other conic solvers like SCS.
using PowerModelsDistribution
using LinearAlgebra
using MosekTools, SCS
m = PowerModelsDistribution.Model()
for i in 1:10
add_bus!(m, "SS$i";
terminals = [1, 2, 3, 4],
grounded = [4],
vm_lb = [0.9, 0.9, 0.9, -0.1],
vm_ub = [1.1, 1.1, 1.1, 0.1]
)
end
add_linecode!(m, "16mm", diagm(fill(1.15, 3)), diagm(fill(0.092484, 3)))
add_linecode!(m, "70mm", diagm(fill(0.268, 3)), diagm(fill(0.080424772, 3)))
add_linecode!(m, "95mm", diagm(fill(0.193, 3)), diagm(fill(0.082309728, 3)))
add_linecode!(m, "150mm", diagm(fill(0.127, 3)), diagm(fill(0.08, 3)))
add_line!(m, "L0", "SS1", "SS2", [1, 2, 3, 4], [1, 2, 3, 4]; linecode="95mm", length=0.010)
add_line!(m, "L1", "SS1", "SS7", [1, 2, 3, 4], [1, 2, 3, 4]; linecode="95mm", length=0.160)
add_line!(m, "L2", "SS7", "SS9", [1, 2, 3, 4], [1, 2, 3, 4]; linecode="95mm", length=0.125)
add_line!(m, "L3", "SS9", "SS8", [1, 2, 3, 4], [1, 2, 3, 4]; linecode="95mm", length=0.125)
add_line!(m, "L4", "SS2", "SS3", [1, 2, 3, 4], [1, 2, 3, 4]; linecode="95mm", length=0.170)
add_line!(m, "L5", "SS3", "SS4", [1, 2, 3, 4], [1, 2, 3, 4]; linecode="95mm", length=0.200)
add_line!(m, "L6", "SS4", "SS6", [1, 2, 3, 4], [1, 2, 3, 4]; linecode="95mm", length=0.200)
add_line!(m, "L7", "SS4", "SS10", [1, 2, 3, 4], [1, 2, 3, 4]; linecode="70mm", length=0.110)
add_line!(m, "L8", "SS10", "SS5", [1, 2, 3, 4], [1, 2, 3, 4]; linecode="70mm", length=0.155)
add_voltage_source!(m, "PCC", "SS1", [1, 2, 3, 4]; pg_cost_parameters=[0.01, 12.2, 0.0])
add_vbase_default!(m, "SS1", 0.4)
add_load!(m, "LOAD1", "SS3", [1,2,3,4]; configuration=WYE, model=POWER, pd_nom=fill(10, 3), qd_nom=zeros(3))
add_load!(m, "LOAD2", "SS4", [1,2,3,4]; configuration=WYE, model=POWER, pd_nom=fill(10, 3), qd_nom=zeros(3))
add_load!(m, "LOAD3", "SS7", [1,2,3,4]; configuration=WYE, model=POWER, pd_nom=fill(10, 3), qd_nom=zeros(3))
add_load!(m, "LOAD4", "SS9", [1,2,3,4]; configuration=WYE, model=POWER, pd_nom=fill(10, 3), qd_nom=zeros(3))
julia> @time solution = solve_mc_opf(m, SDPUBFPowerModel, Mosek.Optimizer)
Problem
Name :
Objective sense : min
Type : CONIC (conic optimization problem)
Constraints : 1130
Cones : 0
Scalar variables : 501
Matrix variables : 12
Integer variables : 0
Optimizer started.
Presolve started.
Linear dependency checker started.
Linear dependency checker terminated.
Eliminator started.
Freed constraints in eliminator : 36
Eliminator terminated.
Eliminator started.
Freed constraints in eliminator : 0
Eliminator terminated.
Eliminator - tries : 2 time : 0.00
Lin. dep. - tries : 1 time : 0.00
Lin. dep. - number : 0
Presolve terminated. Time: 0.05
Problem
Name :
Objective sense : min
Type : CONIC (conic optimization problem)
Constraints : 1130
Cones : 0
Scalar variables : 501
Matrix variables : 12
Integer variables : 0
Optimizer - threads : 4
Optimizer - solved problem : the primal
Optimizer - Constraints : 954
Optimizer - Cones : 1
Optimizer - Scalar variables : 379 conic : 217
Optimizer - Semi-definite variables: 12 scalarized : 765
Factor - setup time : 0.00 dense det. time : 0.00
Factor - ML order time : 0.00 GP order time : 0.00
Factor - nonzeros before factor : 3.15e+04 after factor : 6.51e+04
Factor - dense dim. : 2 flops : 6.08e+06
ITE PFEAS DFEAS GFEAS PRSTATUS POBJ DOBJ MU TIME
0 3.5e+05 1.0e+00 1.0e+00 0.00e+00 0.000000000e+00 0.000000000e+00 1.0e+00 0.05
1 3.4e+04 9.6e-02 3.2e-01 -1.00e+00 4.807429355e-05 9.369142538e+00 9.6e-02 0.06
2 1.2e+03 3.3e-03 6.0e-02 -1.00e+00 1.567500347e-03 2.996151703e+02 3.3e-03 0.08
3 1.7e+02 4.9e-04 2.3e-02 -9.98e-01 1.072117175e-02 2.019305834e+03 4.9e-04 0.09
4 8.3e+01 2.3e-04 1.5e-02 -9.63e-01 2.678886496e-02 3.845959462e+03 2.3e-04 0.09
5 2.6e+01 7.4e-05 6.2e-03 -7.19e-01 8.419940658e-02 6.562508166e+03 7.4e-05 0.09
6 3.1e+00 8.8e-06 5.6e-04 -1.66e-01 1.853925308e-01 3.790287974e+03 8.8e-06 0.11
7 4.0e-01 1.1e-06 2.7e-05 8.04e-01 2.138253061e-01 5.500939222e+02 1.1e-06 0.11
8 8.6e-02 2.4e-07 2.6e-06 9.74e-01 2.304645372e-01 1.116011287e+02 2.4e-07 0.11
9 1.7e-02 4.8e-08 2.2e-07 9.94e-01 2.461047111e-01 1.928346096e+01 4.8e-08 0.13
10 2.2e-03 6.3e-09 9.6e-09 9.99e-01 2.576576567e-01 2.467891887e+00 6.3e-09 0.13
11 4.3e-04 1.2e-09 8.1e-10 1.00e+00 2.575984599e-01 6.840588861e-01 1.2e-09 0.14
12 5.3e-05 1.5e-10 3.6e-11 1.00e+00 2.583372403e-01 3.110143397e-01 1.5e-10 0.14
13 7.2e-06 2.0e-11 1.7e-12 1.02e+00 2.504743045e-01 2.570062596e-01 2.0e-11 0.14
14 5.4e-07 1.5e-12 1.9e-14 1.14e+00 1.994654662e-01 1.996050318e-01 1.5e-12 0.16
15 8.1e-08 2.4e-13 1.3e-15 1.48e+00 1.268711081e-01 1.268992901e-01 2.3e-13 0.16
16 8.8e-09 3.5e-14 4.4e-17 1.08e+00 1.208033165e-01 1.208061450e-01 2.5e-14 0.17
17 4.8e-10 3.2e-13 5.6e-19 1.02e+00 1.201295945e-01 1.201297476e-01 1.4e-15 0.17
Optimizer terminated. Time: 0.19
MOSEK error 3915: There is no barx available for the solution type 2.
ERROR: Mosek.MosekError(3915, "There is no barx available for the solution type 2.")
Stacktrace:
[1] getbarxj(task_::Mosek.Task, whichsol_::Mosek.Soltype, j_::Int32)
@ Mosek C:\Users\Cornejo\.julia\packages\Mosek\6LuE3\src\msk_functions.jl:2087
[2] getbarxj
@ C:\Users\Cornejo\.julia\packages\Mosek\6LuE3\src\msk_functions.jl:2077 [inlined]
[3] matrix_solution(m::MosekModel, sol::Mosek.Soltype)
@ MosekTools C:\Users\Cornejo\.julia\packages\MosekTools\sppJY\src\MosekTools.jl:268
[4] optimize!(m::MosekModel)
@ MosekTools C:\Users\Cornejo\.julia\packages\MosekTools\sppJY\src\MosekTools.jl:275
[5] optimize!(b::MathOptInterface.Bridges.LazyBridgeOptimizer{MosekModel})
@ MathOptInterface.Bridges C:\Users\Cornejo\.julia\packages\MathOptInterface\YDdD3\src\Bridges\bridge_optimizer.jl:319
[6] optimize!(m::MathOptInterface.Utilities.CachingOptimizer{MathOptInterface.AbstractOptimizer, MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.GenericModel{Float64, MathOptInterface.Utilities.ModelFunctionConstraints{Float64}}}})
@ MathOptInterface.Utilities C:\Users\Cornejo\.julia\packages\MathOptInterface\YDdD3\src\Utilities\cachingoptimizer.jl:252
[7] optimize!(model::JuMP.Model, optimizer_factory::Nothing; bridge_constraints::Bool, ignore_optimize_hook::Bool, kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ JuMP C:\Users\Cornejo\.julia\packages\JuMP\b3hGi\src\optimizer_interface.jl:185
[8] optimize! (repeats 2 times)
@ C:\Users\Cornejo\.julia\packages\JuMP\b3hGi\src\optimizer_interface.jl:157 [inlined]
[9] macro expansion
@ .\timing.jl:368 [inlined]
[10] optimize_model!(aim::SDPUBFPowerModel; relax_integrality::Bool, optimizer::Function, solution_processors::Vector{Function})
@ InfrastructureModels C:\Users\Cornejo\.julia\packages\InfrastructureModels\k2fNE\src\core\base.jl:397
[11] _solve_mc_model(data::Dict{String, Any}, model_type::Type, optimizer::typeof(Mosek.Optimizer), build_method::typeof(build_mc_opf); multinetwork::Bool, ref_extensions::Vector{Function}, solution_processors::Vector{Function}, relax_integrality::Bool, kwargs::Base.Iterators.Pairs{Symbol, Set{String}, Tuple{Symbol}, NamedTuple{(:global_keys,), Tuple{Set{String}}}})
@ PowerModelsDistribution C:\Users\Cornejo\.julia\packages\PowerModelsDistribution\YSSyF\src\prob\common.jl:48
[12] solve_mc_model(data::Dict{String, Any}, model_type::Type, optimizer::typeof(Mosek.Optimizer), build_mc::typeof(build_mc_opf); ref_extensions::Vector{Function}, multinetwork::Bool, global_keys::Set{String}, eng2math_extensions::Vector{Function}, eng2math_passthrough::Dict{String, Vector{String}}, make_pu_extensions::Vector{Function}, map_math2eng_extensions::Dict{String, Function}, make_si::Bool, make_si_extensions::Vector{Function}, dimensionalize_math_extensions::Dict{String, Dict{String, Vector{String}}}, kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ PowerModelsDistribution C:\Users\Cornejo\.julia\packages\PowerModelsDistribution\YSSyF\src\prob\common.jl:194
[13] solve_mc_model(data::Dict{String, Any}, model_type::Type, optimizer::Function, build_mc::Function)
@ PowerModelsDistribution C:\Users\Cornejo\.julia\packages\PowerModelsDistribution\YSSyF\src\prob\common.jl:184
[14] #solve_mc_opf#2008
@ C:\Users\Cornejo\.julia\packages\PowerModelsDistribution\YSSyF\src\prob\opf.jl:3 [inlined]
[15] solve_mc_opf(data::Dict{String, Any}, model_type::Type, solver::Function)
@ PowerModelsDistribution C:\Users\Cornejo\.julia\packages\PowerModelsDistribution\YSSyF\src\prob\opf.jl:3
[16] top-level scope
@ .\timing.jl:210 [inlined]
[17] top-level scope
@ .\REPL[87]:0
Yeah this looks identical to #71
This should fix it:
index 040ea48..d06f25f 100644
--- a/src/MosekTools.jl
+++ b/src/MosekTools.jl
@@ -319,7 +319,7 @@ function MOI.optimize!(m::Optimizer)
getprosta(m.task, MSK_SOL_ITG),
getskx(m.task, MSK_SOL_ITG),
getxx(m.task, MSK_SOL_ITG),
- matrix_solution(m, MSK_SOL_ITG),
+ Float64[],
Float64[],
Float64[],
Float64[],
@@ -336,7 +336,7 @@ function MOI.optimize!(m::Optimizer)
getprosta(m.task,MSK_SOL_BAS),
getskx(m.task,MSK_SOL_BAS),
getxx(m.task,MSK_SOL_BAS),
- matrix_solution(m, MSK_SOL_BAS),
+ Float64[],
getslx(m.task,MSK_SOL_BAS),
getsux(m.task,MSK_SOL_BAS),
Float64[],
This should fix it:
index 040ea48..d06f25f 100644 --- a/src/MosekTools.jl +++ b/src/MosekTools.jl @@ -319,7 +319,7 @@ function MOI.optimize!(m::Optimizer) getprosta(m.task, MSK_SOL_ITG), getskx(m.task, MSK_SOL_ITG), getxx(m.task, MSK_SOL_ITG), - matrix_solution(m, MSK_SOL_ITG), + Float64[], Float64[], Float64[], Float64[], @@ -336,7 +336,7 @@ function MOI.optimize!(m::Optimizer) getprosta(m.task,MSK_SOL_BAS), getskx(m.task,MSK_SOL_BAS), getxx(m.task,MSK_SOL_BAS), - matrix_solution(m, MSK_SOL_BAS), + Float64[], getslx(m.task,MSK_SOL_BAS), getsux(m.task,MSK_SOL_BAS), Float64[],
Where should I apply these changes exactly?
It worked!!!!!!!!!!!
Thanks a lot
Just FYI information then MSK_SOL_ITR is the only solution that is relevant SDPs at this point in time.
@ulfworsoe, I'm having the same issue, but when I try your suggestion, I get a zero vector (not feasible) as a solution to my problem. Do you have any suggestions on how to get the real solution to my problem?
I had the same issue, but your suggestion worked.