Skip to content

Commit

Permalink
📝 Document how to extend ConstraintRef printing
Browse files Browse the repository at this point in the history
  • Loading branch information
blegat committed Nov 6, 2018
1 parent e401193 commit 5b46dda
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/print.jl
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,14 @@ end
## Constraints
#------------------------------------------------------------------------

## Notes for extensions
# For a `ConstraintRef{ModelType, IndexType}` where `ModelType` is not
# `JuMP.Model` or `IndexType` is not `MathOptInterface.ConstraintIndex`, the
# methods `JuMP.name` and `JuMP.constraint_object` should be implemented for
# printing to work. If the `AbstractConstraint` returned by `constraint_object`
# is not `JuMP.ScalarConstraint` nor `JuMP.VectorConstraint`, then either
# `JuMP.jump_function` or `JuMP.function_string` and either `JuMP.moi_set` or
# `JuMP.in_set_string` should be implemented.
function Base.show(io::IO, ref::ConstraintRef)
print(io, constraint_string(REPLMode, name(ref), constraint_object(ref)))
end
Expand Down

0 comments on commit 5b46dda

Please sign in to comment.