Definition of functions used by main.
More...
Go to the source code of this file.
|
#define | POS(R, C, NC) ((R)*(NC)+(C)) |
| Given a row (R ), a column (C ), and the number of columns (NC ) of a matrix, computes an equivalent 1D position. More...
|
|
|
double * | loadMatrix (Prob prob, int varc, int condc, int eqc, int type) |
| From the info collected by the parser, creates a matrix representing the problem to solve, according to the format required by function simplex . More...
|
|
void | printRes (Array vars, double *tab, const char *varob, int varc, int condc, int type) |
| Prints the result. More...
|
|
int | opt (int argc, char **argv, char **in, char **out) |
| Checks the options specified by the user. More...
|
|
Definition of functions used by main.
- Author
- Rui Carlos Gonçalves
- Version
- 1.5
- Date
- 08/2015
Definition in file main.c.
#define POS |
( |
|
R, |
|
|
|
C, |
|
|
|
NC |
|
) |
| ((R)*(NC)+(C)) |
Given a row (R
), a column (C
), and the number of columns (NC
) of a matrix, computes an equivalent 1D position.
Definition at line 18 of file main.c.
double* loadMatrix |
( |
Prob |
prob, |
|
|
int |
varc, |
|
|
int |
condc, |
|
|
int |
eqc, |
|
|
int |
type |
|
) |
| |
From the info collected by the parser, creates a matrix representing the problem to solve, according to the format required by function simplex
.
- Parameters
-
prob | info about the problem. |
varc | number of variables. |
condc | number of conditions. |
eqc | number of conditions with an equality operator. |
type | determines whether we have a maximization or minimization problem (max.: -1, min.: 1). |
- Returns
- the matrix created.
Definition at line 30 of file main.c.
int opt |
( |
int |
argc, |
|
|
char ** |
argv, |
|
|
char ** |
in, |
|
|
char ** |
out |
|
) |
| |
Checks the options specified by the user.
- Parameters
-
argc | number of options. |
argv | value of the options. |
in | address for the input option. |
out | address for the output option. |
- Returns
- 1 if the
tables
option was set; 0 otherwise.
Definition at line 155 of file main.c.
void printRes |
( |
Array |
vars, |
|
|
double * |
tab, |
|
|
const char * |
varob, |
|
|
int |
varc, |
|
|
int |
condc, |
|
|
int |
type |
|
) |
| |
Prints the result.
- Parameters
-
vars | name of the variables of each position of the table. |
tab | table resulting from applying the Simplex algorithm. |
varob | variable to maximize/minimize. |
varc | number of variables. |
condc | number of conditions |
type | determines whether we have a maximization or minimization problem (max.: -1, min.: 1). |
Definition at line 103 of file main.c.
Initial value:={"ERROR! Function \'loadMatrix\' -> \'calloc\'.\n"
,"ERROR! Function \'printRes\' -> \'newArray\'.\n"
,"ERROR! Function \'printRes\' -> \'malloc\'.\n"
,"ERROR! Function \'printRes\' -> \'arrayInsert\'.\n"
,"ERROR! Invalid parameters.\n"
}
Error messages.
Definition at line 21 of file main.c.