-
-
Notifications
You must be signed in to change notification settings - Fork 394
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 #3450
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
Here's a more complicated example, taken from https://github.com/mitchphillipson/GAMS_to_JuMP/blob/70017814dca5b6eb70f5b346ed19e64c5845c106/Models/12%20-%20Expected%20Utility/insurance.jl#L65-L99 julia> pi = 0.01
0.01
julia> L = 0.5
0.5
julia> γ = 0.02
0.02
julia> σ = 0.5
0.5
julia> ρ = 1 - 1 / 0.5
-1.0
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, EU, start = 1)
EU
julia> @variable(model, EV, start = 1)
EV
julia> @variable(model, C_G, start = 1)
C_G
julia> @variable(model, C_B, start = 1)
C_B
julia> @variable(model, K, start = 1)
K
julia> @constraints(model, begin
EU - ((1 - pi) * C_G^ρ / ρ + pi * C_B^ρ / ρ) ⟂ EU
EV - 100 * (((1 - pi) * C_G^ρ + pi * C_B^ρ)^(1 / ρ) - 1) ⟂ EV
C_G - (1 - γ * K) ⟂ C_G
C_B - (1 - L + (1 - γ) * K) ⟂ C_B
γ * ((1 - pi) * C_G^(ρ - 1) + pi * C_B^(ρ - 1)) - pi * C_B^(ρ - 1) ⟂ K
end)
([EU - (((0.99 * (C_G ^ -1.0)) / -1.0) + ((0.01 * (C_B ^ -1.0)) / -1.0)), +(EU)] ∈ MathOptInterface.Complements(2), [EV - (100.0 * ((((0.99 * (C_G ^ -1.0)) + (0.01 * (C_B ^ -1.0))) ^ -1.0) - 1.0)), +(EV)] ∈ MathOptInterface.Complements(2), [C_G + 0.02 K - 1, C_G] ∈ MathOptInterface.Complements(2), [C_B - 0.98 K - 0.5, C_B] ∈ MathOptInterface.Complements(2), [(0.02 * ((0.99 * (C_G ^ -2.0)) + (0.01 * (C_B ^ -2.0)))) - (0.01 * (C_B ^ -2.0)), +(K)] ∈ 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 2.2871e+00 0.0e+00 (f[ 1])
1 1 0 5 5.2034e-01 1.0e+00 0.0e+00 (f[ 2])
pn_search terminated: no basis change.
Major Iteration Log
major minor func grad residual step type prox inorm (label)
0 0 2 2 5.2034e-01 I 0.0e+00 5.2e-01 (f[ 2])
1 1 3 3 1.0494e-01 1.0e+00 SO 0.0e+00 1.0e-01 (f[ 2])
2 1 4 4 1.8864e-02 1.0e+00 SO 0.0e+00 1.9e-02 (f[ 2])
3 1 5 5 6.1192e-04 1.0e+00 SO 0.0e+00 6.1e-04 (f[ 2])
4 1 6 6 5.9024e-07 1.0e+00 SO 0.0e+00 5.9e-07 (f[ 2])
Major Iterations. . . . 4
Minor Iterations. . . . 4
Restarts. . . . . . . . 0
Crash Iterations. . . . 1
Gradient Steps. . . . . 0
Function Evaluations. . 6
Gradient Evaluations. . 6
Basis Time. . . . . . . 0.000038
Total Time. . . . . . . 0.000949
Residual. . . . . . . . 5.902418e-07
julia> value(EU), value(EV), value(C_G), value(C_B), value(K)
(-1.0083430730335787, -0.8274042096088718, 0.9959051992930924, 0.7006452346384702, 0.20474003534537774) |
odow
commented
Aug 15, 2023
odow
commented
Aug 15, 2023
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## od/nlp-expr #3450 +/- ##
===============================================
- Coverage 97.94% 96.51% -1.44%
===============================================
Files 37 37
Lines 5412 4904 -508
===============================================
- Hits 5301 4733 -568
- Misses 111 171 +60
☔ View full report in Codecov by Sentry. |
blegat
reviewed
Aug 16, 2023
odow
commented
Aug 16, 2023
odow
added a commit
that referenced
this pull request
Aug 25, 2023
odow
added a commit
that referenced
this pull request
Aug 26, 2023
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.
Tests won't pass because requires new tag of MOI.
But this is working with
PATHSolver#od/nlp-expr
cc @mitchphillipson we're very close