Description of the example

Includes what you will learn and where to find the files.

The oil sheet example is a linear programming (LP) problem delivered within the oil project as a specific run configuration associating the oil.mod and oilSheet.dat files, with the spreadsheet oilSheet.xls. In this example, the data is stored in sheets of an Excel spreadsheet. The optimization problem it reflects is described in A blending problem in the Language User’s Manual.

What you are going to do

With this example, you will learn how to:

  • establish a connection to a Microsoft Excel spreadsheet from the IDE

  • read data from the spreadsheet into OPL arrays

  • write data to the spreadsheet from the IDE.

Where to find the files

For this example, you will need to use the following files:

  • oil project: the oil blending example, in which one run configuration uses a connection to an Excel spreadsheet where there is data for a linear programming (LP) problem:

  • oilSheet.xls: the Excel spreadsheet that contains the data for this run configuration

Both files are at the following location:

<Install_dir>\opl\examples\opl\oil

where <Install_dir> is your installation directory.

Note:

You will open this OPL project and all projects in these tutorials using the New Example wizard, which allows you to open and work with a copy of the distributed example, leaving the original example in place. If you need a reminder of how to use the New Example wizard, see Opening distributed examples in the CPLEX Studio IDE.