-
Notifications
You must be signed in to change notification settings - Fork 25
Solution Summary Addition #435
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
Merged
Merged
Changes from 18 commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
07a9dfd
Added Rocket case study example.
75188df
Added additional information, variable definitions and clarified goal…
ecabacb
Added objective value test for final time.
c8c05ee
Added multi-objective support, modifed relevant doc strings and added…
c1c70a0
Merge branch 'master' into master
PetiteChouette 84d5864
Added testing segments for vectors to support multi-objective optimiz…
86e4963
Merge branch 'master' of https://github.com/PetiteChouette/InfiniteOp…
7dfaa78
Fixed additional component of markdown file for objective.
cdf8c5f
Added another fix in the objective markdown file to work as intended.
76a0c87
Additonal fix to the given output to match expected output for docume…
7fab851
Fixed typo in documentation.
06c72ae
Fixed additional typo.
326d30e
Added solution_summary, with accompanying backend, and assert_is_solv…
6a39ff1
Merge branch 'infiniteopt:master' into master
PetiteChouette 499e937
Typo fix
459af16
Merge branch 'master' of https://github.com/PetiteChouette/InfiniteOp…
bc1e34a
Typo fix
7810d66
Typo fix, change in phrasing.
7d49f8e
Merge branch 'master' into master
pulsipher 9846b82
Added tests for new functions in backend and results test files. Alte…
cd37a8c
Merge branch 'master' of https://github.com/PetiteChouette/InfiniteOp…
99ff2bc
Merge branch 'master' into master
PetiteChouette bddd726
Fixed wrong JuMP name call.
1bd5bd5
Fixed backend test.
e0edcb5
Altered backend test to look for the warning specifically.
f8e925a
Fixed typo in results for definition of solutionsummary for JuMP back…
8f4b04e
Changes to results test.
c428514
Apply suggestion from @pulsipher
pulsipher 18a6e97
updates
pulsipher 695cea0
add docstring
pulsipher File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -162,6 +162,135 @@ function JuMP.is_solved_and_feasible( | |||||
| return ret | ||||||
| end | ||||||
|
|
||||||
| """ | ||||||
| JuMP.solution_summary( | ||||||
| model::InfiniteModel; | ||||||
| result::Int = 1, | ||||||
| verbose::Bool = false, | ||||||
| ) | ||||||
|
|
||||||
| Extend [`JuMP.solution_summary`](@ref) to return the summary of the | ||||||
| optimization solution. This method utilizes the solution_summary backend and prints solution information and | ||||||
| termination status. | ||||||
| - `result::Int = 1`: indexes the solution result to be queried. | ||||||
| - `verbose::Bool = false`: If `true`, throws a warning as it is not currently supported. | ||||||
|
|
||||||
| Extend [`JuMP.solution_summary`](https://jump.dev/JuMP.jl/v1/api/JuMP/#solution_summary)) | ||||||
| for `model`. See the JuMP docs details. | ||||||
|
|
||||||
| **Example** | ||||||
| ```julia-repl | ||||||
| julia> model = Model(Ipopt.Optimizer); | ||||||
|
|
||||||
| julia> solution_summary(model) | ||||||
|
|
||||||
| Infinite model showing results with: A TranscriptionBackend that uses a | ||||||
| A JuMP Model | ||||||
| ├ solver: HiGHS | ||||||
| ├ objective_sense: MAX_SENSE | ||||||
| │ └ objective_function_type: AffExpr | ||||||
| ├ num_variables: 17 | ||||||
| ├ num_constraints: 18 | ||||||
| │ ├ AffExpr in MOI.LessThan{Float64}: 1 | ||||||
| │ └ VariableRef in MOI.ZeroOne: 17 | ||||||
| └ Names registered in the model: none | ||||||
| solution_summary(; result = 1, verbose = false) | ||||||
| ├ solver_name : HiGHS | ||||||
| ├ Termination | ||||||
| │ ├ termination_status : OPTIMAL | ||||||
| │ ├ result_count : 1 | ||||||
| │ ├ raw_status : kHighsModelStatusOptimal | ||||||
| │ └ objective_bound : 9.50100e+02 | ||||||
| ├ Solution (result = 1) | ||||||
| │ ├ primal_status : FEASIBLE_POINT | ||||||
| │ ├ dual_status : NO_SOLUTION | ||||||
| │ ├ objective_value : 9.50100e+02 | ||||||
| │ ├ dual_objective_value : NaN | ||||||
| │ └ relative_gap : 0.00000e+00 | ||||||
| └ Work counters | ||||||
| ├ solve_time (sec) : 6.86052e-02 | ||||||
| ├ simplex_iterations : 10 | ||||||
| ├ barrier_iterations : -1 | ||||||
| └ node_count : 1 | ||||||
| ``` | ||||||
| """ | ||||||
|
|
||||||
| function JuMP.solution_summary( | ||||||
| model::InfiniteModel; | ||||||
| result::Int = 1, | ||||||
| verbose::Bool = false, | ||||||
| ) | ||||||
| backend = model.backend | ||||||
| println("Infinite model showing results with: ", backend) | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| return JuMP.solution_summary(backend; result=result, verbose=verbose) | ||||||
|
|
||||||
| end | ||||||
|
|
||||||
| """ | ||||||
| JuMP.assert_is_solved_and_feasible( | ||||||
| model::InfiniteModel; | ||||||
| result::Int = 1, | ||||||
| kwargs..., | ||||||
| ) | ||||||
|
|
||||||
| Extend [`JuMP.is_solved_and_feasible`](@ref) to return whether or not the model completed optimization and has found a | ||||||
| feasible solution. | ||||||
| - `result::Int = 1`: indexes the solution result to be queried. | ||||||
| The keyword arguments `kwargs` depend on the transformation backend that is | ||||||
| being used. | ||||||
| If the return is false, assert_is_solved_and_feasible errors with an error message, along with a solution_summary to | ||||||
| help in debugging. | ||||||
|
|
||||||
| Extend [`JuMP.assert_is_solved_and_feasible`](https://jump.dev/JuMP.jl/v1/api/JuMP/#assert_is_solved_and_feasible)) | ||||||
| for `model`. See the JuMP docs details. | ||||||
| For new transformation backend types, this relies on `JuMP.is_solved_and_feasible`. | ||||||
|
|
||||||
| **Example** | ||||||
| ```julia-repl | ||||||
| julia> model = Model(Ipopt.Optimizer); | ||||||
|
|
||||||
| julia> assert_is_solved_and_feasible(model) | ||||||
|
|
||||||
| ERROR: The model was not solved correctly. Here is the output of `solution_summary` to help debug why this happened: | ||||||
|
|
||||||
| solution_summary(; result = 1, verbose = false) | ||||||
| ├ solver_name : HiGHS | ||||||
| ├ Termination | ||||||
| │ ├ termination_status : OPTIMAL | ||||||
| │ ├ result_count : 1 | ||||||
| │ ├ raw_status : kHighsModelStatusOptimal | ||||||
| │ └ objective_bound : -0.00000e+00 | ||||||
| ├ Solution (result = 1) | ||||||
| │ ├ primal_status : FEASIBLE_POINT | ||||||
| │ ├ dual_status : NO_SOLUTION | ||||||
| │ ├ objective_value : 0.00000e+00 | ||||||
| │ ├ dual_objective_value : NaN | ||||||
| │ └ relative_gap : 0.00000e+00 | ||||||
| └ Work counters | ||||||
| ├ solve_time (sec) : 1.78261e-02 | ||||||
| ├ simplex_iterations : 0 | ||||||
| ├ barrier_iterations : -1 | ||||||
| └ node_count : 0 | ||||||
| ``` | ||||||
| """ | ||||||
| function JuMP.assert_is_solved_and_feasible( | ||||||
| model::InfiniteModel; | ||||||
| result::Int = 1, | ||||||
| kwargs..., | ||||||
| ) | ||||||
| if !JuMP.is_solved_and_feasible(model; result, kwargs...) | ||||||
| error( | ||||||
| string( | ||||||
| "The model was not solved correctly. Here is the output of ", | ||||||
| "`solution_summary` to help debug why this happened:\n\n", | ||||||
| JuMP.solution_summary(model; result), | ||||||
| "\n", | ||||||
| ), | ||||||
| ) | ||||||
| end | ||||||
| return | ||||||
| end | ||||||
|
|
||||||
| ################################################################################ | ||||||
| # VALUE QUERIES | ||||||
| ################################################################################ | ||||||
|
|
||||||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.