Lab 2 - UniversityofToronto...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
University of Toronto Department of Mechanical and Industrial Engineering MIE376: Mathematical Programming Winter 2011 Lab 2 –Separation of .mod and .dat files In Lab 1, we just programmed the data (or parameters) in the model file (.mod). In this lab, we will separate the model file from the data file. It is common practice to separate the model file from the data file because once the model has been developed it will stay as is, but the data for that model may change over time. By separating the model and data, we can just change the data file without editing the model file (and the potential to have an error in the model file). 1. Writing .mod files that read from .dat files In Lab 1, the data for the linear programs were written in the .mod file. The following section explains how to write a program that defines parameters for data to be read from a .dat (data) file. Example (with Arrays of Data): Given the Linear Program: max ݔ ൅2ݔ subject to: ݔ ൅3ݔ ൑16 ݔ ൅ݔ ൑7 ݔ ൒0 Type the following into a normal text file and save it as
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 3

Lab 2 - UniversityofToronto...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online