Skip to content

Commit 5ad939e

Browse files
committed
fix coefficients vector size
1 parent 39263a4 commit 5ad939e

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/MOI/MOI_wrapper.jl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2582,12 +2582,14 @@ and it applies to the lower bound if ā > 0.
25822582
function _farkas_variable_dual(model::Optimizer, col::Int64)
25832583
nvars = length(model.variable_info)
25842584
nrows = length(model.affine_constraint_info)
2585-
mstart = Array{Cint}(undef,2)
2586-
mrwind = Array{Cint}(undef,nrows)
2587-
dmatval = Array{Float64}(undef,nrows)
25882585
ncoeffs = Array{Cint}(undef,1)
2586+
getcols(model.inner, C_NULL, C_NULL, C_NULL, nrows, ncoeffs, col, col)
2587+
ncoeffs_ = ncoeffs[1]
2588+
mstart = Array{Cint}(undef,2)
2589+
mrwind = Array{Cint}(undef,ncoeffs_)
2590+
dmatval = Array{Float64}(undef,ncoeffs_)
25892591
getcols(model.inner, mstart, mrwind, dmatval, nrows, ncoeffs, col, col)
2590-
return dmatval' * model.cached_solution.linear_dual
2592+
return sum(v * model.cached_solution.linear_dual[i + 1] for (i, v) in zip(mrwind, dmatval))
25912593
end
25922594

25932595
function MOI.get(

0 commit comments

Comments
 (0)