-
Notifications
You must be signed in to change notification settings - Fork 15
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
Add support for VectorNonlinearFunction #82
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 task
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #82 +/- ##
==========================================
+ Coverage 93.66% 94.09% +0.42%
==========================================
Files 3 3
Lines 379 440 +61
==========================================
+ Hits 355 414 +59
- Misses 24 26 +2
☔ View full report in Codecov by Sentry. |
And here's the JuMP demo julia> using JuMP, PATHSolver
julia> model = Model(PATHSolver.Optimizer)
A JuMP Model
Feasibility problem with:
Variables: 0
Model mode: AUTOMATIC
CachingOptimizer state: EMPTY_OPTIMIZER
Solver name: Path 5.0.03
julia> @variable(model, 0 <= x[1:4] <= 10)
4-element Vector{VariableRef}:
x[1]
x[2]
x[3]
x[4]
julia> @constraints(model, begin
-x[3]^2.0 - x[4] + 2 ⟂ x[1]
x[3]^3.0 - 2x[4]^2.0 + 2 ⟂ x[2]
x[1]^5.0 - x[2] + 2x[3] - 2x[4] - 2 ⟂ x[3]
x[1] + 2x[2]^3.0 - 2x[3] + 4x[4] - 6 ⟂ x[4]
end)
([+(-(*(-1.0, ^(x[3], 2.0)), x[4]), 2.0), x[1]] ∈ MathOptInterface.Complements(2), [+(-(^(x[3], 3.0), *(2.0, ^(x[4], 2.0))), 2.0), x[2]] ∈ MathOptInterface.Complements(2), [-(-(+(-(^(x[1], 5.0), x[2]), 2 x[3]), 2 x[4]), 2.0), x[3]] ∈ MathOptInterface.Complements(2), [-(+(-(+(x[1], *(2.0, ^(x[2], 3.0))), 2 x[3]), 4 x[4]), 6.0), x[4]] ∈ MathOptInterface.Complements(2))
julia> optimize!(model)
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 9.3949e+00 0.0e+00 (f[ 4])
1 4 3 2 7.7898e+00 4.1e-01 0.0e+00 (f[ 1])
2 5 1 3 1.4635e+00 1.0e+00 0.0e+00 (f[ 3])
3 6 0 3 1.1831e+00 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 7 4 1.1831e+00 I 0.0e+00 1.2e+00 (f[ 3])
1 1 8 5 1.0633e+00 1.0e+00 SO 0.0e+00 1.1e+00 (f[ 3])
2 1 9 6 9.7034e-01 1.0e+00 SO 0.0e+00 9.7e-01 (f[ 3])
3 3 10 7 1.5017e+00 1.0e+00 SO 0.0e+00 1.2e+00 (f[ 4])
4 2 11 8 1.4820e+00 1.0e+00 SO 0.0e+00 1.2e+00 (f[ 4])
5 1 12 9 1.4756e+00 1.0e+00 SO 0.0e+00 1.2e+00 (f[ 4])
6 1 13 10 1.4483e+00 1.0e+00 SO 0.0e+00 1.2e+00 (f[ 4])
7 1 14 11 1.3317e+00 1.0e+00 SO 0.0e+00 1.1e+00 (f[ 4])
8 1 15 12 1.0594e+00 1.0e+00 SO 0.0e+00 1.0e+00 (f[ 4])
9 1 16 13 5.7505e-01 1.0e+00 SO 0.0e+00 5.7e-01 (f[ 4])
10 1 17 14 7.6079e-02 1.0e+00 SO 0.0e+00 7.6e-02 (f[ 4])
11 1 18 15 1.0305e-03 1.0e+00 SO 0.0e+00 1.0e-03 (f[ 4])
12 1 19 16 1.8656e-07 1.0e+00 SO 0.0e+00 1.9e-07 (f[ 4])
Major Iterations. . . . 12
Minor Iterations. . . . 15
Restarts. . . . . . . . 0
Crash Iterations. . . . 3
Gradient Steps. . . . . 0
Function Evaluations. . 19
Gradient Evaluations. . 16
Basis Time. . . . . . . 0.000051
Total Time. . . . . . . 0.001205
Residual. . . . . . . . 1.865551e-07
julia> value.(x)
4-element Vector{Float64}:
1.2847523472583888
0.972916458993744
0.909376156748673
1.173035005537013 |
This was referenced Jun 6, 2023
odow
force-pushed
the
od/nlp-expr
branch
2 times, most recently
from
June 9, 2023 04:02
21b68d2
to
ca10a15
Compare
odow
changed the title
WIP: add support for VectorNonlinearFunction
Add support for VectorNonlinearFunction
Jun 9, 2023
odow
commented
Aug 14, 2023
odow
commented
Aug 16, 2023
last_col = 0 | ||
# We need to zero all entries up front in case some rows do not | ||
# appear in the Jacobian. | ||
len .= Cint(0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was a tricky segfault to track down 😄
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #87