FICO Xpress Optimization Examples Repository
FICO Optimization Community FICO Xpress Optimization Home
Back to examples browserPrevious exampleNext example

Basic set operations

Example 'setops':
  • declaring constant and dynamic sets
  • assigning and adding elements to sets
  • using predefined set operations: union, intersection, subtraction
  • printing sets
Example 'setcomp':
  • comparison operators for sets
Further explanation of this example: 'Mosel User Guide', Section 8.2 Working with sets.

Source Files


   Mosel User Guide Example Problems

   file setcomp.mos
   Comparison operators for sets.
   (c) 2008 Fair Isaac Corporation
       author: S. Heipcke, 2001

model "Set comparisons"

  RAINBOW = {"red", "orange", "yellow", "green", "blue", "purple"}
  BRIGHT = {"yellow", "orange"}
  DARK = {"blue", "brown", "black"}

 writeln("BRIGHT is included in RAINBOW: ", BRIGHT <= RAINBOW) 
 writeln("RAINBOW is a superset of DARK: ", RAINBOW >= DARK)
 writeln("BRIGHT is different from DARK: ", BRIGHT <> DARK)
 writeln("BRIGHT is the same as RAINBOW: ", BRIGHT = RAINBOW)


Back to examples browserPrevious exampleNext example