TaPAS  0.2
genepi.h
Go to the documentation of this file.
1 /*
2  * genepi.h -- The GENEPI main header file
3  *
4  * This file is a part of the GENEric Presburger programming Interface.
5  *
6  * Copyright (C) 2010 CNRS UMR 5800 & Universit√© Bordeaux I (see AUTHORS file).
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21  * 02110-1301 USA
22  */
23 
163 #ifndef __GENEPI_H__
164 # define __GENEPI_H__
165 
166 # include <genepi/genepi-common.h>
168 # include <genepi/genepi-loader.h>
169 
170 BEGIN_C_DECLS
171 
180 typedef struct genepi_solver_st genepi_solver;
181 
190 typedef struct genepi_set_st genepi_set;
191 
207 # define GENEPI_FLAG_SHOW_TIMERS (0x01<<0)
208 
218 # define GENEPI_FLAG_SHOW_CACHE_INFO (0x01<<1)
219 
230 typedef enum {
231  GENEPI_EQ,
232  GENEPI_LT,
233  GENEPI_GT,
234  GENEPI_LEQ,
235  GENEPI_GEQ
237 
248 typedef enum {
249  GENEPI_N_SOLVER = 0,
250  GENEPI_Z_SOLVER,
251  GENEPI_P_SOLVER,
252  GENEPI_R_SOLVER
254 
263 typedef enum {
264  GENEPI_INFO_COPYRIGHT = 0,
265  GENEPI_INFO_AUTHORS,
266  GENEPI_INFO_LICENSE,
267  GENEPI_INFO_BRIEF_DESCRIPTION,
268  GENEPI_INFO_FULL_DESCRIPTION
269 } genepi_info;
270 
275 typedef enum {
280 
286 
292 
299 
326 extern genepi_solver *
327 genepi_solver_create (genepi_plugin *plugin, int flags, int cachesize,
328  int number_of_cache_entries);
329 
344 extern void
346 
361 extern genepi_solver_type
363 
367 extern const genepi_plugconf *
368 genepi_solver_get_plugin_config (genepi_solver *solver);
369 
381 extern const char *
383 
397 extern void
398 genepi_solver_set_trace_file (genepi_solver *solver, FILE *output);
399 
414 extern FILE *
416 
430 extern int
432 
445 extern genepi_set *
447 
461 extern void
463 
478 extern genepi_set *
479 genepi_set_top (genepi_solver *solver, int n);
480 
496 extern genepi_set *
497 genepi_set_top_N (genepi_solver *solver, int n);
498 
514 extern genepi_set *
515 genepi_set_top_Z (genepi_solver *solver, int n);
516 
530 extern genepi_set *
531 genepi_set_top_P (genepi_solver *solver, int n);
532 
545 extern genepi_set *
546 genepi_set_top_R (genepi_solver *solver, int n);
547 
559 extern genepi_set *
560 genepi_set_bot (genepi_solver *solver, int n);
561 
576 extern genepi_set *
577 genepi_set_linear_equality (genepi_solver *solver, const int *alpha,
578  int alpha_size, int cst);
579 
601 extern genepi_set *
602 genepi_set_linear_operation (genepi_solver *solver, const int *alpha,
603  int alpha_size, genepi_comparator op, int c);
604 
621 extern genepi_set *
623 
641 extern genepi_set *
643  genepi_set *X2);
644 
661 extern genepi_set *
663 
689 extern genepi_set *
691  const int *selection, int size);
692 
720 extern genepi_set *
721 genepi_set_invproject (genepi_solver *solver, genepi_set *X, const int *sel,
722  int size);
723 
745 extern genepi_set *
747 
770 extern genepi_set *
772 
790 extern int
792  genepi_comparator op, genepi_set *X2);
793 
806 extern int
808 
824 extern int
826 
843 extern int
845 
859 extern int
861 
879 extern int
880 genepi_set_depend_on (genepi_solver *solver, genepi_set *X, const int *sel,
881  int selsize);
882 
910 extern void
912  int ***psolutions, int *psize, int max);
913 
934 extern void
936  FILE *output, const char * const*varnames);
937 
953 extern void
955  FILE *output);
956 
970 extern int
972 
992 extern int
994 
1011 extern int
1012 genepi_set_is_solution (genepi_solver *solver, genepi_set *X, const int *x,
1013  int x_size, int xden);
1014 
1037 extern int
1039  int x_size);
1040 
1063 extern int
1064 genepi_set_write (genepi_solver *solver, FILE *output, genepi_set *set);
1065 
1090 extern int
1091 genepi_set_read (genepi_solver *solver, FILE *input, genepi_set **pset);
1092 
1116 extern genepi_set *
1117 genepi_set_transform (genepi_solver *solver, genepi_set *X, int *indices,
1118  int nb_indices, int *cst, int nb_cst);
1119 
1120 
1140 extern int
1142 
1143 END_C_DECLS
1144 
1145 #endif /* ! __GENEPI_H__ */
genepi_io_error
Error codes returned by the functions genepi_set_write and genepi_set_read.
Definition: genepi.h:275
Configuration tables for plugin.
void genepi_solver_delete(genepi_solver *solver)
Releases resources allocated by this solver.
Plugin Loader.
FILE * genepi_solver_get_trace_file(genepi_solver *solver)
Gets the current stream used for generate traces.
genepi_set * genepi_set_linear_equality(genepi_solver *solver, const int *alpha, int alpha_size, int cst)
Computes the set of solutions of a linear equality.
int genepi_set_read(genepi_solver *solver, FILE *input, genepi_set **pset)
Load on the input stream a serialized set.
genepi_set * genepi_set_top(genepi_solver *solver, int n)
Computes the complete relation of arity n.
int genepi_set_is_full(genepi_solver *solver, genepi_set *X)
Checks if X is the complete relation.
genepi_set * genepi_set_transform(genepi_solver *solver, genepi_set *X, int *indices, int nb_indices, int *cst, int nb_cst)
Transformation of the relation X.
int genepi_set_get_one_solution(genepi_solver *solver, genepi_set *X, int *x, int x_size)
Gets one element in X.
An has occurred on the stream at the system level.
Definition: genepi.h:279
genepi_set * genepi_set_applyinv(genepi_solver *solver, genepi_set *R, genepi_set *A)
Computes pre (R, A)
genepi_set * genepi_set_add_reference(genepi_solver *solver, genepi_set *X)
This function increments the number of references to the X set.
genepi_set * genepi_set_top_N(genepi_solver *solver, int n)
Computes the restriction of the complete relation of arity n to positive or null integers. If the underlying plugin does not implement the top_N function then, depending on its solver type the function may raise an exception or not.
genepi_info
Information string identifiers.
Definition: genepi.h:263
int genepi_set_write(genepi_solver *solver, FILE *output, genepi_set *set)
Dump the set X onto the output stream.
void genepi_set_get_solutions(genepi_solver *solver, genepi_set *X, int ***psolutions, int *psize, int max)
Computes an explicit representation of X.
const char * genepi_solver_get_name(genepi_solver *solver)
Gets the name of the underlying plugin.
genepi_solver_type
Indicate the domain of variable used by a solver.
Definition: genepi.h:248
genepi_set * genepi_set_intersection(genepi_solver *solver, genepi_set *X1, genepi_set *X2)
Computes the intersection of two relations.
The client code tries to load a set saved with a plugin different of the one currently used...
Definition: genepi.h:285
struct genepi_set_st genepi_set
Abstraction of Presburger definable set.
Definition: genepi.h:190
genepi_set * genepi_set_bot(genepi_solver *solver, int n)
Computes the empty relation of arity n.
genepi_set * genepi_set_project(genepi_solver *solver, genepi_set *X, const int *selection, int size)
Projects a relation on a subset of its columns.
int genepi_set_get_width(genepi_solver *solver, genepi_set *X)
Arity of the relation represented by X.
genepi_set * genepi_set_top_Z(genepi_solver *solver, int n)
Computes the restriction of the complete relation of arity n to integers. If the underlying plugin do...
genepi_comparator
Comparison specifier.
Definition: genepi.h:230
int genepi_set_is_solution(genepi_solver *solver, genepi_set *X, const int *x, int x_size, int xden)
Checks if x/xden belongs to X.
Malformed stream: data don&#39;t respect the serialization format expected by GENEPI or by the underlying...
Definition: genepi.h:297
int genepi_solver_run_autotest(genepi_solver *solver)
Checks some tautologies with solver.
struct genepi_plugin_st genepi_plugin
The abstract type for a GENEPI plugin that implements sufficient functions to resolve Presburger form...
Definition: genepi-loader.h:72
genepi_set * genepi_set_top_P(genepi_solver *solver, int n)
Computes the restriction of the complete relation of arity n to positive real values. If the underlying plugin does not implement the top_P function then a generic function is used.
genepi_solver_type genepi_solver_get_solver_type(genepi_solver *solver)
Gets the domain of variables used by the underlying plugin.
int genepi_set_get_data_structure_size(genepi_solver *solver, genepi_set *X)
Size of the data structure encoding X.
genepi_set * genepi_set_apply(genepi_solver *solver, genepi_set *R, genepi_set *A)
Computes post (R, A)
genepi_set * genepi_set_linear_operation(genepi_solver *solver, const int *alpha, int alpha_size, genepi_comparator op, int c)
Computes the set of solutions of a linear operation.
int genepi_set_preorder(genepi_solver *solver, genepi_set *X1, genepi_set *X2)
Evaluate the pre-order over sets.
void genepi_set_del_reference(genepi_solver *solver, genepi_set *X)
Removes a reference to X.
void genepi_solver_set_trace_file(genepi_solver *solver, FILE *output)
Enables/Disables GENEPI trace generator.
void genepi_set_display_all_solutions(genepi_solver *solver, genepi_set *X, FILE *output, const char *const *varnames)
Displays all solutions of the set X.
genepi_set * genepi_set_invproject(genepi_solver *solver, genepi_set *X, const int *sel, int size)
Adds columns to the relation X.
genepi_set * genepi_set_top_R(genepi_solver *solver, int n)
Computes the restriction of the complete relation of arity n to real values.
int genepi_set_equal(genepi_solver *solver, genepi_set *X1, genepi_set *X2)
Checks the equality (mutual inclusion) of X1 and X2.
void genepi_set_display_data_structure(genepi_solver *solver, genepi_set *X, FILE *output)
Displays internal representation of X.
The client code tries to load a set saved with another version of the plugin currently used...
Definition: genepi.h:291
int genepi_set_is_finite(genepi_solver *solver, genepi_set *X)
Checks if the set is finite.
int genepi_set_compare(genepi_solver *solver, genepi_set *X1, genepi_comparator op, genepi_set *X2)
Compares X1 and X2 according to op.
struct genepi_solver_st genepi_solver
Type of GENEPI solver.
Definition: genepi.h:180
genepi_set * genepi_set_union(genepi_solver *solver, genepi_set *X1, genepi_set *X2)
Computes the union of two relations.
int genepi_set_depend_on(genepi_solver *solver, genepi_set *X, const int *sel, int selsize)
Checks if the relation X depends on a subset of its column.
genepi_solver * genepi_solver_create(genepi_plugin *plugin, int flags, int cachesize, int number_of_cache_entries)
Creates a GENEPI solver.
genepi_set * genepi_set_complement(genepi_solver *solver, genepi_set *X)
Computes the complement of the set X.
int genepi_set_is_empty(genepi_solver *solver, genepi_set *X)
Checks if X is empty.