Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle failure of linear solve #25

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down
1 change: 1 addition & 0 deletions src/MixedComplementarityProblems.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
6 changes: 6 additions & 0 deletions src/solver.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Loading