OPL: a modelling language

Similar documents
GSLM Operations Research II Fall 13/14

Support Vector Machines. CS534 - Machine Learning

NUMERICAL SOLVING OPTIMAL CONTROL PROBLEMS BY THE METHOD OF VARIATIONS

Programming in Fortran 90 : 2017/2018

LECTURE NOTES Duality Theory, Sensitivity Analysis, and Parametric Programming

Kent State University CS 4/ Design and Analysis of Algorithms. Dept. of Math & Computer Science LECT-16. Dynamic Programming

Outline. Third Programming Project Two-Dimensional Arrays. Files You Can Download. Exercise 8 Linear Regression. General Regression

Support Vector Machines

News. Recap: While Loop Example. Reading. Recap: Do Loop Example. Recap: For Loop Example

Classification / Regression Support Vector Machines

A Facet Generation Procedure. for solving 0/1 integer programs

Compiler Design. Spring Register Allocation. Sample Exercises and Solutions. Prof. Pedro C. Diniz

Notes on Organizing Java Code: Packages, Visibility, and Scope

Harvard University CS 101 Fall 2005, Shimon Schocken. Assembler. Elements of Computing Systems 1 Assembler (Ch. 6)

On Some Entertaining Applications of the Concept of Set in Computer Science Course

Support Vector Machines

The Greedy Method. Outline and Reading. Change Money Problem. Greedy Algorithms. Applications of the Greedy Strategy. The Greedy Method Technique

Assembler. Shimon Schocken. Spring Elements of Computing Systems 1 Assembler (Ch. 6) Compiler. abstract interface.

Sum of Linear and Fractional Multiobjective Programming Problem under Fuzzy Rules Constraints

Modeling and Solving Nontraditional Optimization Problems Session 2a: Conic Constraints

6.854 Advanced Algorithms Petar Maymounkov Problem Set 11 (November 23, 2005) With: Benjamin Rossman, Oren Weimann, and Pouya Kheradpour

Lobachevsky State University of Nizhni Novgorod. Polyhedron. Quick Start Guide

Virtual Memory. Background. No. 10. Virtual Memory: concept. Logical Memory Space (review) Demand Paging(1) Virtual Memory

UNIT 2 : INEQUALITIES AND CONVEX SETS

Machine Learning: Algorithms and Applications

Assembler. Building a Modern Computer From First Principles.

Solving Route Planning Using Euler Path Transform

Greedy Technique - Definition

Overview. CSC 2400: Computer Systems. Pointers in C. Pointers - Variables that hold memory addresses - Using pointers to do call-by-reference in C

Solving two-person zero-sum game by Matlab

Intra-Parametric Analysis of a Fuzzy MOLP

ON SOME ENTERTAINING APPLICATIONS OF THE CONCEPT OF SET IN COMPUTER SCIENCE COURSE

TN348: Openlab Module - Colocalization

SLAM Summer School 2006 Practical 2: SLAM using Monocular Vision

An Optimal Algorithm for Prufer Codes *

International Journal of Scientific & Engineering Research, Volume 7, Issue 5, May ISSN Some Polygonal Sum Labeling of Bistar

Optimization Methods: Integer Programming Integer Linear Programming 1. Module 7 Lecture Notes 1. Integer Linear Programming

Problem Set 3 Solutions

LOOP ANALYSIS. The second systematic technique to determine all currents and voltages in a circuit

CS1100 Introduction to Programming

5 The Primal-Dual Method

Sintassi di LINGO. Model: MAX = 1*Drop + 1.5*Deco; Drop <= 400; Deco <= 200; 1/60*Drop + 3/60*Deco <=16; end

CS 534: Computer Vision Model Fitting

Active Contours/Snakes

A Taste of Java and Object-Oriented Programming

An Application of Network Simplex Method for Minimum Cost Flow Problems

Assignment # 2. Farrukh Jabeen Algorithms 510 Assignment #2 Due Date: June 15, 2009.

Angle-Independent 3D Reconstruction. Ji Zhang Mireille Boutin Daniel Aliaga

PHYSICS-ENHANCED L-SYSTEMS

Machine Learning. Support Vector Machines. (contains material adapted from talks by Constantin F. Aliferis & Ioannis Tsamardinos, and Martin Law)

Cost-efficient deployment of distributed software services

Using SAS/OR for Automated Test Assembly from IRT-Based Item Banks

KFUPM. SE301: Numerical Methods Topic 8 Ordinary Differential Equations (ODEs) Lecture (Term 101) Section 04. Read

Scheduling with Integer Time Budgeting for Low-Power Optimization

Type-2 Fuzzy Non-uniform Rational B-spline Model with Type-2 Fuzzy Data

A NOTE ON FUZZY CLOSURE OF A FUZZY SET

S1 Note. Basis functions.

Metric Characteristics. Matrix Representations of Graphs.

Polyhedral Compilation Foundations

Machine Learning. Topic 6: Clustering

Oracle Database: SQL and PL/SQL Fundamentals Certification Course

CS246: Mining Massive Datasets Jure Leskovec, Stanford University

