Optimization: principles and algorithms, by Michel Bierlaire
runAssignmentTrans.m
Go to the documentation of this file.
1 %> \file
2 %> Solve the transportation problem as a transhipment problem (Example 22.14 of \cite Bier15-book)
3 %>
4 %> @note Calls \ref transhipment
5 %>
6 %> @ingroup Running
7 %> @ingroup chap22
8 %> @author Michel Bierlaire
9 %> @date Sat Apr 11 11:33:42 2015
10 
11 adj = [ 0 0 0 0 1 2 0 0 ;
12  0 0 0 0 3 4 5 0 ;
13  0 0 0 0 6 0 7 8 ;
14  0 0 0 0 0 9 10 0 ;
15  0 0 0 0 0 0 0 0 ;
16  0 0 0 0 0 0 0 0 ;
17  0 0 0 0 0 0 0 0 ;
18  0 0 0 0 0 0 0 0 ];
19 
20 
21 
22 cost = [ 8000 ; 11000 ; 9000 ; 13000 ; 12000 ; 9000 ; 11000 ; 0.01 ; 14000 ; 12000 ];
23 lb = [ 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ] ;
24 ub = [ 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ; 1 ] ;
25 
26 supply = [ 1 ; 1 ; 1 ; 1 ; -1 ; -1 ; -1 ; -1 ] ;
27 
28 useGlpk = 0 ;
29 [x, copt] = transhipment(adj,cost,lb,ub,supply,useGlpk)
30 
31 useGlpk = 1 ;
32 [x, copt] = transhipment(adj,cost,lb,ub,supply,useGlpk)
33 
function transhipment(in adj, in cost, in lb, in ub, in supply, in useGlpk)
Solve the transhipment problem with bound constraints.
Copyright 2015-2016 Michel Bierlaire