English Japanese
Examples Repository

There are a number of examples available demonstrating some of the functionality of the Xpress-MP suite.

A large percentage of these examples are browsable online. Click on the examples browser below to start browsing the available material.
If you wish to run the examples we recommend you download the examples set as a single archive file from
here.

The examples featured in our publication "Applications of optimization with Xpress-MP"
are available to download here. Constraint Programming versions of some of the
examples are available to download here.


Search for

  1. Xpress-BCL library examples
    1. Examples in C
      1. Chess - Composing constraints and solving
      2. Workshop - Printing variables
      3. Contract - Semi-continuous variables, predefined constraint functions, combine BCL with Xpress-Optimizer
      4. Chgprobs - Working with multiple models
      5. Setops - Index sets
      6. Workshop - Ranging information
      7. Burglar - Use of index sets in a knapsack model
      8. Coco - A full production planning example
      9. Delivery - Data input from file; infeasibility analysis
      10. Purchase - Definition of SOS-2
      11. Infeas - User error handling and output redirection
      12. Portfolio - Quadratic Programming with discrete variables
      13. Cutstk - Column generation for a cutting stock problem.
      14. Els - An economic lot-sizing problem solved by cut&branch and branch&cut heuristics
      15. Fixbv - A binary fixing heuristic
      16. Recurse - A successive linear programming model
      17. MT2 - Solving two problems in parallel in a thread-safe environment
      18. GoalObj - Archimedian & pre-emptive goal programming using objective functions
      19. UG - Examples from 'BCL User Guide and Reference Manual'
      20. Folio - Examples from 'Getting Started'
    2. Examples in C++
      1. Chess - Composing constraints and solving
      2. Workshop - Printing variables
      3. Contract - Semi-continuous variables, combine BCL with Xpress-Optimizer
      4. Chgprobs - Working with multiple models
      5. Setops - Index sets
      6. Workshop - Ranging information
      7. Burglar - Use of index sets in a knapsack model
      8. Coco - A full production planning example
      9. Delivery - Data input from file; infeasibility analysis
      10. Purchase - A complex MIP problem with SOS-2
      11. Portfolio - Quadratic Programming with discrete variables
      12. Cutstk - Column generation for a cutting stock problem.
      13. Els - An economic lot-sizing problem solved by cut&branch and branch&cut heuristics
      14. Fixbv - A binary fixing heuristic
      15. Recurse - A successive linear programming model
      16. GoalObj - Archimedian & pre-emptive goal programming using objective functions
      17. UG - Examples from 'BCL User Guide and Reference Manual'
      18. Folio - Examples from 'Getting Started'
    3. Examples in C#
      1. Chess - Composing constraints and solving
      2. Workshop - Printing variables
      3. Contract - Semi-continuous variables, predefined constraint functions
      4. Chgprobs - Working with multiple models
      5. Setops - Index sets
      6. Workshop - Ranging information
      7. Burglar - Use of index sets in a knapsack model
      8. Coco - A full production planning example
      9. Delivery - Data input from file, and "Views"
      10. Purchase - Definition of SOS-2
      11. Portfolio - Quadratic Programming with discrete variables
      12. Cutstk - Column generation for a cutting stock problem.
      13. Els - An economic lot-sizing problem solved by cut&branch and branch&cut heuristics
      14. Fixbv - A binary fixing heuristic
      15. Recurse - A successive linear programming model
      16. GoalObj - Archimedian & pre-emptive goal programming using objective functions
      17. UG - Examples from 'BCL User Guide and Reference Manual'
      18. Folio - Examples from 'Getting Started'
    4. Examples in Java
      1. Chess - Composing constraints and solving
      2. Workshop - Printing variables
      3. Contract - Semi-continuous variables, combine BCL with Xpress-Optimizer
      4. Chgprobs - Working with multiple models
      5. Setops - Index sets
      6. Workshop - Ranging information
      7. Burglar - Use of index sets in a knapsack model
      8. Coco - A full production planning example
      9. Delivery - Data input from file; infeasibility analysis
      10. Purchase - Definition of SOS-2
      11. Infeas - User error handling and output redirection
      12. Portfolio - Quadratic Programming with discrete variables
      13. Cutstk - Column generation for a cutting stock problem.
      14. Els - An economic lot-sizing problem solved by cut&branch and branch&cut heuristics
      15. Fixbv - A binary fixing heuristic
      16. Recurse - A successive linear programming model
      17. GoalObj - Archimedian and pre-emptive goal programming using objective functions
      18. UG - Examples from 'BCL User Guide and Reference Manual'
      19. Folio - Examples from 'Getting Started'
    5. Examples in VB/VBA
      1. VB examples Chess, Jobs, Setops and QP12
      2. Folio - Examples from 'Getting Started'
  2. Xpress-Mosel examples
    1. Modeling
      1. Chess - A tiny production planning problem; solution analysis
      2. Burglar - The 'Burglar Bill' knapsack model
      3. Blend - A model for mineral blending
      4. Coco - The Coco productional planning problem
      5. Firestns - A set-covering model for emergency service provision
      6. Lcsp - A labour constrained scheduling problem
      7. Setops - Basic set operations
      8. Pplan - A project planning problem
      9. Purchase - A model for optimal purchasing with price-breaks
      10. Folio - Examples from 'Getting started'
      11. Delivery - Infeasibility analysis with IIS
    2. Examples from 'Applications of optimization'
      1. Mining and process industries
      2. Scheduling problems
      3. Planning problems
      4. Loading and cutting problems
      5. Ground transport
      6. Air transport
      7. Telecommunication problems
      8. Economics and finance
      9. Timetabling and personnel planning
      10. Local authorities and public services
    3. Programming
      1. Find the largest common divisor of two integer numbers
      2. Find the smallest and the largest value in a set of integers
      3. Calculate all perfect numbers up to a given upper bound
      4. Find all prime numbers up to a given bound using the Sieve of Eratosthenes
      5. Read two tables and a set from a data file
      6. Sort an array of numbers into numerical order using Shell's method
      7. Sort an array of numbers into numerical order using Quicksort
      8. Subroutines
      9. Lists: initialization, enumeration, operators, access functions
      10. Constructing a Eulerian circuit: working with lists
      11. Defining and initializing records
      12. Working with records: definition of a network
      13. User type definition
      14. Writing packages: definition of constant symbols, subroutines, and types
      15. Defining a package to handle binary trees
      16. Working with the types 'date' and 'time'
    4. Solving techniques
      1. Column generation for a cutting stock problem
      2. Cut generation for an economic lot-sizing (ELS) problem
      3. Cut-and-branch and branch-and-cut
      4. Binary fixing heuristic for the Coco problem
      5. Pre-emptive and Archimedian goal programming using constraints
      6. Archimedian and pre-emptive goal programming using objective functions
      7. Successive linear programming (SLP) model for a financial planning problem
      8. Simple transportation model: output formatting
      9. Dantzig-Wolfe decomposition for the Coco problem
      10. Benders decomposition
      11. Branch-and-Price for the Generalized Assignment Problem
      12. Working with multiple models: submodels, coordination, communication, and parallelization
      13. Hybrid MIP-CP problem solving: sequential solving
      14. Hybrid MIP-CP problem solving: concurrent solving
      15. Constructing and loading MIP start solutions for the traveling salesman problem (TSP)
    5. Data handling ( ODBC/SQL, sparse data, IO drivers )
      1. ODBC: Reading data from spreadsheets and databases
      2. Reading sparse data from text files, spreadsheets and databases, and from memory
      3. Data output to text files, spreadsheets and databases, and to memory
      4. Dense vs. sparse data format
      5. Writing out solution values to text files, spreadsheets or databases
      6. Spreadsheets and databases: working with multiple data tables and arrays
      7. Formulation of SQL (selection) statements
      8. Reading and writing records and lists
      9. Reading and writing external types: dates and time
    6. C Library examples
      1. Compiling a model file into a BIM file
      2. Working with models and accessing dynamic libraries
      3. Using sets in Mosel
      4. Using lists in Mosel
      5. Using arrays in Mosel
      6. Using arrays with index sets
      7. Using records in Mosel
      8. Accessing problems and solution information
      9. Interrupting a running model using Ctrl-C
      10. Display model parameters/symbols
      11. Display dso module details
      12. I/O drivers
      13. Debugger API
      14. UG - Embedding examples from 'Mosel User Guide'
      15. Folio - Embedding examples from 'Getting Started'
      16. Performing simple statistics with solutions of several models runs
      17. Bi-directional data exchange between host application and Mosel model (using static modules or I/O drivers)
    7. Java Library examples
      1. Working with models and accessing dynamic libraries
      2. Using sets in Mosel
      3. Using lists in Mosel
      4. Using arrays with index sets
      5. Using records in Mosel
      6. Accessing problems and solution information
      7. Display model parameters/symbols
      8. Display dso module details
      9. IO drivers
      10. Debugger API
      11. UG - Embedding examples from 'Mosel User Guide'
      12. Folio - Examples from 'Getting Started'
    8. VB Library examples
      1. Launching Mosel from Excel using VBA
      2. Start/stopping Mosel from Excel and capturing output
      3. UG - Embedding examples from 'Mosel User Guide'
      4. Folio - Embedding examples from 'Getting Started'
    9. C#.NET Library examples
      1. Working with models and accessing dynamic libraries
      2. Using sets in Mosel
      3. Using arrays with index sets
      4. Accessing problems and solution information
      5. Display model parameters/symbols
      6. Display dso module details
      7. IO drivers
    10. VB.NET Library examples
      1. Working with models and accessing dynamic libraries
      2. Using sets in Mosel
      3. Using arrays with index sets
      4. Accessing problems and solution information
      5. Display model parameters/symbols
      6. Display dso module details
      7. IO drivers
    11. Writing modules
      1. Definition of constants of different types
      2. Definition of a procedure for getting solution values into an array
      3. Definition of complex numbers and operators to work with them
      4. Definition of type "task" and subroutines for accessing it
      5. Definition of type "date" and subroutines for accessing it
      6. Definition of three new types and operators to work with them
      7. Declaring a static module
      8. Using the 'zlib' library to provide IO driver 'compress' functionality
      9. Module implementing driver 'toC' to save the compilation result to a C file
      10. How best to debug a module
    12. Misc. ( looping over optimization runs, use of 'exists', parameters, debugging and profiling )
      1. Looping over optimization runs (within a model, batch executions, and multiple models/submodel
      2. Resetting different types of runtime parameters
      3. Runtime parameters: communicating with the Optimizer
      4. Parameters: tolerances
      5. Parameters: number printing format
      6. Using 'exists' for loops over sparse arrays
      7. Conditional creation of decision variables
      8. Using the model return value for error handling in applications
      9. Using the debugger and profiler
      10. Checking memory usage
    13. Puzzles and Recreational Mathematics
      1. Sudoku (CP model and XAD application)
      2. Futoshiki (CP and MIP models and XAD application)
      3. Fantasy OR: Sangraal (CP and MIP models)
      4. Fiveleaper (MIP model and graphics in IVE)
      5. Puzzles and pastimes from the book `Programmation Lineaire'
  3. Xpress-Optimizer examples
    1. Calling the library from C
      1. A DepthFirst Branching Algorithm
      2. Branching rule branching on the most violated Integer/Binary
      3. Apply a binary fixing heuristic to an unpresolved MIP problem
      4. Perform objective function parametrics on a global problem
      5. Perform RHS parametrics on a global problem
      6. Apply a primal heuristic to a knapsack problem
      7. Apply an integer fixing heuristic to a MIP problem
      8. Load LP directly into Optimizer and modify it by adding an extra constraint
      9. Show how to save/access a postsolved solution in memory
      10. Loading MIP solutions into the Optimizer
      11. Solve LP, displaying the initial and optimal tableau
      12. Modify problem: add an extra variable within an additional constraint.
    2. Calling the library from Java
      1. Demonstrates setting up and using callbacks
    3. Calling the library from VB
      1. VB versions for some of the C example set
    4. Calling the library from C#.NET
      1. Apply a binary fixing heuristic to an unpresolved MIP problem
      2. Apply a primal heuristic to a knapsack problem
      3. Load LP directly into Optimizer and modify it by adding an extra constraint