An Application of the Dulmage-Mendelsohn Decomposition to Sparse Null Space Bases of Full Row Rank Matrices

A New Approach For the Ranking of Fuzzy Sets With Different Heights

Computer models of motion: Iterative calculations

Efficient Load-Balanced IP Routing Scheme Based on Shortest Paths in Hose Model. Eiji Oki May 28, 2009 The University of Electro-Communications

12/2/2009. Announcements. Parametric / Non-parametric. Case-Based Reasoning. Nearest-Neighbor on Images. Nearest-Neighbor Classification

124 Chapter 8. Case Study: A Memory Component ndcatng some error condton. An exceptonal return of a value e s called rasng excepton e. A return s ssue

Today Using Fourier-Motzkin elimination for code generation Using Fourier-Motzkin elimination for determining schedule constraints

Smoothing Spline ANOVA for variable screening

Random Variables and Probability Distributions

2x x l. Module 3: Element Properties Lecture 4: Lagrange and Serendipity Elements

SIGGRAPH Interactive Image Cutout. Interactive Graph Cut. Interactive Graph Cut. Interactive Graph Cut. Hard Constraints. Lazy Snapping.

Module Management Tool in Software Development Organizations

Agenda & Reading. Simple If. Decision-Making Statements. COMPSCI 280 S1C Applications Programming. Programming Fundamentals

U.C. Berkeley CS294: Beyond Worst-Case Analysis Handout 5 Luca Trevisan September 7, 2017

Complex Numbers. Now we also saw that if a and b were both positive then ab = a b. For a second let s forget that restriction and do the following.

CMPS 10 Introduction to Computer Science Lecture Notes

Sequential search. Building Java Programs Chapter 13. Sequential search. Sequential search

LLVM passes and Intro to Loop Transformation Frameworks

y and the total sum of

High level vs Low Level. What is a Computer Program? What does gcc do for you? Program = Instructions + Data. Basic Computer Organization

Meta-heuristics for Multidimensional Knapsack Problems

MILP. LP: max cx ' MILP: some integer. ILP: x integer BLP: x 0,1. x 1. x 2 2 2, c ,

Computer Animation and Visualisation. Lecture 4. Rigging / Skinning

b * -Open Sets in Bispaces

Steps for Computing the Dissimilarity, Entropy, Herfindahl-Hirschman and. Accessibility (Gravity with Competition) Indices

Specifying Database Updates Using A Subschema

Wavefront Reconstructor

Non-Split Restrained Dominating Set of an Interval Graph Using an Algorithm

For instance, ; the five basic number-sets are increasingly more n A B & B A A = B (1)

9. BASIC programming: Control and Repetition

Outline. CIS 110: Intro to Computer Programming. What Do Our Programs Look Like? The Scanner Object. CIS 110 (11fa) - University of Pennsylvania 1

APPLICATION OF MULTIVARIATE LOSS FUNCTION FOR ASSESSMENT OF THE QUALITY OF TECHNOLOGICAL PROCESS MANAGEMENT

ELEC 377 Operating Systems. Week 6 Class 3

All-Pairs Shortest Paths. Approximate All-Pairs shortest paths Approximate distance oracles Spanners and Emulators. Uri Zwick Tel Aviv University

CSCI 104 Sorting Algorithms. Mark Redekopp David Kempe

11. APPROXIMATION ALGORITHMS

Classification and clustering using SVM

TPL-Aware Displacement-driven Detailed Placement Refinement with Coloring Constraints

Transcription:

OPL: a modellng language Carlo Mannno (from OPL reference manual) Unversty of Oslo, INF-MAT60 - Autumn 00 (Mathematcal optmzaton)

ILOG Optmzaton Programmng Language OPL s an Optmzaton Programmng Language Easy to generate and solve an lp models (program) It also provdes all features of a standard programmng language We wll use the IDE user nterface An OPL model conssts of: a sequence of declaratons optonal preprocessng nstructons the model/problem defnton optonal postprocessng nstructons Model are stored n fles wth etenson.mod

Data types, constants and varables Defnng a model: Frst you need to defne varables and constants (names and types) Basc types: float, nt, strng. E. (constants) nt = ; float+ k =.7; strng s = Optmzaton ; Varables are ntroduced by dvar dvar float+ ; (ratonal non negatve varable) dvar nt y; (nteger varable)

