-
Notifications
You must be signed in to change notification settings - Fork 97
Description
For now, MOI only supports scalar variables, i.e. real numbers (or subsets thereof). Complex numbers can be implemented as a pair of real numbers, as in https://github.com/jump-dev/ComplexOptInterface.jl. For constraint programming, I would need to represent intervals (i.e. a pair of integer values: the beginning and the end of the interval) and sequences of intervals (defined based on a series of intervals), but also graphs. This kind of needs spans several engines:
- CPLEX has specific types for these variables, and an interval cannot be constructed from other variables. In OPL (their modelling language): interval (also described more generally: https://www.ibm.com/support/knowledgecenter/SSSA5P_20.1.0/ilog.odms.cpo.help/refcppcpoptimizer/html/interval_variables.html) and sequence (high-level overview: https://www.ibm.com/support/knowledgecenter/SSSA5P_20.1.0/ilog.odms.cpo.help/refcppcpoptimizer/html/constraints_groups.html).
- OscaR is another CP engine that has similar requirements. This one has sequences (https://bitbucket.org/oscarlib/oscar/src/dev/oscar-cp/src/main/scala/oscar/cp/core/variables/CPSeqVar.scala and subclasses CPHeadSeqVar, CPInsertSeqVar), but also graphs (https://bitbucket.org/oscarlib/oscar/src/dev/oscar-cp/src/main/scala/oscar/cp/core/variables/CPGraphVar.scala).
- Gecode has set variables (https://www.gecode.org/doc-latest/MPG.pdf, Chapter 5).
How could this kind of variables fit into MOI? (Or an extension to MOI.) Typical functions cannot be applied on this kind of object: two intervals cannot really be summed up, or be greater than some constant, for instance.
Maybe renaming SingleVariable as SingleScalarVariable/SingleRealVariable (and so on for the other related objects)? This would leave space for something like SingleIntervalVariable, SingleSequenceVariable (and vectors), etc., but also SingleComplexVariable.
In a way, it could also solve some problems with supports_constraint: many CP constraints only make sense for integer variables (e.g., an array index), others are generalisable but are not always implemented as such (like counting values equal to something). With a SingleIntegerVariable, supports_constraint could directly check for the type of variables.