Xpress Optimization

Mosel programming examples

The directory Programming contains a set of examples that demonstrate how Mosel can be used for writing programs. The files in this directory implement certain well-known algorithms that, a priori, have nothing to do with the formulation and solution of optimization problems.



Largest common divisor: Recursive function calls; using 'readln'
 
Smallest and largest value in a set: The 'if-then-elif-then' selection statement
 
Perfect numbers: Using the 'forall' loop
 
Prime numbers using the Sieve of Eratosthenes: Nested loops: repeat-until, while, while-do
 
Read two tables and a set from a text data file: File access, using 'readln', 'fskipline'
 
Parsing a CSV-format data file: Text parsing functionality
 
Sort an array of numbers using Shell's method: Nested loops: repeat-until, forall-do, while-do
 
Sort an array of numbers using Quicksort: Recursive subroutine calls, overloading of subroutines
 
Defining a package to handle binary trees: Definition of subroutines, data structures list and record, type definition
 
Encapsulate binary file into a BIM: Submodel included in model source, datablock, deployment as executable
 
Generate an executable from a Mosel source file: deployment as executable, deployment via scripts
 
Using the automatic translation system: Using xprnls, generating dictionary files
 
Debugging models via the Remote Invocation Protocol: Remote model execution in debugging mode, implementation of a debugger
 
Profiling and code coverage via the Remote Invocation Protocol: Remote model execution in profiling mode, decoding of profiling and coverage results
 
Creating and saving XML documents: Simple access routines - adding nodes, recursive display of subtrees
 
Using XML-format files as databases: Retrieving XML nodes using xpath search expressions; modifying and formatting XML files
 
Parsing XML and JSON documents: Parsing documents with unknown structure
 
Converting WCNF to Mosel format: Processing a text file into a different text format, generating Mosel code, deployment as executable
 
Defining a package to read JSON documents of unknown structure: Definition of subroutines, data structures of union types, type definition, JSON parsing
 

 

  Comments or suggestions about the examples? Please e-mail support@fico.com