Skip to content
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

Document storage of constraints #569

Merged
merged 2 commits into from Nov 13, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/Utilities/model.jl
@@ -1,3 +1,19 @@
## Storage of constraints
#
# All `F`-in-`S` constraints are stored in a vector of `C{F, S}`. The index in
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

C isn't a very readable name, any possible improvements?

# this vector of a constraint of index `ci::MOI.ConstraintIndex{F, S}` is
# given by `model.constrmap[ci.value]`. The advantage of this representation is
# that it does not require any dictionary hence it never needs to compute a
# hash.
#
# It may seem redundant to store the constraint index `ci` as well as the
# function and sets in the tuple but it is used to efficiently implement the
# getter for `MOI.ListOfConstraintIndices{F, S}`. It is also used to implement
# `MOI.delete`. Indeed, when a constraint is deleted, it is removed from the
# vector hence the index in the vector of all the functions that were stored
# after must be decreased by one. As the constraint index is stored in the
# vector, it readily gives the entries of `model.constrmap` that need to be
# updated.
const C{F, S} = Tuple{CI{F, S}, F, S}

const EMPTYSTRING = ""
Expand Down