solver.c File Reference


Defines

#define echo(S)   { printf(#S); printf("\n"); }
#define AGET(A, i, j)   (&(A->lines[i]->vector[j]))
#define RABS(X)   (Z_ABS_(((float)(((float)(X->num))/((float)(X->denum))))))

Functions

static void fm_solver_compute_val (s_fm_rational_t **lb, s_fm_list_t *l, s_fm_vector_t *vect, unsigned idx, unsigned is_int, unsigned is_min_computation)
static void fm_solver_add_unique (s_fm_vector_t ***lines, unsigned *count, unsigned *sup, s_fm_vector_t *v)
static s_fm_system_tfm_solver_create_next_system (s_fm_system_t *system, unsigned idx, unsigned n1, unsigned n2, int solver_type, unsigned *nn1, unsigned *nn2, unsigned *nn3)
static s_fm_solution_tfm_solver_algo (s_fm_system_t *system, int solver_type, int last, int to)
s_fm_solution_tfm_solver (s_fm_system_t *system, int solver_type)
 Fourier-Motzkin projection algorithm, to solve rational and integral systems of (in-)equalities.
s_fm_solution_tfm_solver_solution_at (s_fm_system_t *system, int solver_type, unsigned last)
 Fourier-Motzkin projection algorithm, to solve rational and integral systems of (in-)equalities.
s_fm_solution_tfm_solver_solution_to (s_fm_system_t *system, int solver_type, unsigned to)
 Fourier-Motzkin projection algorithm. Projection done up to the 'to' dimension.
void fm_solver_compute_min (s_fm_rational_t **lb, s_fm_list_t *l, s_fm_vector_t *vect, unsigned idx, int is_int)
void fm_solver_compute_max (s_fm_rational_t **Ub, s_fm_list_t *l, s_fm_vector_t *vect, unsigned idx, int is_int)
s_fm_rational_t ** fm_solver_minlexico (s_fm_solution_t *sol, z_type_t min, int is_integral)
 Compute lexio-smallest solution. If lower bound is -infinite, use argument 'min' instead. is_integral is a bit to force computation of integral lexico-smallest vector.
s_fm_rational_t ** fm_solver_maxlexico (s_fm_solution_t *sol, z_type_t max, int is_integral)
 Compute lexio-largest solution. If upper bound is infinite, use argument 'max' instead. is_integral is a bit to force computation of integral lexico-largest vector.
s_fm_solution_tfm_solver_linind (s_fm_system_t *A)
int fm_solver_gauss (s_fm_system_t *A)

Define Documentation

#define echo (  )     { printf(#S); printf("\n"); }

#define AGET ( A,
i,
 )     (&(A->lines[i]->vector[j]))

#define RABS (  )     (Z_ABS_(((float)(((float)(X->num))/((float)(X->denum))))))


Function Documentation

static void fm_solver_compute_val ( s_fm_rational_t **  lb,
s_fm_list_t l,
s_fm_vector_t vect,
unsigned  idx,
unsigned  is_int,
unsigned  is_min_computation 
) [static]

Internal fonction. Helper for bounds computation.

static void fm_solver_add_unique ( s_fm_vector_t ***  lines,
unsigned *  count,
unsigned *  sup,
s_fm_vector_t v 
) [static]

static s_fm_system_t* fm_solver_create_next_system ( s_fm_system_t system,
unsigned  idx,
unsigned  n1,
unsigned  n2,
int  solver_type,
unsigned *  nn1,
unsigned *  nn2,
unsigned *  nn3 
) [static]

Internal fonction. Helper to create the next system to operate on, in Fourier-Motzkin elimination algorithm.

static s_fm_solution_t* fm_solver_algo ( s_fm_system_t system,
int  solver_type,
int  last,
int  to 
) [static]

Fourier-Motzkin projection algorithm.

set last and to to -1 if not used.

