Home Online Manual
Top
Back: lex_solve
Forward: triangLf_solve
FastBack:
FastForward:
Up: solve_lib
Top: Singular Manual
Contents: Table of Contents
Index: Index
About: About this document

D.8.4.8 simplexOut

Procedure from library solve.lib (see solve_lib).

Usage:
simplexOut(l); l list

Assume:
l is the output of simplex.

Return:
Nothing. The procedure prints the computed solution of simplex (as strings) in a nice format.

Example:
 
LIB "solve.lib";
ring r = (real,10),(x),lp;
// consider the max. problem:
//
//    maximize  x(1) + x(2) + 3*x(3) - 0.5*x(4)
//
//  with constraints:   x(1) +          2*x(3)          <= 740
//                             2*x(2)          - 7*x(4) <=   0
//                               x(2) -   x(3) + 2*x(4) >=   0.5
//                      x(1) +   x(2) +   x(3) +   x(4)  =   9
//
matrix sm[5][5]=   0, 1, 1, 3,-0.5,
740,-1, 0,-2, 0,
0, 0,-2, 0, 7,
0.5, 0,-1, 1,-2,
9,-1,-1,-1,-1;
int n = 4;  // number of constraints
int m = 4;  // number of variables
int m1= 2;  // number of <= constraints
int m2= 1;  // number of >= constraints
int m3= 1;  // number of == constraints
list sol=simplex(sm, n, m, m1, m2, m3);
simplexOut(sol);
==> z = 17.025
==> x2 = 3.325
==> x4 = 0.95
==> x3 = 4.725
See also: simplex.