Skip to content

Instantly share code, notes, and snippets.

@jbochi
Last active December 28, 2015 04:18
Show Gist options
  • Save jbochi/7440880 to your computer and use it in GitHub Desktop.
Save jbochi/7440880 to your computer and use it in GitHub Desktop.
Problema de transporte - Otimizacao Combinatoria - http://www-di.inf.puc-rio.br/~poggi/oc112-lf1.pdf
c = [5, 10, 7, 8, 9, 6]';
A = [1, 1, 1, 0, 0, 0; 0, 0, 0, 1, 1, 1; 1, 0, 0, 1, 0, 0; 0, 1, 0, 0, 1, 0; 0, 0, 1, 0, 0, 1];
b = [15, 25, 15, 15, 10]';
lb = [0, 0, 0, 0, 0, 0];
ub = [];
vartype = "CCCCCC";
ctype = "SSSSS";
sense = 1;
[xmin, fmin, status, extra] = glpk (c, A, b, lb, ub, ctype, vartype, sense, param);
octave-3.4.0:58> xmin
xmin =
15
0
0
0
15
10
c = [5, 10, 7, 8, 9, 6, 3, 13, 2]';
A = [1, 1, 1, 0, 0, 0, 0, 0, 0;
0, 0, 0, 1, 1, 1, 0, 0, 0;
0, 0, 0, 0, 0, 0, 1, 1, 1;
1, 0, 0, 1, 0, 0, 1, 0, 0;
0, 1, 0, 0, 1, 0, 0, 1, 0;
0, 0, 1, 0, 0, 1, 0, 0, 1];
b = [1, 1, 1, 1, 1, 1]';
lb = [0, 0, 0, 0, 0, 0, 0, 0, 0];
ub = [];
vartype = "CCCCCCCCC";
ctype = "SSSSSS";
sense = 1;
[xmin, fmin, status, extra] = glpk (c, A, b, lb, ub, ctype, vartype, sense, param);
octave-3.4.0:116> xmin
xmin =
1
0
0
0
1
0
0
0
1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment