diff --git a/Project.toml b/Project.toml index 5ca8545..1b504c4 100644 --- a/Project.toml +++ b/Project.toml @@ -11,6 +11,7 @@ FiniteDiff = "6a86dc24-6348-571c-b903-95158fe2bd41" ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" LinearSolve = "7ed4a6bd-45f5-4d41-b270-4a48e9bafcae" +SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462" SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" SymbolicTracingUtils = "77ddf47f-b2ab-4ded-95ee-54f4fa148129" TrajectoryGamesBase = "ac1ac542-73eb-4349-ae1b-660ab3609574" @@ -24,6 +25,7 @@ FiniteDiff = "2.26.2" ForwardDiff = "0.10.38" LinearAlgebra = "1.11.0" LinearSolve = "2.38.0" +SciMLBase = "2.70.0" SparseArrays = "1.11.0" SymbolicTracingUtils = "0.1.1" TrajectoryGamesBase = "0.3.10" diff --git a/src/MixedComplementarityProblems.jl b/src/MixedComplementarityProblems.jl index f1288a8..cfa0641 100644 --- a/src/MixedComplementarityProblems.jl +++ b/src/MixedComplementarityProblems.jl @@ -6,6 +6,7 @@ using BlockArrays: blocks, blocksizes using TrajectoryGamesBase: to_blockvector using SymbolicTracingUtils: SymbolicTracingUtils as SymbolicTracingUtils using LinearSolve: LinearProblem, init, solve!, KrylovJL_GMRES +using SciMLBase: SciMLBase include("mcp.jl") include("solver.jl") diff --git a/src/solver.jl b/src/solver.jl index 1ac4510..37ba3ca 100644 --- a/src/solver.jl +++ b/src/solver.jl @@ -80,6 +80,12 @@ function solve( linsolve.A = ∇F + tol * I linsolve.b = -F solution = solve!(linsolve) + if !SciMLBase.successful_retcode(solution) + verbose && @warn "Linear solve failed. Exiting prematurely." + status = :failed + break + end + δz .= solution.u # Fraction to the boundary linesearch.