LibRCG  3.0
rlp.h File Reference

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.

Detailed Description

Implementation of linear programming functions.

Author:
Rui Carlos Gonçalves
Version:
3.0
Date:
07/2012

Definition in file rlp.h.


Function Documentation

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:

  • at a[0][i-1] (for i in [1, n]) the coefficient of variable xi in the expression to minimize;
  • at a[0][i] (for i in [n, n+m+1]) the value 0;
  • at a[i][j-1] (for i in [1, m], and for j in [1, n]) the coefficient of variable xj in condition ci;
  • at a[i][j] (for i in [1, m], and for j in [n, n+m-1]) the identity matrix;
  • at a[i][n+m] (for i in [1, m]) the value of bi;
  • at 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).

Parameters:
amatrix that represents the problem
nnumber of variable of the function
mnumber restrictions
filefile where the tables will be saved (or NULL)
Returns:
0 if it is possible to solve the problem
1 otherwise

Definition at line 118 of file rlp.c.

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).

Parameters:
amatrix that represents the problem
nnumber of variables of the function
mnumber restrictions
posposition of the minimum value of the first row (it must be a negative value)
filefile where the tables will be saved (or NULL)
Returns:
0 if it is possible to solve the problem
1 otherwise

Definition at line 198 of file rlp.c.

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).

Parameters:
amatrix that represents the problem
nnumber of variables of the function
mnumber restrictions
posposition of the minimum value of the restrictions' column (it must be a negative value)
filefile where the tables will be saved (or NULL)
Returns:
0 if it is possible to solve the problem
1 otherwise

Definition at line 137 of file rlp.c.


LibRCG © 2004-2012   Rui Carlos Gonçalves