|
LibRCG
3.0
|
Implementation of linear programming functions. More...
Go to the source code of this file.
Functions | |
| int | simplex (double *a, int n, int m, FILE *file) |
| Applies the Simplex Algorithm to an optimization problem. | |
| int | simplexp (double *a, int n, int m, int pos, FILE *file) |
| Applies the Simplex algorithm to a primal optimization problem. | |
| int | simplexd (double *a, int n, int m, int pos, FILE *file) |
| Applies the Simplex algorithm to a dual optimization problem. | |
| int simplex | ( | double * | a, |
| int | n, | ||
| int | m, | ||
| FILE * | file | ||
| ) |
Applies the Simplex Algorithm to an optimization problem.
Given a problem with n variables (x1, ..., xn) and m conditions (c1 = b1, ..., cm = bm), the function must receive a matrix a of size (m+1)*(n+m+2), containing:
a[0][i-1] (for i in [1, n]) the coefficient of variable xi in the expression to minimize; a[0][i] (for i in [n, n+m+1]) the value 0; a[i][j-1] (for i in [1, m], and for j in [1, n]) the coefficient of variable xj in condition ci; a[i][j] (for i in [1, m], and for j in [n, n+m-1]) the identity matrix; a[i][n+m] (for i in [1, m]) the value of bi; a[i][n+m+1] (for i in [1, m]) the value of n+i. Allows to specify the file where the table resulting from the application of the algorithm (using the parameter file).
| a | matrix that represents the problem |
| n | number of variable of the function |
| m | number restrictions |
| file | file where the tables will be saved (or NULL) |
| int simplexd | ( | double * | a, |
| int | n, | ||
| int | m, | ||
| int | pos, | ||
| FILE * | file | ||
| ) |
Applies the Simplex algorithm to a dual optimization problem.
The input matrix (a) must follow the format defined in function <ref>simplex</ref>.
Allows to specify the file where the table resulting from the application of the algorithm (using the parameter file).
| a | matrix that represents the problem |
| n | number of variables of the function |
| m | number restrictions |
| pos | position of the minimum value of the first row (it must be a negative value) |
| file | file where the tables will be saved (or NULL) |
| int simplexp | ( | double * | a, |
| int | n, | ||
| int | m, | ||
| int | pos, | ||
| FILE * | file | ||
| ) |
Applies the Simplex algorithm to a primal optimization problem.
The input matrix (a) must follow the format defined in function <ref>simplex</ref>.
Allows to specify the file where the table resulting from the application of the algorithm (using the parameter file).
| a | matrix that represents the problem |
| n | number of variables of the function |
| m | number restrictions |
| pos | position of the minimum value of the restrictions' column (it must be a negative value) |
| file | file where the tables will be saved (or NULL) |