Those docs are for an old version of the package. Here are the new docs: Readme · PATHSolver.jl
julia> import PATHSolver
julia> import SparseArrays
julia> M = [
0 0 -1 -1
0 0 1 -2
1 -1 2 -2
1 2 -2 4
]
4×4 Matrix{Int64}:
0 0 -1 -1
0 0 1 -2
1 -1 2 -2
1 2 -2 4
julia> M_sparse = convert(
SparseArrays.SparseMatrixCSC{Cdouble,Cint},
SparseArrays.sparse(M),
)
4×4 SparseArrays.SparseMatrixCSC{Float64, Int32} with 12 stored entries:
⋅ ⋅ -1.0 -1.0
⋅ ⋅ 1.0 -2.0
1.0 -1.0 2.0 -2.0
1.0 2.0 -2.0 4.0
julia> q = Float64[2, 2, -2, -6]
4-element Vector{Float64}:
2.0
2.0
-2.0
-6.0
julia> z = zeros(4)
4-element Vector{Float64}:
0.0
0.0
0.0
0.0
julia> lb, ub = zeros(4), fill(100.0, 4)
([0.0, 0.0, 0.0, 0.0], [100.0, 100.0, 100.0, 100.0])
julia> status, sol, info = PATHSolver.solve_mcp(M_sparse, q, lb, ub, z)
Path 5.0.03 (Fri Jun 26 09:58:07 2020)
Written by Todd Munson, Steven Dirkse, Youngdae Kim, and Michael Ferris
Crash Log
major func diff size residual step prox (label)
0 0 1.2295e+01 0.0e+00 (f[ 4])
1 2 4 2 1.0267e+01 8.0e-01 0.0e+00 (f[ 1])
2 3 2 4 8.4839e-01 1.0e+00 0.0e+00 (f[ 4])
3 4 0 3 4.4409e-16 1.0e+00 0.0e+00 (f[ 3])
pn_search terminated: no basis change.
Major Iteration Log
major minor func grad residual step type prox inorm (label)
0 0 5 4 4.4409e-16 I 0.0e+00 4.4e-16 (f[ 3])
Major Iterations. . . . 0
Minor Iterations. . . . 0
Restarts. . . . . . . . 0
Crash Iterations. . . . 3
Gradient Steps. . . . . 0
Function Evaluations. . 5
Gradient Evaluations. . 4
Basis Time. . . . . . . 0.000013
Total Time. . . . . . . 0.000526
Residual. . . . . . . . 4.440892e-16
(PATHSolver.MCP_Solved, [2.8, 0.0, 0.8, 1.2], PATHSolver.Information(4.4408920985006247e-16, 0.0, 0.0, 0.000526, 1.3000000000000001e-5, 0.0, 0, 0, 3, 5, 4, 0, 0, 0, 0, false, false, false, true, false, false, false))
julia> sol
4-element Vector{Float64}:
2.8
0.0
0.8
1.2
julia> status
MCP_Solved::MCP_Termination = 1