RLP  1.5
read.c File Reference

Definitions of data types and functions required to read and store the data about the problem. More...

Go to the source code of this file.

Macros

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

Functions

Exp newExp (int size)
 Creates an expression. More...
 
Prob newProb ()
 Creates a problem. More...
 
int varhash (const char *varid)
 Hash function for variables names. More...
 
int addCoefHead (Prob prob, const char *varid, int varc, double coef)
 Adds a new condition to the problem, and adds the coefficients of a variable. More...
 
int addCoefTail (Prob prob, const char *varid, int varc, double coef)
 Adds the coefficient of a variable. More...
 
int setOpRHS (Prob prob, int op, double rhs)
 Adds the relational operator and the right-hand side to a condition. More...
 

Variables

static char * errors []
 Error messages. More...
 

Detailed Description

Definitions of data types and functions required to read and store the data about the problem.

Author
Rui Carlos Gonçalves
Version
1.5
Date
08/2015

Definition in file read.c.

Macro Definition Documentation

#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 19 of file read.c.

Function Documentation

int addCoefHead ( Prob  prob,
const char *  varid,
int  varc,
double  coef 
)

Adds a new condition to the problem, and adds the coefficients of a variable.

If the variable did not exist in the variables set, it is added.

Parameters
probthe problem.
varidthe variable identifier.
varcthe index of the variable if it does not exist.
coefthe coefficient of the variable.
Returns
0 if the variable already existed; 0 otherwise.

Definition at line 83 of file read.c.

int addCoefTail ( Prob  prob,
const char *  varid,
int  varc,
double  coef 
)

Adds the coefficient of a variable.

If the variable did not exist in the variables set, it is added.

Parameters
probthe problem.
varidthe variable identifier.
varcthe index of the variable if it does not exist.
coefthe coefficient of the variable.
Returns
0 if the variable already existed; 0 otherwise.

Definition at line 147 of file read.c.

Exp newExp ( int  arraysize)

Creates an expression.

Parameters
arraysizesize of the coefficients array.
Returns
NULL if an error occurred; the new expression otherwise.

Definition at line 35 of file read.c.

Prob newProb ( )

Creates a problem.

Returns
NULL if an error occurred; the new problem otherwise.

Definition at line 53 of file read.c.

int setOpRHS ( Prob  prob,
int  op,
double  rhs 
)

Adds the relational operator and the right-hand side to a condition.

Parameters
probthe problem.
opthe identifier of the relational operator.
rhsthe right-hand side of the condition.
Returns
0.

Definition at line 201 of file read.c.

int varhash ( const char *  varid)

Hash function for variables names.

Parameters
varidthe variable identifier.
Returns
the hash code of the variable.

Definition at line 71 of file read.c.

Variable Documentation

char* errors[]
static
Initial value:
={"ERROR! Function \'setCoefHead\' -> \'malloc\'.\n"
,"ERROR! Function \'setCoefHead\' -> \'listInsertLst\'.\n"
,"ERROR! Function \'setCoefHead\' -> \'arrayInsert\'.\n"
,"ERROR! Function \'setCoefHead\' -> \'newExp\'.\n"
,"ERROR! Function \'setCoefHead\' -> \'hashInsert\'.\n"
,"ERROR! Function \'setCoefTail\' -> \'malloc\'.\n"
,"ERROR! Function \'setCoefTail\' -> \'hashInsert\' or"
"\'arrayInsert\'.\n"
,"ERROR! Function \'setCoefTail\' -> \'arrayInsert\'.\n"
}

Error messages.

Definition at line 22 of file read.c.

RLP © 2006, 2009, 2015   Rui Carlos Gonçalves