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

Blend - data input from external sources

Description

This example is taken from the 'Mosel User Guide', Section 2.2. A blending example.

In many applications data are provided in the form of spreadsheets or need to be extracted from databases. Mosel has facilities whereby the contents of ranges within spreadsheets may be read into data tables and databases may be accessed.

Mosel's ODBC interface (module mmodbc) may be used to read the data from databases. The ODBC technology is a generic means for accessing databases and some spreadsheets such as certain versions of Microsoft Excel also support (a reduced set of) ODBC functionality. The ODBC interface can be used in initializations blocks that automatically generate the required SQL statments and it is also possible to employ SQL statements directly in Mosel models (see blend4.mos).

Mosel also provides specific interfaces to Excel spreadsheets through the module mmsheet. These interfaces that support all basic tasks of data exchange (model files blend3*.mos) should be used for working with Excel data.

  • blend.mos: Reading data from text files (requires blend.dat or blendb.dat)
  • blend2.mos: Using runtime parameters (requires blend.dat)
  • blend3.mos: Reading data from an Excel spreadsheet, using the generic spreadsheet driver (requires blend.xls)
  • blend3c.mos: Reading data in CSV format (requires blend.csv)
  • blend3e.mos: Reading data from an Excel spreadsheet, using the excel I/O driver (requires blend.xls)
  • blend4.mos: Reading data from a database (requires blend.mdb or blend.sqlite)
Further explanation of this example: 'Mosel User Guide', Section 2.2 A blending example


Source Files

Data Files





blend.csv

,,,,
"MyRange:","ORES","COST","AVAIL","GRADE"
"MyRangeNoHeader:",1,85,60,2.1
,2,93,45,6.3

Back to examples browserPrevious exampleNext example