s_fm_solution_t* fm_solver ( s_fm_system_t system,
int  solver_type 
)

Fourier-Motzkin projection algorithm, to solve rational and integral systems of (in-)equalities.

Fourier-Motzkin projection algorithm.

Possible options for solver_type:

input s_fm_system_t* : A system to solve. input int : The option to provide.

output s_fm_solution_t* : The solution of the system, if it exists (NULL otherwise).

See also:
fm/system.h fm/solution.h

s_fm_solution_t* fm_solver_solution_at ( s_fm_system_t system,
int  solver_type,
unsigned  last 
)

Fourier-Motzkin projection algorithm, to solve rational and integral systems of (in-)equalities.

Fourier-Motzkin projection algorithm.

Possible options for solver_type:

input s_fm_system_t* : A system to solve. input int : The option to provide.

input unsigned : The last variable index to store in the solution (full projection is performed, but we only store inequalities involving variable 1 to 'last' in the solution.

output s_fm_solution_t* : The solution of the system, if it exists (NULL otherwise).

See also:
fm/system.h fm/solution.h

s_fm_solution_t* fm_solver_solution_to ( s_fm_system_t system,
int  solver_type,
unsigned  to 
)

Fourier-Motzkin projection algorithm. Projection done up to the 'to' dimension.

Fourier-Motzkin projection algorithm.

Possible options for solver_type:

input s_fm_system_t* : A system to solve. input int : The option to provide.

input unsigned : The variable index at which to stop the projection (the projection is performed from the last variable of the system to the 'to' variable)

output s_fm_solution_t* : The solution of the system, if it exists (NULL otherwise).

See also:
fm/system.h fm/solution.h

void fm_solver_compute_min ( s_fm_rational_t **  lb,
s_fm_list_t l,
s_fm_vector_t vect,
unsigned  idx,
int  is_int 
)

Return the lower bound for a given variable at index idx, NULL if there is no bounds.

void fm_solver_compute_max ( s_fm_rational_t **  Ub,
s_fm_list_t l,
s_fm_vector_t vect,
unsigned  idx,
int  is_int 
)

Return the Upper bound for a given variable at index idx, NULL if there is no bounds.

s_fm_rational_t** fm_solver_minlexico ( s_fm_solution_t sol,
z_type_t  min,
int  is_integral 
)

Compute lexio-smallest solution. If lower bound is -infinite, use argument 'min' instead. is_integral is a bit to force computation of integral lexico-smallest vector.

Lexicographically smallest computation.

input s_fm_solution_t* : input solution for the system. input z_type_t : minimum value to use for -infinite bounds. input int : set to 0 for rational values, to 1 for integral values.

output s_fm_rational_t** : A NULL-terminated array of rationals*, where denominators are be '1' if is_integral is set.

s_fm_rational_t** fm_solver_maxlexico ( s_fm_solution_t sol,
z_type_t  max,
int  is_integral 
)

Compute lexio-largest solution. If upper bound is infinite, use argument 'max' instead. is_integral is a bit to force computation of integral lexico-largest vector.

Lexicographically largest computation.

input s_fm_solution_t* : input solution for the system. input z_type_t : maximum value to use for infinite bounds. input int : set to 0 for rational values, to 1 for integral values.

output s_fm_rational_t** : A NULL-terminated array of rationals*, where denominators are be '1' if is_integral is set.

s_fm_solution_t* fm_solver_linind ( s_fm_system_t A  ) 

Input: A system of linear equation Output: A list of replacement vectors (on the `positive' attribute), or NULL if there is a contradiction in the input system format: x = 2 -> [ 0 1 2 ] in pip so output is [ 0 2 ] 0x + 0y -2z + t = 1-> [ 0 0 0 -2 -1 ] (value for the current variable to replace is always 1).

int fm_solver_gauss ( s_fm_system_t A  ) 


Generated on Fri Oct 31 00:49:13 2008 for FM by  doxygen 1.5.3