CLeARoboticsLab / MixedComplementarityProblems.jl

A custom interior point solver for mixed complementarity problems.
BSD 3-Clause "New" or "Revised" License
10 stars 3 forks source link

In place computation #14

Closed dfridovi closed 1 month ago

dfridovi commented 1 month ago

Employs in-place computation for Jacobians in the solver. There is more optimization that could be done here, but this is a first step.

Addresses #13.

dfridovi commented 1 month ago

Ok. Maybe the segfaults were an anomaly because I can't reproduce them now. However, the lane change example is waaaay slower than it used to be, so something is fishy. To reproduce:

] activate examples

then

includet("examples/TrajectoryExamples.jl")
TrajectoryExamples.run_lane_change_example()

and I see:

Progress: 100%|█████████████████████████████████████████| Time: 0:01:20

(it used to take ~1 s)

dfridovi commented 1 month ago

Ok fixed the bug! Was converting from sparse to dense in order to get ldiv! to work. Found a workaround. Might be worth revisiting this bit here in AutoDiff.jl @lassepe

https://github.com/CLeARoboticsLab/MixedComplementarityProblems.jl/blob/d1b37a1ab6ed00ffba43fb61b6ddd45bf3e919d8/src/AutoDiff.jl#L26

Anyway, now the example runs much faster:

julia> TrajectoryExamples.run_lane_change_example()
Progress: 100%|█████████████████████████████████████████| Time: 0:00:03