Skip to content

Generate linear programming (LP) files for XYZ network flow optimisation using IBM CPLEX. Project for the University of Canterbury 'Internet Technologies & Engineering' COSC364 course.

Notifications You must be signed in to change notification settings

University-Project-Repos/NetworkFlow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

COSC364 Network Flow Assignment

Generates LP files for printing CPLEX linear optimized XYZ network flow solutions, where X and Z are source and destination nodes, respectively, and Y are transit nodes, with constraints X >= Z > 0, Y > 2.

Authors

Instructions

Requirements

  • CPLEX to formulate optimal network flow solutions using generated LP files.

Run

To optimise multiple XYZ LP files, where X = Z = 7, Y = {3,...,7}:

python3 test.py

Alternatively, to optimise a single LP file:

python3 flow.py <X (int)> <Y (int)> <Z (int)>

Example

CPLEX output for X = Y = Z = 7

Problem 'Y=7.lp' read.
Read time = 0.00 sec. (0.07 ticks)
Tried aggregator 2 times.
MIP Presolve eliminated 105 rows and 56 columns.
MIP Presolve modified 47 coefficients.
Aggregator did 392 substitutions.
Reduced MIP has 56 rows, 344 columns, and 693 nonzeros.
Reduced MIP has 343 binaries, 0 generals, 0 SOSs, and 0 indicators.
Presolve time = 0.00 sec. (1.24 ticks)
Found incumbent of value 130.666667 after 0.00 sec. (1.45 ticks)
Probing time = 0.00 sec. (0.20 ticks)
Cover probing fixed 0 vars, tightened 6 bounds.
Tried aggregator 1 time.
Reduced MIP has 56 rows, 344 columns, and 693 nonzeros.
Reduced MIP has 343 binaries, 0 generals, 0 SOSs, and 0 indicators.
Presolve time = 0.00 sec. (0.56 ticks)
Probing time = 0.00 sec. (0.05 ticks)
MIP emphasis: balance optimality and feasibility.
MIP search method: dynamic search.
Parallel mode: deterministic, using up to 8 threads.
Root relaxation solution time = 0.00 sec. (0.58 ticks)

        Nodes                                         Cuts/
   Node  Left     Objective  IInf  Best Integer    Best Bound    ItCnt     Gap

*     0+    0                          130.6667        4.6667            96.43%
      0     0       56.0000    10      130.6667       56.0000       92   57.14%
*     0+    0                           58.0000       56.0000             3.45%
      0     0       56.0000    14       58.0000      Cuts: 14      101    3.45%
*     0+    0                           57.6667       56.0000             2.89%
      0     0       56.0000    15       57.6667       Cuts: 7      112    2.89%
*     0+    0                           57.3333       56.0000             2.33%
*     0+    0                           57.0000       56.0000             1.75%
*     0+    0                           56.3333       56.0000             0.59%
*     0+    0                           56.0000       56.0000             0.00%
      0     0        cutoff             56.0000       56.0000      112    0.00%
Elapsed time = 0.07 sec. (21.25 ticks, tree = 0.01 MB, solutions = 7)

Root node processing (before b&c):
  Real time             =    0.07 sec. (21.32 ticks)
Parallel b&c, 8 threads:
  Real time             =    0.00 sec. (0.00 ticks)
  Sync time (average)   =    0.00 sec.
  Wait time (average)   =    0.00 sec.
                          ------------
Total (root+branch&cut) =    0.07 sec. (21.32 ticks)

Solution pool: 7 solutions saved.

MIP - Integer optimal solution:  Objective =  5.6000000000e+01
Solution time =    0.07 sec.  Iterations = 112  Nodes = 0
Deterministic time = 21.32 ticks  (306.31 ticks/sec)


Incumbent solution
Variable Name           Solution Value
r                            56.000000
xI1K1J1                       0.666667

...

lK7                          56.000000
All other variables in the range 1-792 are 0.