-
-
Notifications
You must be signed in to change notification settings - Fork 399
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
Print constraints/variables in set form instead of scalarized #2171
Comments
This requires a ton of finicky infrastructure that we previously removed (see, e.g., #795) and I think it's useful primarily for a narrow range of models where the code itself should be similarly simple to read, so the printing doesn't add much information. As soon as you have programmatic generation of the model and/or anonymous variables, it becomes a lot more complex to decide how to compress and print the index sets. Should we be remembering and presenting I'd prefer to not print the model or come up with more concise summaries when the full print-out is too large to be readable: #957. |
I guess the "concise summary" is what we're after. I'm aware of the code complexity issue. The motivation is, given a PowerSimulations.jl model, print a summary for the user showing what algebraic model they are solving. |
Closing because explicit printing now only happens with julia> model = Model()
A JuMP Model
Feasibility problem with:
Variables: 0
Model mode: AUTOMATIC
CachingOptimizer state: NO_OPTIMIZER
Solver name: No optimizer attached.
julia> @variable(model, x[1:2] >= 0)
2-element Vector{VariableRef}:
x[1]
x[2]
julia> @constraint(model, c[i = 1:2], x[i] + i >= 0)
2-element Vector{ConstraintRef{Model, MathOptInterface.ConstraintIndex{MathOptInterface.ScalarAffineFunction{Float64}, MathOptInterface.GreaterThan{Float64}}, ScalarShape}}:
c[1] : x[1] ≥ -1.0
c[2] : x[2] ≥ -2.0
julia> print(model)
Feasibility
Subject to
c[1] : x[1] ≥ -1.0
c[2] : x[2] ≥ -2.0
x[1] ≥ 0.0
x[2] ≥ 0.0
julia> show(model)
A JuMP Model
Feasibility problem with:
Variables: 2
`AffExpr`-in-`MathOptInterface.GreaterThan{Float64}`: 2 constraints
`VariableRef`-in-`MathOptInterface.GreaterThan{Float64}`: 2 constraints
Model mode: AUTOMATIC
CachingOptimizer state: NO_OPTIMIZER
Solver name: No optimizer attached.
Names registered in the model: c, x |
Currently, we get
@claytonpbarrows suggests that we simplify this printing to
where the expressions are taken directly from the macro form.
This is particularly useful in large models, where the number of unique (parameterized) constraints is small, but each constraint is indexed over a large set.
The text was updated successfully, but these errors were encountered: