Skip to main content

Enumerated Types and Type Extensions for MiniZinc

  • Conference paper
  • First Online:
  • 1047 Accesses

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 13292))

Abstract

Discrete optimisation problems often reason about finite sets of objects. While the underlying solvers will represent these objects as integer values, most modelling languages include enumerated types that allow the objects to be expressed as a set of names. Data attached to an object is made accessible through given arrays or functions from object to data. Enumerated types improve models by making them more self documenting, and by allowing type checking to point out modelling errors that may otherwise be hard to track down. But a frequent modelling pattern requires us to add new elements to a finite set of objects to represent extreme or default behaviour, or to combine sets of objects to reason about them jointly. Currently this requires us to map the extended object sets into integers, thus losing the benefits of using enumerated types. In this paper we introduce enumerated type extension, a restricted form of discriminated union types, to extend enumerated types without losing type safety, and default expressions to succinctly capture cases where we want to access data of extended types. The new language features allow for more concise and easily interpretable models that still support strong type checking and compilation to efficient solver-level models.

This is a preview of subscription content, log in via an institution.

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   69.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   89.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

Notes

  1. 1.

    This can be written both in ASCII as C\(^{-1}\) or using the Unicode character for \(^{-1}\).

  2. 2.

    https://github.com/minizinc/minizinc-benchmarks.

  3. 3.

    https://github.com/minizinc/minizinc-benchmarks.

  4. 4.

    Compiled as described in [10].

References

  1. Chenouard, R., Granvilliers, L., Soto, R.: Model-driven constraint programming. In: Proceedings of the 10th International ACM SIGPLAN Symposium on Principles and Practice of Declarative Programming, PPDP 2008 (2008). https://doi.org/10.1145/1389449.1389479

  2. Fourer, R., Kernighan, B.: AMPL: A Modeling Language for Mathematical Programming. Duxbury (2002)

    Google Scholar 

  3. Frisch, A.M., Stuckey, P.J.: The proper treatment of undefinedness in constraint languages. In: Gent, I.P. (ed.) CP 2009. LNCS, vol. 5732, pp. 367–382. Springer, Heidelberg (2009). https://doi.org/10.1007/978-3-642-04244-7_30

    Chapter  Google Scholar 

  4. Frisch, A.M., Harvey, W., Jefferson, C., Hernández, B.M., Miguel, I.: Essence: a constraint language for specifying combinatorial problems. Constraints 13(3), 268–306 (2008)

    Article  MathSciNet  MATH  Google Scholar 

  5. Golomb, S.W.: How to number a graph. In: Graph Theory and Computing. Academic Press (1972)

    Google Scholar 

  6. Hewson, J.A.: Constraint-based specification for system configuration. Ph.D. thesis, University of Edinburgh (2013)

    Google Scholar 

  7. Marriott, K., Nethercote, N., Rafeh, R., Stuckey, P., Garcia de la Banda, M., Wallace, M.: The design of the Zinc modelling language. Constraints 13(3), 229–267 (2008). https://doi.org/10.1007/s10601-008-9041-4

  8. Mears, C., Schutt, A., Stuckey, P.J., Tack, G., Marriott, K., Wallace, M.: Modelling with option types in MiniZinc. In: Simonis, H. (ed.) CPAIOR 2014. LNCS, vol. 8451, pp. 88–103. Springer, Cham (2014). https://doi.org/10.1007/978-3-319-07046-9_7

    Chapter  MATH  Google Scholar 

  9. Nethercote, N., Stuckey, P.J., Becket, R., Brand, S., Duck, G.J., Tack, G.: MiniZinc: towards a standard CP modelling language. In: Bessière, C. (ed.) CP 2007. LNCS, vol. 4741, pp. 529–543. Springer, Heidelberg (2007). https://doi.org/10.1007/978-3-540-74970-7_38

    Chapter  Google Scholar 

  10. Stuckey, P.J., Tack, G.: Compiling conditional constraints. In: Schiex, T., de Givry, S. (eds.) CP 2019. LNCS, vol. 11802, pp. 384–400. Springer, Cham (2019). https://doi.org/10.1007/978-3-030-30048-7_23

    Chapter  Google Scholar 

  11. Van Hentenryck, P.: The OPL Optimization Programming Language. MIT Press (1999)

    Google Scholar 

Download references

Acknowledgments

This research was partially supported by the OPTIMA ARC training centre IC200100009.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Peter J. Stuckey .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2022 Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Stuckey, P.J., Tack, G. (2022). Enumerated Types and Type Extensions for MiniZinc. In: Schaus, P. (eds) Integration of Constraint Programming, Artificial Intelligence, and Operations Research. CPAIOR 2022. Lecture Notes in Computer Science, vol 13292. Springer, Cham. https://doi.org/10.1007/978-3-031-08011-1_25

Download citation

  • DOI: https://doi.org/10.1007/978-3-031-08011-1_25

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-031-08010-4

  • Online ISBN: 978-3-031-08011-1

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics