Top Banner
Introduction Getting Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk [email protected] Belarus State University Faculty of Economics Minsk - 2015 N.N. Pisaruk [email protected] MIPCL
108

Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk [email protected] Belarus State University Faculty of

Mar 29, 2018

Download

Documents

haliem
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started

Mixed Integer Programming Class LibraryIntroduction

N.N. [email protected]

Belarus State UniversityFaculty of Economics

Minsk - 2015

N.N. Pisaruk [email protected] MIPCL

Page 2: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started

Outline

1 IntroductionWhat is MIPCL?How good is MIPCL?

2 Getting StartedSolving InstancesSolving Problems

N.N. Pisaruk [email protected] MIPCL

Page 3: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started What is MIPCL? How good is MIPCL?

Outline

1 IntroductionWhat is MIPCL?How good is MIPCL?

2 Getting StartedSolving InstancesSolving Problems

N.N. Pisaruk [email protected] MIPCL

Page 4: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started What is MIPCL? How good is MIPCL?

What is MIPCL?

Mixed Integer Programming Class Library (MIPCL) is tool forsolving

Linear Programs (LP);Mixed Integer Programs (MIP).

MIPCL is implemented as library of C++ classes.It can be used

standalone as shared object (dynamic linked library) in any C++projects;together with modelling environment MIPshell;as application for solving MIPs given in MPS format.

N.N. Pisaruk [email protected] MIPCL

Page 5: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started What is MIPCL? How good is MIPCL?

What is MIPCL?

Mixed Integer Programming Class Library (MIPCL) is tool forsolving

Linear Programs (LP);Mixed Integer Programs (MIP).

MIPCL is implemented as library of C++ classes.It can be used

standalone as shared object (dynamic linked library) in any C++projects;together with modelling environment MIPshell;as application for solving MIPs given in MPS format.

N.N. Pisaruk [email protected] MIPCL

Page 6: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started What is MIPCL? How good is MIPCL?

What is MIPCL?

Mixed Integer Programming Class Library (MIPCL) is tool forsolving

Linear Programs (LP);Mixed Integer Programs (MIP).

MIPCL is implemented as library of C++ classes.It can be used

standalone as shared object (dynamic linked library) in any C++projects;together with modelling environment MIPshell;as application for solving MIPs given in MPS format.

Jump to MIP

N.N. Pisaruk [email protected] MIPCL

Page 7: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started What is MIPCL? How good is MIPCL?

What is MIPCL?

Mixed Integer Programming Class Library (MIPCL) is tool forsolving

Linear Programs (LP);Mixed Integer Programs (MIP).

MIPCL is implemented as library of C++ classes.It can be used

standalone as shared object (dynamic linked library) in any C++projects;together with modelling environment MIPshell;as application for solving MIPs given in MPS format.

N.N. Pisaruk [email protected] MIPCL

Page 8: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started What is MIPCL? How good is MIPCL?

What is MIPCL?

Mixed Integer Programming Class Library (MIPCL) is tool forsolving

Linear Programs (LP);Mixed Integer Programs (MIP).

MIPCL is implemented as library of C++ classes.It can be used

standalone as shared object (dynamic linked library) in any C++projects;together with modelling environment MIPshell;as application for solving MIPs given in MPS format.

N.N. Pisaruk [email protected] MIPCL

Page 9: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started What is MIPCL? How good is MIPCL?

What is MIPCL?

Mixed Integer Programming Class Library (MIPCL) is tool forsolving

Linear Programs (LP);Mixed Integer Programs (MIP).

MIPCL is implemented as library of C++ classes.It can be used

standalone as shared object (dynamic linked library) in any C++projects;together with modelling environment MIPshell;as application for solving MIPs given in MPS format.

N.N. Pisaruk [email protected] MIPCL

Page 10: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started What is MIPCL? How good is MIPCL?

What is MIPCL?

Mixed Integer Programming Class Library (MIPCL) is tool forsolving

Linear Programs (LP);Mixed Integer Programs (MIP).

MIPCL is implemented as library of C++ classes.It can be used

standalone as shared object (dynamic linked library) in any C++projects;together with modelling environment MIPshell;as application for solving MIPs given in MPS format.

N.N. Pisaruk [email protected] MIPCL

Page 11: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started What is MIPCL? How good is MIPCL?

What is MIPCL?

Mixed Integer Programming Class Library (MIPCL) is tool forsolving

Linear Programs (LP);Mixed Integer Programs (MIP).

MIPCL is implemented as library of C++ classes.It can be used

standalone as shared object (dynamic linked library) in any C++projects;together with modelling environment MIPshell;as application for solving MIPs given in MPS format.

N.N. Pisaruk [email protected] MIPCL

Page 12: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started What is MIPCL? How good is MIPCL?

MIPCL Features

1 MIPCL API makes it easy to integrate optimization into user’sapplications.

2 MIPCL is highly flexible through many virtual functions thatallow developers to implement problem specific

1 cut and column generators;2 primal heuristics to search for feasible solutions;3 node selectors to guide the search;4 branching rules to split the problem into subproblems;5 preprocessing to simplify solved problems;6 management of cuts and generated columns.

3 MIPCL comes with clear, comprehensive documentation andexamples to help you get started quickly.

N.N. Pisaruk [email protected] MIPCL

Page 13: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started What is MIPCL? How good is MIPCL?

MIPCL Features

1 MIPCL API makes it easy to integrate optimization into user’sapplications.

2 MIPCL is highly flexible through many virtual functions thatallow developers to implement problem specific

1 cut and column generators;2 primal heuristics to search for feasible solutions;3 node selectors to guide the search;4 branching rules to split the problem into subproblems;5 preprocessing to simplify solved problems;6 management of cuts and generated columns.

3 MIPCL comes with clear, comprehensive documentation andexamples to help you get started quickly.

N.N. Pisaruk [email protected] MIPCL

Page 14: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started What is MIPCL? How good is MIPCL?

MIPCL Features

1 MIPCL API makes it easy to integrate optimization into user’sapplications.

2 MIPCL is highly flexible through many virtual functions thatallow developers to implement problem specific

1 cut and column generators;2 primal heuristics to search for feasible solutions;3 node selectors to guide the search;4 branching rules to split the problem into subproblems;5 preprocessing to simplify solved problems;6 management of cuts and generated columns.

3 MIPCL comes with clear, comprehensive documentation andexamples to help you get started quickly.

N.N. Pisaruk [email protected] MIPCL

Page 15: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started What is MIPCL? How good is MIPCL?

MIPCL Features

1 MIPCL API makes it easy to integrate optimization into user’sapplications.

2 MIPCL is highly flexible through many virtual functions thatallow developers to implement problem specific

1 cut and column generators;2 primal heuristics to search for feasible solutions;3 node selectors to guide the search;4 branching rules to split the problem into subproblems;5 preprocessing to simplify solved problems;6 management of cuts and generated columns.

3 MIPCL comes with clear, comprehensive documentation andexamples to help you get started quickly.

N.N. Pisaruk [email protected] MIPCL

Page 16: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started What is MIPCL? How good is MIPCL?

MIPCL Features

1 MIPCL API makes it easy to integrate optimization into user’sapplications.

2 MIPCL is highly flexible through many virtual functions thatallow developers to implement problem specific

1 cut and column generators;2 primal heuristics to search for feasible solutions;3 node selectors to guide the search;4 branching rules to split the problem into subproblems;5 preprocessing to simplify solved problems;6 management of cuts and generated columns.

3 MIPCL comes with clear, comprehensive documentation andexamples to help you get started quickly.

N.N. Pisaruk [email protected] MIPCL

Page 17: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started What is MIPCL? How good is MIPCL?

MIPCL Features

1 MIPCL API makes it easy to integrate optimization into user’sapplications.

2 MIPCL is highly flexible through many virtual functions thatallow developers to implement problem specific

1 cut and column generators;2 primal heuristics to search for feasible solutions;3 node selectors to guide the search;4 branching rules to split the problem into subproblems;5 preprocessing to simplify solved problems;6 management of cuts and generated columns.

3 MIPCL comes with clear, comprehensive documentation andexamples to help you get started quickly.

N.N. Pisaruk [email protected] MIPCL

Page 18: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started What is MIPCL? How good is MIPCL?

MIPCL Features

1 MIPCL API makes it easy to integrate optimization into user’sapplications.

2 MIPCL is highly flexible through many virtual functions thatallow developers to implement problem specific

1 cut and column generators;2 primal heuristics to search for feasible solutions;3 node selectors to guide the search;4 branching rules to split the problem into subproblems;5 preprocessing to simplify solved problems;6 management of cuts and generated columns.

3 MIPCL comes with clear, comprehensive documentation andexamples to help you get started quickly.

N.N. Pisaruk [email protected] MIPCL

Page 19: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started What is MIPCL? How good is MIPCL?

MIPCL Features

1 MIPCL API makes it easy to integrate optimization into user’sapplications.

2 MIPCL is highly flexible through many virtual functions thatallow developers to implement problem specific

1 cut and column generators;2 primal heuristics to search for feasible solutions;3 node selectors to guide the search;4 branching rules to split the problem into subproblems;5 preprocessing to simplify solved problems;6 management of cuts and generated columns.

3 MIPCL comes with clear, comprehensive documentation andexamples to help you get started quickly.

N.N. Pisaruk [email protected] MIPCL

Page 20: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started What is MIPCL? How good is MIPCL?

MIPCL Features

1 MIPCL API makes it easy to integrate optimization into user’sapplications.

2 MIPCL is highly flexible through many virtual functions thatallow developers to implement problem specific

1 cut and column generators;2 primal heuristics to search for feasible solutions;3 node selectors to guide the search;4 branching rules to split the problem into subproblems;5 preprocessing to simplify solved problems;6 management of cuts and generated columns.

3 MIPCL comes with clear, comprehensive documentation andexamples to help you get started quickly.

N.N. Pisaruk [email protected] MIPCL

Page 21: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started What is MIPCL? How good is MIPCL?

Outline

1 IntroductionWhat is MIPCL?How good is MIPCL?

2 Getting StartedSolving InstancesSolving Problems

N.N. Pisaruk [email protected] MIPCL

Page 22: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started What is MIPCL? How good is MIPCL?

Results for the MIPLIB-2010 Benchmark set:MIPCL on AMD FX8020 CPU (8 cores) vs SCIP on 2 Intel Xeon X5680 CPUs (6+6 cores)

Variables Time in sec.Name CtrsAll Int Bin MIPCL SCIP

30n20b8 576 18380 7344 11036 90 200.0%acc-tight5 3052 1339 1339 64 66aflow40b 1442 2728 1364 569 233

air04 823 8904 8904 14 70app1-2 53467 26871 13300 1080 490.3%

ash6gpia-3col 24748 3651 3651 710 94bab5 4964 21600 21600 332 0.9%

beasleyC3 1750 2500 1250 24 22.3%biella1 1203 7328 6110 94 723bienst2 576 505 35 246 128

bincar10_1 1026 2298 170 3 35bley_x11 175620 5831 5831 42 178bnatt350 4923 3150 3150 ∞% 344

core2536-691 2539 15293 15284 135 359cov1075 637 120 120 1473 1601

N.N. Pisaruk [email protected] MIPCL

Page 23: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started What is MIPCL? How good is MIPCL?

Results for the MIPLIB-2010 Benchmark set:MIPCL on AMD FX8020 CPU (8 cores) vs SCIP on 2 Intel Xeon X5680 CPUs (6+6 cores)

Variables Time in sec.Name CtrsAll Int Bin MIPCL SCIP

csched010 351 1758 1284 3792 1307danoint 664 521 56 2927 599

dfn-gwin-UUM 158 938 90 284 57eil32-2 32 4516 4516 100 163eilB101 100 2818 2818 184 445

enlight13 169 338 169 169 61 931enlight14 196 392 196 196 249 193

ex9 40962 10404 10404 4 87glass4 396 322 322 82.2% 570

gmu-35-40 424 1205 1200 1611 abortiis-100-0-cov 4803 345 345 385 718iis-bupa-cov 4803 345 345 2096 1350iis-pima-cov 7201 768 768 491 889

lectsched-4-obj 14163 7901 236 7665 72 121m100n500k4r1 100 500 500 4.2% 4.2%

N.N. Pisaruk [email protected] MIPCL

Page 24: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started What is MIPCL? How good is MIPCL?

Results for the MIPLIB-2010 Benchmark set:MIPCL on AMD FX8020 CPU (8 cores) vs SCIP on 2 Intel Xeon X5680 CPUs (6+6 cores)

Variables Time in sec.Name CtrsAll Int Bin MIPCL SCIP

macrophage 3164 2260 2260 1793 27.0%map18 328818 164547 146 0.98 3.03map20 328818 164547 146 464 1292

mcsched 2107 1747 14 1731 122 269mik-250-1-100-1 151 251 150 100 7 19

mine-166-5 8429 830 830 8 67mine-90-10 6270 900 900 633 320msc98-ip 15850 21143 53 20237 3205 57.0%mspp16 561657 29280 29280 5047 abortmzzv11 9499 10240 251 9989 37 850n3div36 4484 22120 22120 2766 11.0%n3seq24 6044 119856 119856 20.0% 20.0%

n4-3 1236 3596 174 43 441neos-1109824 28979 1520 1520 7 72neos-1337307 5687 2840 2840 0.0% 0.1%

N.N. Pisaruk [email protected] MIPCL

Page 25: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started What is MIPCL? How good is MIPCL?

Results for the MIPLIB-2010 Benchmark set:MIPCL on AMD FX8020 CPU (8 cores) vs SCIP on 2 Intel Xeon X5680 CPUs (6+6 cores)

Variables Time in sec.Name CtrsAll Int Bin MIPCL SCIP

neos-1396125 1494 1161 129 147 1278neos-1601936 3131 4446 3906 60 1223neos-476283 10015 11915 5588 1876 878neos-686190 3664 3660 60 3600 39 81neos-849702 1041 1737 1737 581 412neos-916792 1909 1474 717 ?% 15.7%neos-934278 11495 23123 19955 1258 4.0%

neos13 20852 1827 1815 170 655neos18 11402 3312 3312 34 65net12 14021 14115 1603 1129 44.9%

netdiversion 119589 129180 129180 1411 ∞%newdano 576 505 56 3463 924noswot 182 128 25 75 167 191

ns1208400 4289 2883 2880 212 ∞%ns1688347 4191 2685 2685 20 34.7%

N.N. Pisaruk [email protected] MIPCL

Page 26: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started What is MIPCL? How good is MIPCL?

Results for the MIPLIB-2010 Benchmark set:MIPCL on AMD FX8020 CPU (8 cores) vs SCIP on 2 Intel Xeon X5680 CPUs (6+6 cores)

Variables Time in sec.Name CtrsAll Int Bin MIPCL SCIP

ns1758913 624166 17956 17822 3107 ∞%ns1766074 182 100 90 53 2366ns1830653 2932 1629 1458 29 308opm2-z7-s2 31798 2023 2023 144 1572

pg5_34 225 2600 100 577 377pigeon-10 931 490 400 11.1% 11.1%

pw-myciel4 8164 1059 1 1058 537 1242qiu 1192 840 48 10 70

rail507 509 63019 6309 2078 3054ran16x16 288 512 256 36 54reblock67 2523 670 670 487 86

rmatr100-p10 7260 7359 100 31 397rmatr100-p5 8685 8784 100 35 1535

rmine6 7078 1096 1096 182 354rocII-4-11 21738 9234 9086 316 374err

N.N. Pisaruk [email protected] MIPCL

Page 27: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started What is MIPCL? How good is MIPCL?

Results for the MIPLIB-2010 Benchmark set:MIPCL on AMD FX8020 CPU (8 cores) vs SCIP on 2 Intel Xeon X5680 CPUs (6+6 cores)

Variables Time in sec.Name CtrsAll Int Bin MIPCL SCIP

rococoC10-001000 1293 3117 124 2993 1371 370roll3000 2295 1166 492 246 13 1440

satellites1-25 5996 9013 8509 616 240.0%sp98ic 825 10894 10894 1714 0.4%sp98ir 1531 1680 809 871 28 82

tanglegram1 2295 1166 492 246 740 0.0%tanglegram2 5996 9013 8509 14 2153

timtab1 825 10894 10894 92 174triptim1 1531 1680 809 871 953 3011unitcal_7 48939 25755 2856 498 0.1%vpphard 47280 51471 51471 ∞% ∞%

zib54-UUE 1809 5150 81 1079 811

N.N. Pisaruk [email protected] MIPCL

Page 28: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

Outline

1 IntroductionWhat is MIPCL?How good is MIPCL?

2 Getting StartedSolving InstancesSolving Problems

N.N. Pisaruk [email protected] MIPCL

Page 29: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

Example

10x0 + 6.4x1→max50x0 + 31x1 ≤ 250,−3x0 + 2x1 ≤ 4,x0, x1 ≥ 0 and integer.

(1)

N.N. Pisaruk [email protected] MIPCL

Page 30: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

Simple MIPCL-program (Variant 1)

#include "cmip.h"

void main(){

CMIP prob("MIPCLtest");prob.openMatrix(2,2,4);prob.addColumn(0,VAR_INT,10.0,0.0,VAR_INF);prob.addColumn(1,VAR_INT,6.4,0.0,VAR_INF);prob.addRow(0,0,-INF,250);prob.addRow(1,0,-INF,4);prob.addEntry(50.0,0,0);prob.addEntry(31.0,0,1);prob.addEntry(-3.0,1,0);prob.addEntry( 2.0,1,1);prob.closeMatrix();prob.optimize();prob.printSolution("solution.txt");

}

N.N. Pisaruk [email protected] MIPCL

Page 31: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

Simple MIPCL-program (Variant 1)

#include "cmip.h"

void main(){

CMIP prob("MIPCLtest");prob.openMatrix(2,2,4);prob.addColumn(0,VAR_INT,10.0,0.0,VAR_INF);prob.addColumn(1,VAR_INT,6.4,0.0,VAR_INF);prob.addRow(0,0,-INF,250);prob.addRow(1,0,-INF,4);prob.addEntry(50.0,0,0);prob.addEntry(31.0,0,1);prob.addEntry(-3.0,1,0);prob.addEntry( 2.0,1,1);prob.closeMatrix();prob.optimize();prob.printSolution("solution.txt");

}

N.N. Pisaruk [email protected] MIPCL

Page 32: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

Simple MIPCL-program (Variant 1)

#include "cmip.h"

void main(){

CMIP prob("MIPCLtest");prob.openMatrix(2,2,4);prob.addColumn(0,VAR_INT,10.0,0.0,VAR_INF);prob.addColumn(1,VAR_INT,6.4,0.0,VAR_INF);prob.addRow(0,0,-INF,250);prob.addRow(1,0,-INF,4);prob.addEntry(50.0,0,0);prob.addEntry(31.0,0,1);prob.addEntry(-3.0,1,0);prob.addEntry( 2.0,1,1);prob.closeMatrix();prob.optimize();prob.printSolution("solution.txt");

}

N.N. Pisaruk [email protected] MIPCL

Page 33: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

Simple MIPCL-program (Variant 1)

#include "cmip.h"

void main(){

CMIP prob("MIPCLtest");prob.openMatrix(2,2,4);prob.addColumn(0,VAR_INT,10.0,0.0,VAR_INF);prob.addColumn(1,VAR_INT,6.4,0.0,VAR_INF);prob.addRow(0,0,-INF,250);prob.addRow(1,0,-INF,4);prob.addEntry(50.0,0,0);prob.addEntry(31.0,0,1);prob.addEntry(-3.0,1,0);prob.addEntry( 2.0,1,1);prob.closeMatrix();prob.optimize();prob.printSolution("solution.txt");

}

N.N. Pisaruk [email protected] MIPCL

Page 34: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

Simple MIPCL-program (Variant 1)

#include "cmip.h"

void main(){

CMIP prob("MIPCLtest");prob.openMatrix(2,2,4);prob.addColumn(0,VAR_INT,10.0,0.0,VAR_INF);prob.addColumn(1,VAR_INT,6.4,0.0,VAR_INF);prob.addRow(0,0,-INF,250);prob.addRow(1,0,-INF,4);prob.addEntry(50.0,0,0);prob.addEntry(31.0,0,1);prob.addEntry(-3.0,1,0);prob.addEntry( 2.0,1,1);prob.closeMatrix();prob.optimize();prob.printSolution("solution.txt");

}

N.N. Pisaruk [email protected] MIPCL

Page 35: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

Simple MIPCL-program (Variant 1)

#include "cmip.h"

void main(){

CMIP prob("MIPCLtest");prob.openMatrix(2,2,4);prob.addColumn(0,VAR_INT,10.0,0.0,VAR_INF);prob.addColumn(1,VAR_INT,6.4,0.0,VAR_INF);prob.addRow(0,0,-INF,250);prob.addRow(1,0,-INF,4);prob.addEntry(50.0,0,0);prob.addEntry(31.0,0,1);prob.addEntry(-3.0,1,0);prob.addEntry( 2.0,1,1);prob.closeMatrix();prob.optimize();prob.printSolution("solution.txt");

}

N.N. Pisaruk [email protected] MIPCL

Page 36: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

Simple MIPCL-program (Variant 1)

#include "cmip.h"

void main(){

CMIP prob("MIPCLtest");prob.openMatrix(2,2,4);prob.addColumn(0,VAR_INT,10.0,0.0,VAR_INF);prob.addColumn(1,VAR_INT,6.4,0.0,VAR_INF);prob.addRow(0,0,-INF,250);prob.addRow(1,0,-INF,4);prob.addEntry(50.0,0,0);prob.addEntry(31.0,0,1);prob.addEntry(-3.0,1,0);prob.addEntry( 2.0,1,1);prob.closeMatrix();prob.optimize();prob.printSolution("solution.txt");

}

N.N. Pisaruk [email protected] MIPCL

Page 37: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

Simple MIPCL-program (Variant 1)

#include "cmip.h"

void main(){

CMIP prob("MIPCLtest");prob.openMatrix(2,2,4);prob.addColumn(0,VAR_INT,10.0,0.0,VAR_INF);prob.addColumn(1,VAR_INT,6.4,0.0,VAR_INF);prob.addRow(0,0,-INF,250);prob.addRow(1,0,-INF,4);prob.addEntry(50.0,0,0);prob.addEntry(31.0,0,1);prob.addEntry(-3.0,1,0);prob.addEntry( 2.0,1,1);prob.closeMatrix();prob.optimize();prob.printSolution("solution.txt");

}

N.N. Pisaruk [email protected] MIPCL

Page 38: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

Simple MIPCL-program (Variant 2)

#include "cmip.h"const int n=2, m=2, nz=4;double c[] = {10.0,6.4}, b[] = {250,4};double A[][n] = {{50,31},{-3,2}};int ind[] = {0,1};void main(){

CMIP prob("MIPCLtest");prob.openMatrix(m,n,nz);for (int j=0; j < n; ++j)

prob.addColumn(j,VAR_INT,c[j],0.0,VAR_INF);for (int i=0; i < m; ++i)

prob.addRow(i,0,-INF,b[i],n,A[i],ind);

prob.closeMatrix();prob.optimize();prob.printSolution("solution.txt");

}N.N. Pisaruk [email protected] MIPCL

Page 39: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

Simple MIPCL-program (Variant 2)

#include "cmip.h"const int n=2, m=2, nz=4;double c[] = {10.0,6.4}, b[] = {250,4};double A[][n] = {{50,31},{-3,2}};int ind[] = {0,1};void main(){

CMIP prob("MIPCLtest");prob.openMatrix(m,n,nz);for (int j=0; j < n; ++j)

prob.addColumn(j,VAR_INT,c[j],0.0,VAR_INF);for (int i=0; i < m; ++i)

prob.addRow(i,0,-INF,b[i],n,A[i],ind);

prob.closeMatrix();prob.optimize();prob.printSolution("solution.txt");

}N.N. Pisaruk [email protected] MIPCL

Page 40: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

Simple MIPCL-program (Variant 2)

#include "cmip.h"const int n=2, m=2, nz=4;double c[] = {10.0,6.4}, b[] = {250,4};double A[][n] = {{50,31},{-3,2}};int ind[] = {0,1};void main(){

CMIP prob("MIPCLtest");prob.openMatrix(m,n,nz);for (int j=0; j < n; ++j)

prob.addColumn(j,VAR_INT,c[j],0.0,VAR_INF);for (int i=0; i < m; ++i)

prob.addRow(i,0,-INF,b[i],n,A[i],ind);

prob.closeMatrix();prob.optimize();prob.printSolution("solution.txt");

}N.N. Pisaruk [email protected] MIPCL

Page 41: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

Simple MIPCL-program (Variant 2)

#include "cmip.h"const int n=2, m=2, nz=4;double c[] = {10.0,6.4}, b[] = {250,4};double A[][n] = {{50,31},{-3,2}};int ind[] = {0,1};void main(){

CMIP prob("MIPCLtest");prob.openMatrix(m,n,nz);for (int j=0; j < n; ++j)

prob.addColumn(j,VAR_INT,c[j],0.0,VAR_INF);for (int i=0; i < m; ++i)

prob.addRow(i,0,-INF,b[i],n,A[i],ind);

prob.closeMatrix();prob.optimize();prob.printSolution("solution.txt");

}N.N. Pisaruk [email protected] MIPCL

Page 42: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

Simple MIPCL-program (Variant 2)

#include "cmip.h"const int n=2, m=2, nz=4;double c[] = {10.0,6.4}, b[] = {250,4};double A[][n] = {{50,31},{-3,2}};int ind[] = {0,1};void main(){

CMIP prob("MIPCLtest");prob.openMatrix(m,n,nz);for (int j=0; j < n; ++j)

prob.addColumn(j,VAR_INT,c[j],0.0,VAR_INF);for (int i=0; i < m; ++i)

prob.addRow(i,0,-INF,b[i],n,A[i],ind);

prob.closeMatrix();prob.optimize();prob.printSolution("solution.txt");

}N.N. Pisaruk [email protected] MIPCL

Page 43: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

Simple MIPCL-program (Variant 2)

#include "cmip.h"const int n=2, m=2, nz=4;double c[] = {10.0,6.4}, b[] = {250,4};double A[][n] = {{50,31},{-3,2}};int ind[] = {0,1};void main(){

CMIP prob("MIPCLtest");prob.openMatrix(m,n,nz);for (int j=0; j < n; ++j)

prob.addColumn(j,VAR_INT,c[j],0.0,VAR_INF);for (int i=0; i < m; ++i)

prob.addRow(i,0,-INF,b[i],n,A[i],ind);

prob.closeMatrix();prob.optimize();prob.printSolution("solution.txt");

}N.N. Pisaruk [email protected] MIPCL

Page 44: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

Simple MIPCL-program (Variant 2)

#include "cmip.h"const int n=2, m=2, nz=4;double c[] = {10.0,6.4}, b[] = {250,4};double A[][n] = {{50,31},{-3,2}};int ind[] = {0,1};void main(){

CMIP prob("MIPCLtest");prob.openMatrix(m,n,nz);for (int j=0; j < n; ++j)

prob.addColumn(j,VAR_INT,c[j],0.0,VAR_INF);for (int i=0; i < m; ++i)

prob.addRow(i,0,-INF,b[i],n,A[i],ind);

prob.closeMatrix();prob.optimize();prob.printSolution("solution.txt");

}N.N. Pisaruk [email protected] MIPCL

Page 45: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

Simple MIPCL-program (Variant 2)

#include "cmip.h"const int n=2, m=2, nz=4;double c[] = {10.0,6.4}, b[] = {250,4};double A[][n] = {{50,31},{-3,2}};int ind[] = {0,1};void main(){

CMIP prob("MIPCLtest");prob.openMatrix(m,n,nz);for (int j=0; j < n; ++j)

prob.addColumn(j,VAR_INT,c[j],0.0,VAR_INF);for (int i=0; i < m; ++i)

prob.addRow(i,0,-INF,b[i],n,A[i],ind);

prob.closeMatrix();prob.optimize();prob.printSolution("solution.txt");

}N.N. Pisaruk [email protected] MIPCL

Page 46: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

Simple MIPCL-program (Variant 2)

#include "cmip.h"const int n=2, m=2, nz=4;double c[] = {10.0,6.4}, b[] = {250,4};double A[][n] = {{50,31},{-3,2}};int ind[] = {0,1};void main(){

CMIP prob("MIPCLtest");prob.openMatrix(m,n,nz);for (int j=0; j < n; ++j)

prob.addColumn(j,VAR_INT,c[j],0.0,VAR_INF);for (int i=0; i < m; ++i)

prob.addRow(i,0,-INF,b[i],n,A[i],ind);

prob.closeMatrix();prob.optimize();prob.printSolution("solution.txt");

}N.N. Pisaruk [email protected] MIPCL

Page 47: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

Outline

1 IntroductionWhat is MIPCL?How good is MIPCL?

2 Getting StartedSolving InstancesSolving Problems

N.N. Pisaruk [email protected] MIPCL

Page 48: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

Fixed Charge Flow Networks (FCNF)

Given:

G = (V,E) — digraph;

dv — demand at node v ∈ V (∑

v∈V dv = 0);

ue > 0 — capacity of arc e ∈ E;

c̄(xe) =

{0, xe = 0,fe + cexe, xe > 0

— cost of shipping xe units of

flow along arc e ∈ E.

Find a flow x ∈ RE+ of minimum cost

∑e∈E c̄(xe) satisfying the

demand and capacity constraints.

N.N. Pisaruk [email protected] MIPCL

Page 49: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

Fixed Charge Flow Networks (FCNF)

Given:

G = (V,E) — digraph;

dv — demand at node v ∈ V (∑

v∈V dv = 0);

ue > 0 — capacity of arc e ∈ E;

c̄(xe) =

{0, xe = 0,fe + cexe, xe > 0

— cost of shipping xe units of

flow along arc e ∈ E.

Find a flow x ∈ RE+ of minimum cost

∑e∈E c̄(xe) satisfying the

demand and capacity constraints.

N.N. Pisaruk [email protected] MIPCL

Page 50: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

Fixed Charge Flow Networks (FCNF)

Given:

G = (V,E) — digraph;

dv — demand at node v ∈ V (∑

v∈V dv = 0);

ue > 0 — capacity of arc e ∈ E;

c̄(xe) =

{0, xe = 0,fe + cexe, xe > 0

— cost of shipping xe units of

flow along arc e ∈ E.

Find a flow x ∈ RE+ of minimum cost

∑e∈E c̄(xe) satisfying the

demand and capacity constraints.

N.N. Pisaruk [email protected] MIPCL

Page 51: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

Fixed Charge Flow Networks (FCNF)

Given:

G = (V,E) — digraph;

dv — demand at node v ∈ V (∑

v∈V dv = 0);

ue > 0 — capacity of arc e ∈ E;

c̄(xe) =

{0, xe = 0,fe + cexe, xe > 0

— cost of shipping xe units of

flow along arc e ∈ E.

Find a flow x ∈ RE+ of minimum cost

∑e∈E c̄(xe) satisfying the

demand and capacity constraints.

N.N. Pisaruk [email protected] MIPCL

Page 52: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

Fixed Charge Flow Networks (FCNF)

Given:

G = (V,E) — digraph;

dv — demand at node v ∈ V (∑

v∈V dv = 0);

ue > 0 — capacity of arc e ∈ E;

c̄(xe) =

{0, xe = 0,fe + cexe, xe > 0

— cost of shipping xe units of

flow along arc e ∈ E.

Find a flow x ∈ RE+ of minimum cost

∑e∈E c̄(xe) satisfying the

demand and capacity constraints.

N.N. Pisaruk [email protected] MIPCL

Page 53: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

Fixed Charge Flow Networks (FCNF)

Given:

G = (V,E) — digraph;

dv — demand at node v ∈ V (∑

v∈V dv = 0);

ue > 0 — capacity of arc e ∈ E;

c̄(xe) =

{0, xe = 0,fe + cexe, xe > 0

— cost of shipping xe units of

flow along arc e ∈ E.

Find a flow x ∈ RE+ of minimum cost

∑e∈E c̄(xe) satisfying the

demand and capacity constraints.

N.N. Pisaruk [email protected] MIPCL

Page 54: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

FCNF MIP-formulation

Variables:xe — flow along arc e ∈ E,ye = 1 if xe > 0, and ye = 0 otherwise.

Formulation: ∑e∈E

(feye + cexe)→ min (2a)∑e∈E(V,v)

xe −∑

e∈E(v,V)

xe = dv, v ∈ V, (2b)

0 ≤ xe ≤ ueye, e ∈ E, (2c)

ye ∈ {0, 1}, e ∈ E, (2d)

where, for S,T ⊆ V , E(S,T)def= {(v,w) ∈ E : v ∈ S, w ∈ T}.

N.N. Pisaruk [email protected] MIPCL

Page 55: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

FCNF MIP-formulation

Variables:xe — flow along arc e ∈ E,ye = 1 if xe > 0, and ye = 0 otherwise.

Formulation: ∑e∈E

(feye + cexe)→ min (2a)∑e∈E(V,v)

xe −∑

e∈E(v,V)

xe = dv, v ∈ V, (2b)

0 ≤ xe ≤ ueye, e ∈ E, (2c)

ye ∈ {0, 1}, e ∈ E, (2d)

where, for S,T ⊆ V , E(S,T)def= {(v,w) ∈ E : v ∈ S, w ∈ T}.

N.N. Pisaruk [email protected] MIPCL

Page 56: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

FCNF MIP-formulation

Variables:xe — flow along arc e ∈ E,ye = 1 if xe > 0, and ye = 0 otherwise.

Formulation: ∑e∈E

(feye + cexe)→ min (2a)∑e∈E(V,v)

xe −∑

e∈E(v,V)

xe = dv, v ∈ V, (2b)

0 ≤ xe ≤ ueye, e ∈ E, (2c)

ye ∈ {0, 1}, e ∈ E, (2d)

where, for S,T ⊆ V , E(S,T)def= {(v,w) ∈ E : v ∈ S, w ∈ T}.

N.N. Pisaruk [email protected] MIPCL

Page 57: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

FCNF MIP-formulation

Variables:xe — flow along arc e ∈ E,ye = 1 if xe > 0, and ye = 0 otherwise.

Formulation: ∑e∈E

(feye + cexe)→ min (2a)∑e∈E(V,v)

xe −∑

e∈E(v,V)

xe = dv, v ∈ V, (2b)

0 ≤ xe ≤ ueye, e ∈ E, (2c)

ye ∈ {0, 1}, e ∈ E, (2d)

where, for S,T ⊆ V , E(S,T)def= {(v,w) ∈ E : v ∈ S, w ∈ T}.

N.N. Pisaruk [email protected] MIPCL

Page 58: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

FCNF MIP-formulation

Variables:xe — flow along arc e ∈ E,ye = 1 if xe > 0, and ye = 0 otherwise.

Formulation: ∑e∈E

(feye + cexe)→ min (2a)∑e∈E(V,v)

xe −∑

e∈E(v,V)

xe = dv, v ∈ V, (2b)

0 ≤ xe ≤ ueye, e ∈ E, (2c)

ye ∈ {0, 1}, e ∈ E, (2d)

where, for S,T ⊆ V , E(S,T)def= {(v,w) ∈ E : v ∈ S, w ∈ T}.

N.N. Pisaruk [email protected] MIPCL

Page 59: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

FCNF MIP-formulation

Variables:xe — flow along arc e ∈ E,ye = 1 if xe > 0, and ye = 0 otherwise.

Formulation: ∑e∈E

(feye + cexe)→ min (2a)∑e∈E(V,v)

xe −∑

e∈E(v,V)

xe = dv, v ∈ V, (2b)

0 ≤ xe ≤ ueye, e ∈ E, (2c)

ye ∈ {0, 1}, e ∈ E, (2d)

where, for S,T ⊆ V , E(S,T)def= {(v,w) ∈ E : v ∈ S, w ∈ T}.

N.N. Pisaruk [email protected] MIPCL

Page 60: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

FCNF MIP-formulation

Variables:xe — flow along arc e ∈ E,ye = 1 if xe > 0, and ye = 0 otherwise.

Formulation: ∑e∈E

(feye + cexe)→ min (2a)∑e∈E(V,v)

xe −∑

e∈E(v,V)

xe = dv, v ∈ V, (2b)

0 ≤ xe ≤ ueye, e ∈ E, (2c)

ye ∈ {0, 1}, e ∈ E, (2d)

where, for S,T ⊆ V , E(S,T)def= {(v,w) ∈ E : v ∈ S, w ∈ T}.

N.N. Pisaruk [email protected] MIPCL

Page 61: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

FCNF MIP-formulation

Variables:xe — flow along arc e ∈ E,ye = 1 if xe > 0, and ye = 0 otherwise.

Formulation: ∑e∈E

(feye + cexe)→ min (2a)∑e∈E(V,v)

xe −∑

e∈E(v,V)

xe = dv, v ∈ V, (2b)

0 ≤ xe ≤ ueye, e ∈ E, (2c)

ye ∈ {0, 1}, e ∈ E, (2d)

where, for S,T ⊆ V , E(S,T)def= {(v,w) ∈ E : v ∈ S, w ∈ T}.

N.N. Pisaruk [email protected] MIPCL

Page 62: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

FCNF MIP-formulation

Variables:xe — flow along arc e ∈ E,ye = 1 if xe > 0, and ye = 0 otherwise.

Formulation: ∑e∈E

(feye + cexe)→ min (2a)∑e∈E(V,v)

xe −∑

e∈E(v,V)

xe = dv, v ∈ V, (2b)

0 ≤ xe ≤ ueye, e ∈ E, (2c)

ye ∈ {0, 1}, e ∈ E, (2d)

where, for S,T ⊆ V , E(S,T)def= {(v,w) ∈ E : v ∈ S, w ∈ T}.

N.N. Pisaruk [email protected] MIPCL

Page 63: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

Definition of Class CFCNF (file fcnf.h)

#include "cmip.h"

class CFCFN: public CMIP

{int n,m;int *d,*t,*h,*u,*f,*c;public:CFCFN(const char *name,int n,int m,int *d,

int *t,int *h,int *u,int *f,int *c);virtual ∼CFCFN() {};void printSolution(const char *FileName);private:void buildProb();

};

N.N. Pisaruk [email protected] MIPCL

Page 64: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

Definition of Class CFCNF (file fcnf.h)

#include "cmip.h"

class CFCFN: public CMIP

{int n,m;int *d,*t,*h,*u,*f,*c;public:CFCFN(const char *name,int n,int m,int *d,

int *t,int *h,int *u,int *f,int *c);virtual ∼CFCFN() {};void printSolution(const char *FileName);private:void buildProb();

};

N.N. Pisaruk [email protected] MIPCL

Page 65: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

Definition of Class CFCNF (file fcnf.h)

#include "cmip.h"

class CFCFN: public CMIP

{int n,m;int *d,*t,*h,*u,*f,*c;public:CFCFN(const char *name,int n,int m,int *d,

int *t,int *h,int *u,int *f,int *c);virtual ∼CFCFN() {};void printSolution(const char *FileName);private:void buildProb();

};

Jump to implementation

N.N. Pisaruk [email protected] MIPCL

Page 66: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

Definition of Class CFCNF (file fcnf.h)

#include "cmip.h"

class CFCFN: public CMIP

{int n,m;int *d,*t,*h,*u,*f,*c;public:CFCFN(const char *name,int n,int m,int *d,

int *t,int *h,int *u,int *f,int *c);virtual ∼CFCFN() {};void printSolution(const char *FileName);private:void buildProb();

};

N.N. Pisaruk [email protected] MIPCL

Page 67: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

Definition of Class CFCNF (file fcnf.h)

#include "cmip.h"

class CFCFN: public CMIP

{int n,m;int *d,*t,*h,*u,*f,*c;public:CFCFN(const char *name,int n,int m,int *d,

int *t,int *h,int *u,int *f,int *c);virtual ∼CFCFN() {};void printSolution(const char *FileName);private:void buildProb();

};

Jump to implementation

N.N. Pisaruk [email protected] MIPCL

Page 68: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

Definition of Class CFCNF (file fcnf.h)

#include "cmip.h"

class CFCFN: public CMIP

{int n,m;int *d,*t,*h,*u,*f,*c;public:CFCFN(const char *name,int n,int m,int *d,

int *t,int *h,int *u,int *f,int *c);virtual ∼CFCFN() {};void printSolution(const char *FileName);private:void buildProb();

};

Jump to implementation

N.N. Pisaruk [email protected] MIPCL

Page 69: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

Implementation of CFCNF: Constructor

#include "fcnf.h"

CFCNF::CFCFN(const char *name,

int n0,int m0,int *d0,int *t0,int *h0,

int *u0,int *f0,int *c0): CMIP(name)

{n=n0; m=m0;d=d0; t=t0; h=h0; u=u0; f=f0; c=c0;buildProb();

}

Return to definition

N.N. Pisaruk [email protected] MIPCL

Page 70: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

Implementation of CFCNF: Constructor

#include "fcnf.h"

CFCNF::CFCFN(const char *name,

int n0,int m0,int *d0,int *t0,int *h0,

int *u0,int *f0,int *c0): CMIP(name)

{n=n0; m=m0;d=d0; t=t0; h=h0; u=u0; f=f0; c=c0;buildProb();

}

Return to definition

N.N. Pisaruk [email protected] MIPCL

Page 71: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

Implementation of CFCNF: Constructor

#include "fcnf.h"

CFCNF::CFCFN(const char *name,

int n0,int m0,int *d0,int *t0,int *h0,

int *u0,int *f0,int *c0): CMIP(name)

{n=n0; m=m0;d=d0; t=t0; h=h0; u=u0; f=f0; c=c0;buildProb();

}

Return to definition

N.N. Pisaruk [email protected] MIPCL

Page 72: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

Implementation of CFCNF: function buildProb()

void CFCFN::buildProb(){

double w, val[]={-1.0,1.0,1.0};int r=n,row[3];openMatrix(m+n,2*m,6*m);for (int i=0; i < n; ++i)

addRow(i,0,d[i],d[i]);for (int e=0; e < m; ++e)

addRow(r++,0,-INF,0.0);for (int e=0; e < m; ++e) {

row[0]=t[e]; row[1]=h[e]; row[2]=n+e;addColumn(e,0,-c[e],0,VAR_INF,3,val,row);w=-u[e]; r=n+e;addColumn(e+m,VAR_BIN,-f[e],0,1,1,&w,&r);

}closeMatrix();

}

Return to definition

N.N. Pisaruk [email protected] MIPCL

Page 73: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

Implementation of CFCNF: function buildProb()

void CFCFN::buildProb(){

double w, val[]={-1.0,1.0,1.0};int r=n,row[3];openMatrix(m+n,2*m,6*m);for (int i=0; i < n; ++i)

addRow(i,0,d[i],d[i]);for (int e=0; e < m; ++e)

addRow(r++,0,-INF,0.0);for (int e=0; e < m; ++e) {

row[0]=t[e]; row[1]=h[e]; row[2]=n+e;addColumn(e,0,-c[e],0,VAR_INF,3,val,row);w=-u[e]; r=n+e;addColumn(e+m,VAR_BIN,-f[e],0,1,1,&w,&r);

}closeMatrix();

}

Return to definition

N.N. Pisaruk [email protected] MIPCL

Page 74: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

Implementation of CFCNF: function buildProb()

void CFCFN::buildProb(){

double w, val[]={-1.0,1.0,1.0};int r=n,row[3];openMatrix(m+n,2*m,6*m);for (int i=0; i < n; ++i)

addRow(i,0,d[i],d[i]);for (int e=0; e < m; ++e)

addRow(r++,0,-INF,0.0);for (int e=0; e < m; ++e) {

row[0]=t[e]; row[1]=h[e]; row[2]=n+e;addColumn(e,0,-c[e],0,VAR_INF,3,val,row);w=-u[e]; r=n+e;addColumn(e+m,VAR_BIN,-f[e],0,1,1,&w,&r);

}closeMatrix();

}

Return to definition

N.N. Pisaruk [email protected] MIPCL

Page 75: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

Implementation of CFCNF: function buildProb()

void CFCFN::buildProb(){

double w, val[]={-1.0,1.0,1.0};int r=n,row[3];openMatrix(m+n,2*m,6*m);for (int i=0; i < n; ++i)

addRow(i,0,d[i],d[i]);for (int e=0; e < m; ++e)

addRow(r++,0,-INF,0.0);for (int e=0; e < m; ++e) {

row[0]=t[e]; row[1]=h[e]; row[2]=n+e;addColumn(e,0,-c[e],0,VAR_INF,3,val,row);w=-u[e]; r=n+e;addColumn(e+m,VAR_BIN,-f[e],0,1,1,&w,&r);

}closeMatrix();

}

Return to definition

N.N. Pisaruk [email protected] MIPCL

Page 76: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

Implementation of CFCNF: function buildProb()

void CFCFN::buildProb(){

double w, val[]={-1.0,1.0,1.0};int r=n,row[3];openMatrix(m+n,2*m,6*m);for (int i=0; i < n; ++i)

addRow(i,0,d[i],d[i]);for (int e=0; e < m; ++e)

addRow(r++,0,-INF,0.0);for (int e=0; e < m; ++e) {

row[0]=t[e]; row[1]=h[e]; row[2]=n+e;addColumn(e,0,-c[e],0,VAR_INF,3,val,row);w=-u[e]; r=n+e;addColumn(e+m,VAR_BIN,-f[e],0,1,1,&w,&r);

}closeMatrix();

}

Return to definition

N.N. Pisaruk [email protected] MIPCL

Page 77: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

Implementation of CFCNF: function buildProb()

void CFCFN::buildProb(){

double w, val[]={-1.0,1.0,1.0};int r=n,row[3];openMatrix(m+n,2*m,6*m);for (int i=0; i < n; ++i)

addRow(i,0,d[i],d[i]);for (int e=0; e < m; ++e)

addRow(r++,0,-INF,0.0);for (int e=0; e < m; ++e) {

row[0]=t[e]; row[1]=h[e]; row[2]=n+e;addColumn(e,0,-c[e],0,VAR_INF,3,val,row);w=-u[e]; r=n+e;addColumn(e+m,VAR_BIN,-f[e],0,1,1,&w,&r);

}closeMatrix();

}

Return to definition

N.N. Pisaruk [email protected] MIPCL

Page 78: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

Implementation of CFCNF: function buildProb()

void CFCFN::buildProb(){

double w, val[]={-1.0,1.0,1.0};int r=n,row[3];openMatrix(m+n,2*m,6*m);for (int i=0; i < n; ++i)

addRow(i,0,d[i],d[i]);for (int e=0; e < m; ++e)

addRow(r++,0,-INF,0.0);for (int e=0; e < m; ++e) {

row[0]=t[e]; row[1]=h[e]; row[2]=n+e;addColumn(e,0,-c[e],0,VAR_INF,3,val,row);w=-u[e]; r=n+e;addColumn(e+m,VAR_BIN,-f[e],0,1,1,&w,&r);

}closeMatrix();

}

Return to definition

N.N. Pisaruk [email protected] MIPCL

Page 79: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

Implementation of CFCNF: function buildProb()

void CFCFN::buildProb(){

double w, val[]={-1.0,1.0,1.0};int r=n,row[3];openMatrix(m+n,2*m,6*m);for (int i=0; i < n; ++i)

addRow(i,0,d[i],d[i]);for (int e=0; e < m; ++e)

addRow(r++,0,-INF,0.0);for (int e=0; e < m; ++e) {

row[0]=t[e]; row[1]=h[e]; row[2]=n+e;addColumn(e,0,-c[e],0,VAR_INF,3,val,row);w=-u[e]; r=n+e;addColumn(e+m,VAR_BIN,-f[e],0,1,1,&w,&r);

}closeMatrix();

}

Return to definition

N.N. Pisaruk [email protected] MIPCL

Page 80: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

Implementation of CFCNF: function printSolution()

void CFCNF::printSolution(const char* name){

double *x;int m2=2*m,*hd;std::ofstream fout(name);if (isSolution()) {

getSolution(x,hd);fout << "Nonzero flows:\n";for (int i=0; i < m2; ++i)

if (hd[i] < m && x[i] > 0.5))fout << "flow(" << t[hd[i]] << ","

<< h[hd[i]] << ")="<< x[i] << std::endl;

}else fout << "Problem has no solution!\n";fout.close();

}

Return to definition

N.N. Pisaruk [email protected] MIPCL

Page 81: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

Implementation of CFCNF: function printSolution()

void CFCNF::printSolution(const char* name){

double *x;int m2=2*m,*hd;std::ofstream fout(name);if (isSolution()) {

getSolution(x,hd);fout << "Nonzero flows:\n";for (int i=0; i < m2; ++i)

if (hd[i] < m && x[i] > 0.5))fout << "flow(" << t[hd[i]] << ","

<< h[hd[i]] << ")="<< x[i] << std::endl;

}else fout << "Problem has no solution!\n";fout.close();

}

Return to definition

N.N. Pisaruk [email protected] MIPCL

Page 82: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

Implementation of CFCNF: function printSolution()

void CFCNF::printSolution(const char* name){

double *x;int m2=2*m,*hd;std::ofstream fout(name);if (isSolution()) {

getSolution(x,hd);fout << "Nonzero flows:\n";for (int i=0; i < m2; ++i)

if (hd[i] < m && x[i] > 0.5))fout << "flow(" << t[hd[i]] << ","

<< h[hd[i]] << ")="<< x[i] << std::endl;

}else fout << "Problem has no solution!\n";fout.close();

}

Return to definition

N.N. Pisaruk [email protected] MIPCL

Page 83: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

Implementation of CFCNF: function printSolution()

void CFCNF::printSolution(const char* name){

double *x;int m2=2*m,*hd;std::ofstream fout(name);if (isSolution()) {

getSolution(x,hd);fout << "Nonzero flows:\n";for (int i=0; i < m2; ++i)

if (hd[i] < m && x[i] > 0.5))fout << "flow(" << t[hd[i]] << ","

<< h[hd[i]] << ")="<< x[i] << std::endl;

}else fout << "Problem has no solution!\n";fout.close();

}

Return to definition

N.N. Pisaruk [email protected] MIPCL

Page 84: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

Implementation of CFCNF: function printSolution()

void CFCNF::printSolution(const char* name){

double *x;int m2=2*m,*hd;std::ofstream fout(name);if (isSolution()) {

getSolution(x,hd);fout << "Nonzero flows:\n";for (int i=0; i < m2; ++i)

if (hd[i] < m && x[i] > 0.5))fout << "flow(" << t[hd[i]] << ","

<< h[hd[i]] << ")="<< x[i] << std::endl;

}else fout << "Problem has no solution!\n";fout.close();

}

Return to definition

N.N. Pisaruk [email protected] MIPCL

Page 85: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

Implementation of CFCNF: function printSolution()

void CFCNF::printSolution(const char* name){

double *x;int m2=2*m,*hd;std::ofstream fout(name);if (isSolution()) {

getSolution(x,hd);fout << "Nonzero flows:\n";for (int i=0; i < m2; ++i)

if (hd[i] < m && x[i] > 0.5))fout << "flow(" << t[hd[i]] << ","

<< h[hd[i]] << ")="<< x[i] << std::endl;

}else fout << "Problem has no solution!\n";fout.close();

}

Return to definition

N.N. Pisaruk [email protected] MIPCL

Page 86: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

Implementation of CFCNF: function printSolution()

void CFCNF::printSolution(const char* name){

double *x;int m2=2*m,*hd;std::ofstream fout(name);if (isSolution()) {

getSolution(x,hd);fout << "Nonzero flows:\n";for (int i=0; i < m2; ++i)

if (hd[i] < m && x[i] > 0.5))fout << "flow(" << t[hd[i]] << ","

<< h[hd[i]] << ")="<< x[i] << std::endl;

}else fout << "Problem has no solution!\n";fout.close();

}

Return to definition

N.N. Pisaruk [email protected] MIPCL

Page 87: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

Implementation of CFCNF: function printSolution()

void CFCNF::printSolution(const char* name){

double *x;int m2=2*m,*hd;std::ofstream fout(name);if (isSolution()) {

getSolution(x,hd);fout << "Nonzero flows:\n";for (int i=0; i < m2; ++i)

if (hd[i] < m && x[i] > 0.5))fout << "flow(" << t[hd[i]] << ","

<< h[hd[i]] << ")="<< x[i] << std::endl;

}else fout << "Problem has no solution!\n";fout.close();

}

Return to definition

N.N. Pisaruk [email protected] MIPCL

Page 88: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

Implementation of CFCNF: function printSolution()

void CFCNF::printSolution(const char* name){

double *x;int m2=2*m,*hd;std::ofstream fout(name);if (isSolution()) {

getSolution(x,hd);fout << "Nonzero flows:\n";for (int i=0; i < m2; ++i)

if (hd[i] < m && x[i] > 0.5))fout << "flow(" << t[hd[i]] << ","

<< h[hd[i]] << ")="<< x[i] << std::endl;

}else fout << "Problem has no solution!\n";fout.close();

}

Return to definition

N.N. Pisaruk [email protected] MIPCL

Page 89: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

Using CFCNF: function main()

int main(int argc, char *argv[])

{int n,m,*d,*t,*h,*u,*f,*c;readNet(argv[1],n,m,d,t,h,u,f,c);CFCFN prob("FCFN",n,m,d,t,h,u,f,c,d);prob.optimize();char name[128];strcpy(name,argv[1]);strcat(name,"_sol.txt");prob.printSolution(name);delete[] d;return 0;

}

N.N. Pisaruk [email protected] MIPCL

Page 90: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

Using CFCNF: function main()

int main(int argc, char *argv[])

{int n,m,*d,*t,*h,*u,*f,*c;readNet(argv[1],n,m,d,t,h,u,f,c);CFCFN prob("FCFN",n,m,d,t,h,u,f,c,d);prob.optimize();char name[128];strcpy(name,argv[1]);strcat(name,"_sol.txt");prob.printSolution(name);delete[] d;return 0;

}

N.N. Pisaruk [email protected] MIPCL

Page 91: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

Using CFCNF: function main()

int main(int argc, char *argv[])

{int n,m,*d,*t,*h,*u,*f,*c;readNet(argv[1],n,m,d,t,h,u,f,c);CFCFN prob("FCFN",n,m,d,t,h,u,f,c,d);prob.optimize();char name[128];strcpy(name,argv[1]);strcat(name,"_sol.txt");prob.printSolution(name);delete[] d;return 0;

}

Jump to implementation

N.N. Pisaruk [email protected] MIPCL

Page 92: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

Using CFCNF: function main()

int main(int argc, char *argv[])

{int n,m,*d,*t,*h,*u,*f,*c;readNet(argv[1],n,m,d,t,h,u,f,c);CFCFN prob("FCFN",n,m,d,t,h,u,f,c,d);prob.optimize();char name[128];strcpy(name,argv[1]);strcat(name,"_sol.txt");prob.printSolution(name);delete[] d;return 0;

}

N.N. Pisaruk [email protected] MIPCL

Page 93: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

Using CFCNF: function main()

int main(int argc, char *argv[])

{int n,m,*d,*t,*h,*u,*f,*c;readNet(argv[1],n,m,d,t,h,u,f,c);CFCFN prob("FCFN",n,m,d,t,h,u,f,c,d);prob.optimize();char name[128];strcpy(name,argv[1]);strcat(name,"_sol.txt");prob.printSolution(name);delete[] d;return 0;

}

N.N. Pisaruk [email protected] MIPCL

Page 94: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

Using CFCNF: function main()

int main(int argc, char *argv[])

{int n,m,*d,*t,*h,*u,*f,*c;readNet(argv[1],n,m,d,t,h,u,f,c);CFCFN prob("FCFN",n,m,d,t,h,u,f,c,d);prob.optimize();char name[128];strcpy(name,argv[1]);strcat(name,"_sol.txt");prob.printSolution(name);delete[] d;return 0;

}

N.N. Pisaruk [email protected] MIPCL

Page 95: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

Using CFCNF: function main()

int main(int argc, char *argv[])

{int n,m,*d,*t,*h,*u,*f,*c;readNet(argv[1],n,m,d,t,h,u,f,c);CFCFN prob("FCFN",n,m,d,t,h,u,f,c,d);prob.optimize();char name[128];strcpy(name,argv[1]);strcat(name,"_sol.txt");prob.printSolution(name);delete[] d;return 0;

}

N.N. Pisaruk [email protected] MIPCL

Page 96: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

Using CFCNF: function main()

int main(int argc, char *argv[])

{int n,m,*d,*t,*h,*u,*f,*c;readNet(argv[1],n,m,d,t,h,u,f,c);CFCFN prob("FCFN",n,m,d,t,h,u,f,c,d);prob.optimize();char name[128];strcpy(name,argv[1]);strcat(name,"_sol.txt");prob.printSolution(name);delete[] d;return 0;

}

N.N. Pisaruk [email protected] MIPCL

Page 97: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Introduction Getting Started Solving Instances Solving Problems

Using CFCNF: function main()

int main(int argc, char *argv[])

{int n,m,*d,*t,*h,*u,*f,*c;readNet(argv[1],n,m,d,t,h,u,f,c);CFCFN prob("FCFN",n,m,d,t,h,u,f,c,d);prob.optimize();char name[128];strcpy(name,argv[1]);strcat(name,"_sol.txt");prob.printSolution(name);delete[] d;return 0;

}

N.N. Pisaruk [email protected] MIPCL

Page 98: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Appendix Miscellaneous

3 AppendixMiscellaneous

N.N. Pisaruk [email protected] MIPCL

Page 99: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Appendix Miscellaneous

Outline

3 AppendixMiscellaneous

N.N. Pisaruk [email protected] MIPCL

Page 100: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Appendix Miscellaneous

Mixed Integer Programming

Mixed Integer Program (MIP):

cTx→ max

b1 ≤ Ax ≤ b2,

d1 ≤ x ≤ d2,

xj ∈ Z, for j ∈ S,

where

b1, b2 ∈ Rm,

c, d1, d2 ∈ Rn,

A — real m× n-matrix,

x — n-vector of variables (unknowns),

S ⊆ {1, . . . , n}— set of integer variables.Return to "What Is MIPCL?"

N.N. Pisaruk [email protected] MIPCL

Page 101: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Appendix Miscellaneous

Using CFCNF: function readNet()

#include <fstream>#include "fcnf.h"void readNet(const char *fileName,

int &n,int &m,int* &d,int* &t,int* &h,int* &u,int* &f,int* &c)

{std::ifstream fin(fileName);fin >> n >> m;d = new int[n+5*m];c=(f=(u=(h=(t=d+n)+m)+m)+m)+m;for (int i=0; i < n; ++i)

fin >> d[i];for (int e=0; e < m; ++e)

fin >> t[e] >> h[e] >> u[e] >> f[e] >>c[e];

fin.close();

}Return to main()

N.N. Pisaruk [email protected] MIPCL

Page 102: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Appendix Miscellaneous

Using CFCNF: function readNet()

#include <fstream>#include "fcnf.h"void readNet(const char *fileName,

int &n,int &m,int* &d,int* &t,int* &h,int* &u,int* &f,int* &c)

{std::ifstream fin(fileName);fin >> n >> m;d = new int[n+5*m];c=(f=(u=(h=(t=d+n)+m)+m)+m)+m;for (int i=0; i < n; ++i)

fin >> d[i];for (int e=0; e < m; ++e)

fin >> t[e] >> h[e] >> u[e] >> f[e] >>c[e];

fin.close();

}Return to main()

N.N. Pisaruk [email protected] MIPCL

Page 103: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Appendix Miscellaneous

Using CFCNF: function readNet()

#include <fstream>#include "fcnf.h"void readNet(const char *fileName,

int &n,int &m,int* &d,int* &t,int* &h,int* &u,int* &f,int* &c)

{std::ifstream fin(fileName);fin >> n >> m;d = new int[n+5*m];c=(f=(u=(h=(t=d+n)+m)+m)+m)+m;for (int i=0; i < n; ++i)

fin >> d[i];for (int e=0; e < m; ++e)

fin >> t[e] >> h[e] >> u[e] >> f[e] >>c[e];

fin.close();

}Return to main()

N.N. Pisaruk [email protected] MIPCL

Page 104: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Appendix Miscellaneous

Using CFCNF: function readNet()

#include <fstream>#include "fcnf.h"void readNet(const char *fileName,

int &n,int &m,int* &d,int* &t,int* &h,int* &u,int* &f,int* &c)

{std::ifstream fin(fileName);fin >> n >> m;d = new int[n+5*m];c=(f=(u=(h=(t=d+n)+m)+m)+m)+m;for (int i=0; i < n; ++i)

fin >> d[i];for (int e=0; e < m; ++e)

fin >> t[e] >> h[e] >> u[e] >> f[e] >>c[e];

fin.close();

}Return to main()

N.N. Pisaruk [email protected] MIPCL

Page 105: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Appendix Miscellaneous

Using CFCNF: function readNet()

#include <fstream>#include "fcnf.h"void readNet(const char *fileName,

int &n,int &m,int* &d,int* &t,int* &h,int* &u,int* &f,int* &c)

{std::ifstream fin(fileName);fin >> n >> m;d = new int[n+5*m];c=(f=(u=(h=(t=d+n)+m)+m)+m)+m;for (int i=0; i < n; ++i)

fin >> d[i];for (int e=0; e < m; ++e)

fin >> t[e] >> h[e] >> u[e] >> f[e] >>c[e];

fin.close();

}Return to main()

N.N. Pisaruk [email protected] MIPCL

Page 106: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Appendix Miscellaneous

Using CFCNF: function readNet()

#include <fstream>#include "fcnf.h"void readNet(const char *fileName,

int &n,int &m,int* &d,int* &t,int* &h,int* &u,int* &f,int* &c)

{std::ifstream fin(fileName);fin >> n >> m;d = new int[n+5*m];c=(f=(u=(h=(t=d+n)+m)+m)+m)+m;for (int i=0; i < n; ++i)

fin >> d[i];for (int e=0; e < m; ++e)

fin >> t[e] >> h[e] >> u[e] >> f[e] >>c[e];

fin.close();

}Return to main()

N.N. Pisaruk [email protected] MIPCL

Page 107: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Appendix Miscellaneous

Using CFCNF: function readNet()

#include <fstream>#include "fcnf.h"void readNet(const char *fileName,

int &n,int &m,int* &d,int* &t,int* &h,int* &u,int* &f,int* &c)

{std::ifstream fin(fileName);fin >> n >> m;d = new int[n+5*m];c=(f=(u=(h=(t=d+n)+m)+m)+m)+m;for (int i=0; i < n; ++i)

fin >> d[i];for (int e=0; e < m; ++e)

fin >> t[e] >> h[e] >> u[e] >> f[e] >>c[e];

fin.close();

}Return to main()

N.N. Pisaruk [email protected] MIPCL

Page 108: Mixed Integer Programming Class Library - … Started Mixed Integer Programming Class Library Introduction N.N. Pisaruk nicolaipisaruk@gmail.com Belarus State University Faculty of

Appendix Miscellaneous

Using CFCNF: function readNet()

#include <fstream>#include "fcnf.h"void readNet(const char *fileName,

int &n,int &m,int* &d,int* &t,int* &h,int* &u,int* &f,int* &c)

{std::ifstream fin(fileName);fin >> n >> m;d = new int[n+5*m];c=(f=(u=(h=(t=d+n)+m)+m)+m)+m;for (int i=0; i < n; ++i)

fin >> d[i];for (int e=0; e < m; ++e)

fin >> t[e] >> h[e] >> u[e] >> f[e] >>c[e];

fin.close();

}Return to main()

N.N. Pisaruk [email protected] MIPCL