MathOptAnalyzer main API
All the analysis modules in MathOptAnalyzer follow the same main API. The main function to perform an analysis is:
MathOptAnalyzer.analyze — Function
analyze(analyzer::AbstractAnalyzer, model::JuMP.GenericModel; kwargs...)Analyze a JuMP model using the specified analyzer. Depending on the analyzer, this keyword arguments might vary. This function will return an instance of AbstractData which contains the results of the analysis that can be further summarized or queried for issues.
See summarize, list_of_issues, and list_of_issue_types.
Once the analysis is performed, the resulting data structure can be summarized using:
MathOptAnalyzer.summarize — Function
summarize([io::IO,] AbstractData; model = nothing, verbose = true, max_issues = 10, kwargs...)Print a summary of the analysis results contained in AbstractData to the specified IO stream. If no IO stream is provided, it defaults to stdout. The model that led to the issue can be provided to model, it will be used to generate the name of variables and constraints in the issue summary. The verbose flag controls whether to print detailed information about each issue (if true) or a concise summary (if false). The max_issues argument controls the maximum number of issues to display in the summary. If there are more issues than max_issues, only the first max_issues will be displayed.
summarize([io::IO,] ::Type{T}; verbose = true) where {T<:AbstractIssue}This variant allows summarizing information of a specific type T (which must be a subtype of AbstractIssue). In the verbose case it will provide a text explaning the issue. In the non-verbose case it will provide just the issue name.
summarize([io::IO,] issue::AbstractIssue; model = nothing, verbose = true)This variant allows summarizing a single issue instance of type AbstractIssue. The model that led to the issue can be provided to model, it will be used to generate the name of variables and constraints in the issue summary.
Alternatively, you can also query the types of issues found in the analysis and summarize them individually. The following functions are useful for this:
MathOptAnalyzer.list_of_issue_types — Function
list_of_issue_types(data::AbstractData)Return a vector of DataType containing the types of issues found in the analysis results contained in data.
MathOptAnalyzer.list_of_issues — Function
list_of_issues(data::AbstractData, issue_type::Type{T}) where {T<:AbstractIssue}Return a vector of instances of T (which must be a subtype of AbstractIssue) found in the analysis results contained in data. This allows you to retrieve all instances of a specific issue type from the analysis results.
It is possible to extract data from the issues with the methods:
MathOptAnalyzer.variables — Function
variables(issue::MathOptAnalyzer.AbstractIssue, model::JuMP.GenericModel)Return the JuMP variable references associated to a particular issue.
sourceMathOptAnalyzer.variable — Function
variable(issue::MathOptAnalyzer.AbstractIssue, model::JuMP.GenericModel)Return the JuMP variable reference associated to a particular issue.
sourceMathOptAnalyzer.constraints — Function
constraintss(issue::MathOptAnalyzer.AbstractIssue, model::JuMP.GenericModel)Return the JuMP constraints reference associated to a particular issue.
sourceMathOptAnalyzer.constraint — Function
constraint(issue::MathOptAnalyzer.AbstractIssue, model::JuMP.GenericModel)Return the JuMP constraint reference associated to a particular issue.
sourceMathOptAnalyzer.set — Function
MathOptAnalyzer.values — Function
MathOptAnalyzer.value — Function
value(issue::AbstractIssue)Return the value associated to a particular issue. The value is a number with a different meaning depending on the type of issue. For example, for some numerical issues, it can be the coefficient value.
source