A smple model LP models translate naturally to OPL models LP model OPL model ma 0g s. t. g c g c g g, c R 8 0c dvar float g; dvar float c; mamze 0*g + 0*c; subject to { d: g + c <=; d: *g + *c <= 8; d: g <= ; OBS: you can assocate a name wth every constrant by puttng t before the constrant, followed by colon : Constrant name = correspondng dual varable (name)

Usng OPL nterface (IDE) To solve models you need (to create) a project. Projects can contan several models (and nstances). To etract a specfc model (and a specfc nstance) you need to defne a confguraton. A project can thus contan several confguratons, each contanng a specfc par model nstance. Once you create a new confguraton, the correspondng model can be mported by drag-and-drop

Usng OPL nterface (IDE) Eample: Project Name: Frst eample 00 The project contans only one model (smple-model.mod) The project contans only one confguraton (Confguraton) confguraton model Confguraton contans model smple-model.mod

Ranges and arrays Ranges of ntegers are defned as range Rows =..; nt n = ; range Cols =..n; Ranges are used to defne arrays range nodes =..; range edges =..7; float weght[nodes] = [,, 6., 7,.]; float A[nodes][edges] = [ ]; [, 0, 0,, 0, 0, -] [-, 0, 0, 0,, 0, ]... Ranges are also used n summatons and loops forall ( n tems)

Eample: ranges and arrays ma s. t. n n w c {0, n k nt n = ; range Items =..n; nt w[items] = [,,,, ]; nt c[items] = [, 8,, 7, 9]; nt k = 8; dvar nt [Items] n 0..; c 8 7 9 w mamze sum( n Items) c[]*[]; subject to { knap: sum( n Items) w[]*[] <= k; Ranges are used n summatons and loops forall ( n tems)

Separatng models and data A model s somethng dfferent from one of ts nstances The lnear program for the shortest path problem has a structure whch s the same for any graph and any weght functon. We only need one model, and then we can apply the model to any nstance of the shortest path problem OPL allows to mantan a strct separaton between the model and ts nstances. Models are stored n.mod fles Instances are stored n yyy.dat fles In the standard IDE nterface, can be dfferent from yyy The Confguraton matches the model wth the nstance.

Separatng models and data ma s. t. n n c w {0, n k Knapsack.mod nt n = ; range Items =..n; nt w[items] = ; nt c[items] = ; nt k = ; dvar nt [Items] n 0..; mamze sum( n Items) c[]*[]; subject to { knap: sum( n Items) w[]*[] <= k; n c 8 7 9 w k 8 Knapsack.dat n = ; w = [,,,, ]; c= [, 8,, 7, 9]; k = 8; Knapsack.dat n = 6; w = [,,,,, ]; c= [, 8,, 7, 9, ]; k = 8;

OPL IDE Eample: Two projects Frst eample 00 knapsack_carlo knapsack_carlo contans one model (knapsack.mod) two nstances (knapsack.dat, knapsack.dat) two confguratons (confguraton, confguraton) Confguraton contans model knapsack.mod and nstance knapsack.dat Confguraton contans model knapsack.mod and nstance knapsack.dat

s-t path problem mn uv A c uv uv - = - s us ut uv u s - D(s) - D(t) - uv - D(v) ut - 0 R A su tu vu + s D(s) u = + tu D(t) + vu = 0 D(v) v t V-{s,t s - G = (V,A) t mn c T A =b 0 s t s s s t t 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 c b 0 0 0

s-t path problem mn c T A =b 0 nt n =...; // number of nodes nt m =...; // number of edges range nodes =..n; s t s s s t t 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 c b 0 0 0 range edges =..m; nt A[nodes][edges] =...; nt b[nodes] =...; nt c[edges] =...; dvar float+ [edges]; n = ; m = 7; b = [-, 0, 0, 0, ]; c = [,, -,,, -, ]; mnmze sum(j n edges) c[j]*[j]; subject to { forall ( n nodes) y: sum(j n edges) A[][j]*[j] == b[]; A = [ [-,-,-, 0, 0, 0, 0] [, 0, 0,-,, 0, 0] [0,, 0, 0,-,, 0] [0, 0,, 0, 0,-,-] [0, 0, 0,, 0, 0, ]];

Aggegatng data: Tuples Several related data can be clustered together n tuples tuple Pont { float ; float y; Pont P = <,>; nt a = P.; Int b = P.y; {Pont ponts = { <,>, <,>, <.,.>;

Eplotng sparsty: tuples ma y t - y s y v - y u c uv for all uv A nt Nvert =...; range Verts =..Nvert; nt source = ; nt snk = ; tuple arc { nt u; nt v; float w; {arc Arcs =...; dvar float y[verts]; mamze y[snk] - y[source]; subject to { forall(e n Arcs) y[e.v] - y[e.u] <= e.w; Nvert = ; source = ; snk = ; Arcs = { < >, < >, < >, < ->, < >, < >, < >, ; - G = (V,A)

Epresson Condtonal epressons can be used n loops and n summatons. nt Nvert =...; range Verts =..Nvert; nt source =...; nt snk =...; tuple arc { nt u; nt v; float w; {arc A =...; dvar float+ [A]; mn uv A c uv uv us - - + su = - s D(s) su D(s) us ut uv - D(t) - uv - D(v) ut - 0 R A tu vu = + tu D(t) + vu = 0 D(v) v t V-{s,t mnmze sum (e n A) e.w * [e]; subject to { forall (z n Verts : z!= source && z!= snk) z: sum (e n A: e.v == z) [e] - sum (e n A: e.u == z) [e] == 0 ; s: sum (e n A: e.v == source) [e] - sum (e n A: e.u == source) [e] == -; t: sum (e n A: e.v == snk) [e] - sum (e n A: e.u == snk) [e] == ;