OPL: a modelling language

OPL: a modelling language Carlo Mannino (from OPL reference manual) University of Oslo, INF-MAT5360 - Autumn 2011 (Mathematical optimization) ILOG ...
Author: Sharyl Briggs
26 downloads 0 Views 588KB Size
OPL: a modelling language Carlo Mannino (from OPL reference manual)

University of Oslo, INF-MAT5360 - Autumn 2011 (Mathematical optimization)

ILOG Optimization Programming Language OPL is an “Optimization Programming Language

Easy to generate and solve an lp models (program) It also provides all features of a standard programming language Reasons for learning a modelling language? Recent developments in the technology of the optimization solvers technology makes it possible to obtain solutions to large real-life problems (impossible only a few years ago)

Useful for the course assignments We will use the IDE user interface

ILOG Optimization Programming Language

An OPL model consists of:

◆ a sequence of declarations ◆ optional pre-processing instructions

◆ the model/problem definition ◆ optional post-processing instructions Model are stored in files with extension .mod

Data types, constants and variables Defining a model:

First you need to define variables and constants (names and types) Basic types: float, int, string. Constant or variables Constants

int i = 32; (declare an integer constant i and assign value 32) float+ k = 12.7; (declare a non negative rational constant) string s = ‘Optimization’;

Variables are introduced by “dvar” dvar float+ x; (rational non negative variable) dvar int y; (integer variable)

A simple model LP models translate naturally to OPL models LP model

max 3 g  2c s.t. g  c  80 4 g  2c  40

OPL model dvar float g; dvar float c; maximize 3*g + 2*c; subject to { d1: g + c

Suggest Documents