FM 0.5.0
========

. Configuration and compilation

$> ./configure
$> make
$> make check
$> make install

Optionally, you can specify the path of a PIPLib installation to the
configure script with @code{--with-piplib} to turn on specific
functionalities requiring PIP (it is needed for use in conjonction
with LeTSeE).

. Usage
.. Input file design

System must be supplied in a PolyLib-like formatted file. As an
example:

# ----------------------------- Sample ---------------------------------
# Commented lines should start with '#'. Blank lines are ignored.

# Supply here the number of lines and columns
4 4

# Then the matrix should have exactly the same number of lines and
# columns as indicated below. A number can be a rational, with the
# syntax SX/Y (no spaces, S = sign (- or + or nothing), X and Y =
# integer), or an integer. Numbers must be separated with at least one
# space (' ').
#
# Remember in PolyLib format, first number is '0' if the line is equal
# to 0, and is a '1' if the line is greater or equal to 0.

#   x1   x2    1
1   -2   11    3
1    3   -2   -5
1 -1/1   -3  8/2
1    2    0   -3


# -----------------------------------------------------------------------

.. Output file design

The results are presented as 'balls', the common representation of
Fourier-Motzkin projection algorithm. At index 0, you have the
positive (x0 >= ...) and negative conditions (x0 <= ...) for the first
variable of the system.


.. Running the binaries

Then the binary fm-solver (in src/) can be called:

$> src/fm-solver doc/sample.in
At index 0
- Positives:
[1 1 -49/29]
- Negatives:
[1 -1 53/17]
At index 1
- Positives:
[1 -2/11 1 3/11]
- Negatives:
[1 3/2 -1 -5/2]
[1 -1/3 -1 4/3]


it is read:
x0 >= 49/29
x0 <= 53/17 (or -x0 + 53/17 >= 0)
-2/11.x0 + x1 >= -3/11
1/3.x0 + x1 <= 4/3

Optinally, a second argument can be given, and the result will be
stored in this filename:

$> src/fm-solver doc/sample.in sample.out

If the system has no solution, (Empty solution) is outputted.


One can desire to compute the lexico-smallest set of values for a
system. This function is provided with the binary fm-minlexico. Three
arguments are to be given: the filename storing the system to solve, a
bit (0 or 1) to set if you want rational or integral values, and the
value to be used to replace -infinite where the lower bound is
-infinite:

$> src/fm-solver doc/sample.in 0 -42
[49/29 1/29]

If no rational or integral solution exists, [(null)] is outputted.

$> src/fm-solver doc/sample.in 1 -42
[(null)]


.. Programming with FM

The library provides a set of includes, installed in
$prefix/includes/fm.

In order to use the solver, one is encouraged to do the following:

#include <fm/system.h>
#include <fm/solution.h>
#include <fm/solver.h>

// Declare the input system.
s_fm_system_t* system;
// Allocate and fill the system, or read it from a stream
system = fm_system_read (stream);
// Declare the output solution.
s_fm_solution_t* solution;
// Solve the given system. Use FM_SOLVER_AUTO_SIMPLIFY to help the solver
// to scale automatically
solution = fm_solver (system, FM_SOLVER_FAST);
// Print the output solution.
fm_solution_print (stream);
// Be clean.
fm_system_free (system);
fm_solution_free (solution);



In order to get the lexico-smallest set of values, one is encouraged
to do the following:

#include <fm/system.h>
#include <fm/solution.h>
#include <fm/solver.h>

s_fm_solution_t* solution;
solution = fm_solver (system, FM_SOLVER_FAST);
// lexico_smallest will be a NULL-terminated array.
s_fm_rational_t** lexico_smallest;
lexico_smallest = fm_solver_minlexico (solution, FM_MINLEXICO_INT);


The FM library uses `long int' as default type for integers. If one needs 
to modify this type, alter fm/include/common.h file (change the typedef 
for z_type_t, and update the STRING_MODIFIER accordingly).



. Contact

  * Louis-Noel Pouchet <louis-noel.pouchet@inria.fr>
