The Xpress Mosel language has evolved considerably over more than 20 years since its first release in 2001. Whilst continuously building out the available optimization features by adding support for new Solver features or new solvers (such as Constraint Programming with Xpress Kalis, Robust Optimization, Nonlinear Optimization, and most recently, Global Optimization), Mosel is increasingly used for the implementation of large-scale projects and general programming tasks. Therefore, recent releases of Xpress Mosel have built out the programming capabilities of the language along with providing support for new solver features.
In this blog we are going to present a variety of new features relating to the handling of numerical values in Mosel. At the same time, we discuss various extensions and updates to the solver modules going hand-in-hand with the introduction of the new Global Optimization solver.
New data type ‘int64’
Mosel’s basic type ‘integer’ relies on a 32-bit representation of integer numbers. However, in the context of continuously growing problem and data sizes it may become necessary to work with larger integer numbers, a prominent use case being integer-valued IDs for data entries held in databases. Mosel therefore now defines a new type ‘int64’. Implemented in the open-source module math (see Mosel repository on Github), this new type is also supported by data I/O through modules mmodbc, mmsheet, mmsystem and the diskdata functionality.
The type ‘int64’ implements the usual arithmetic operators (+ - ⁎ / mod div abs), including for combinations with types ‘real’ and ‘integer’, and comparison operators (= < >), including for comparisons with type ‘integer’. Type casts to ‘integer’ or ‘real’ are achieved via ‘getasinteger’ or ‘getsasreal’ respectively. When working with numbers of the type ‘int64’, please be aware that optimization solvers rely on floating point arithmetic, that is, any ‘int64’ type data that is to be used in the formulation of optimization models need to be cast to the type ‘real’ via function ‘getasreal’. The code snippet below shows various arithmetic operations mixing different numerical types and also the use of ‘int64’ in the definition of a linear constraint of a mathematical optimization problem.
The type ‘int64’ can also be used with the qsort routine and as indexing set for arrays (declared as ‘constant’ for uniqueness as with other external types):
Number printing formats ‘j’ and ‘y’
The formats ‘%j’ and ‘%y’ define two alternative ways of printing numbers with their most compact exact floating point representation. That is, a number that is written and read repeatedly using these formats on a given operating system will keep the same floating point representation, without any loss of precision through rounding. At the same time these formats avoid the display of unnecessary digits (as this would be the case with any fixed-format representation of floating point number guaranteeing the same precision, such as ‘%.17g’), that may ultimately result in unnecessarily large output or log files. The number printing format can be applied globally via the control parameter realfmt as shown in this example, in which case it takes effect for all output produced by Mosel that does not override the default format, and equally for formatting texts via formattext (an example of text formatting is shown in this example) or individual numerical values via textfmt or strfmt. Note that Mosel’s binary format (I/O driver bin) always maintains full precision independent of the setting of ‘realfmt’. The new format can be combined with other standard options, such as left/rightbound printing or padding as shown in the code snippet below.
New and generalized solving features
Mosel supports the new solver FICO Xpress Global for solving general nonlinear optimization problems to optimality. Going along with this addition we have revised and extended many existing functionalities of the solver modules mmxprs and mmxnlp:
To access training material on modeling and problem solving with Xpress Mosel, follow this link.
Self-learning videos about Xpress Mosel are available here.
If you are interested in learning more from Susanne make sure to check out her series on new modeling constructs in Mosel that allow for an easier formulation of MIP models and the contribution ‘Xpress Mosel: A 20 Year Success Story’.
In case you haven’t already, make sure to subscribe to our Optimization blog to be notified of more content on this topic.
In this blog we are going to present a variety of new features relating to the handling of numerical values in Mosel. At the same time, we discuss various extensions and updates to the solver modules going hand-in-hand with the introduction of the new Global Optimization solver.
New data type ‘int64’
Mosel’s basic type ‘integer’ relies on a 32-bit representation of integer numbers. However, in the context of continuously growing problem and data sizes it may become necessary to work with larger integer numbers, a prominent use case being integer-valued IDs for data entries held in databases. Mosel therefore now defines a new type ‘int64’. Implemented in the open-source module math (see Mosel repository on Github), this new type is also supported by data I/O through modules mmodbc, mmsheet, mmsystem and the diskdata functionality.
The type ‘int64’ implements the usual arithmetic operators (+ - ⁎ / mod div abs), including for combinations with types ‘real’ and ‘integer’, and comparison operators (= < >), including for comparisons with type ‘integer’. Type casts to ‘integer’ or ‘real’ are achieved via ‘getasinteger’ or ‘getsasreal’ respectively. When working with numbers of the type ‘int64’, please be aware that optimization solvers rely on floating point arithmetic, that is, any ‘int64’ type data that is to be used in the formulation of optimization models need to be cast to the type ‘real’ via function ‘getasreal’. The code snippet below shows various arithmetic operations mixing different numerical types and also the use of ‘int64’ in the definition of a linear constraint of a mathematical optimization problem.
The type ‘int64’ can also be used with the qsort routine and as indexing set for arrays (declared as ‘constant’ for uniqueness as with other external types):
Number printing formats ‘j’ and ‘y’
The formats ‘%j’ and ‘%y’ define two alternative ways of printing numbers with their most compact exact floating point representation. That is, a number that is written and read repeatedly using these formats on a given operating system will keep the same floating point representation, without any loss of precision through rounding. At the same time these formats avoid the display of unnecessary digits (as this would be the case with any fixed-format representation of floating point number guaranteeing the same precision, such as ‘%.17g’), that may ultimately result in unnecessarily large output or log files. The number printing format can be applied globally via the control parameter realfmt as shown in this example, in which case it takes effect for all output produced by Mosel that does not override the default format, and equally for formatting texts via formattext (an example of text formatting is shown in this example) or individual numerical values via textfmt or strfmt. Note that Mosel’s binary format (I/O driver bin) always maintains full precision independent of the setting of ‘realfmt’. The new format can be combined with other standard options, such as left/rightbound printing or padding as shown in the code snippet below.
New and generalized solving features
Mosel supports the new solver FICO Xpress Global for solving general nonlinear optimization problems to optimality. Going along with this addition we have revised and extended many existing functionalities of the solver modules mmxprs and mmxnlp:
- Solver choice configuration for nonlinear solvers: if the global solver is available and licensed, the solver selection now defaults to using the global solver for solving general nonlinear problems that do not fall into any of the categories for which the Xpress suite provides a special purpose solver (such as LP, MIP, convex QCQP, SOCP, or convex NLP). The automatic selection can be overridden via the control XPRS_nlpsolver and for making a specific choice among the local NLP solvers the control XNLP_solver can be used as before:
- Homogenized problem/solving status info: if you wish to obtain more specific information than what is indicated by the getprobstat routine of the module mmxprs it was so far required to query problem-type specific status attributes such as LPSTATUS, MIPSTATUS, SLPSTATUS etc. These parameters are now complemented with a new set of generic status attributes. We recommend using these generic attributes moving forward in order to avoid having to update your reporting code when switching between different problem types. This code snippet shows a nice way of reporting on the solver status:
- Extended IIS functionality: the retrieval of IIS (Irreducible Infeasible Set) has been extended to include indicator constraints (created via the indicator construct of mmxprs) and nonlinear constraints (including general constraints for the formulation of MIP problems). The following code snippet is an extract of the example file folionliis.mos, that also shows the use of the getname routine for nonlinear constraints. Note that the existing 2- and 3-argument versions of the getiis routine also remain valid, so no modifications to existing code are required, unless you wish to use the new functionality.
- Multi-objective optimization: the Xpress solvers have been extended to handle multiple objectives. Within Mosel, the user needs to configure the weights (Archimedian approach) or priorities (Lexicographic goal programming approach) and optional tolerance settings via the new type objconfig of mmxprs and the solving command maximize/minimize now accepts an array or list of objectives along with the corresponding configurations as shown in this example (further examples can be found following this link):
- Indicator constraints: indicator constraints that were previously only supported for inequality constraints can now also be defined over equality constraints. Furthermore, new access routines (getindictype to retrieve the sense of the implication and getvar to access the indicator variable) make it possible to display information about indicators, in particular in the context of reporting on IIS information as shown in the example above.
- Extended names generation functionality: the names handling functionality for optimization entities that was previously only available for the basic types ‘mpvar’ and ‘linctr’ has been extended to also apply to ‘nlctr’ (nonlinear and general constraints) and ‘logctr’ (indicator constraints created via the indicator statement). The reader is reminded that this functionality that is primarily intended for debugging purposes needs to be enabled for the Xpress solvers by setting the control XPRS_LOADNAMES to ‘true’. With default compilation, only the names for globally defined public model entities will be passed on to the solvers and names specified via setname. The ‘setname’ routine can now also be applied to arrays of variables or constraints as shown below. For a detailed example of the names generation functionality please refer to the file namesgen.mos.
To access training material on modeling and problem solving with Xpress Mosel, follow this link.
Self-learning videos about Xpress Mosel are available here.
If you are interested in learning more from Susanne make sure to check out her series on new modeling constructs in Mosel that allow for an easier formulation of MIP models and the contribution ‘Xpress Mosel: A 20 Year Success Story’.
In case you haven’t already, make sure to subscribe to our Optimization blog to be notified of more content on this topic.
Updated 2 years ago
Version 3.0FICO
Community Manager
Joined July 21, 2025
FICO® Xpress Optimization Blog
Follow this blog board to get notified when there's new activity