1 /* This is the header file of the C interface of the Parma Polyhedra Library.
2    Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it>
3    Copyright (C) 2010-2016 BUGSENG srl (http://bugseng.com)
4 
5 This file is part of the Parma Polyhedra Library (PPL).
6 
7 The PPL is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
11 
12 The PPL is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15 for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software Foundation,
19 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307, USA.
20 
21 For the most up-to-date information see the Parma Polyhedra Library
22 site: http://bugseng.com/products/ppl/ . */
23 
24 #ifndef PPL_ppl_c_h
25 #define PPL_ppl_c_h 1
26 
27 /*!
28   \defgroup PPL_C_interface C Language Interface
29 
30   The Parma Polyhedra Library comes equipped with an interface
31   for the C language.
32 */
33 
34 /*! \mainpage
35 
36 All the declarations needed for using the PPL's C interface
37 (preprocessor symbols, data types, variables and
38 functions) are collected in the header file <CODE>ppl_c.h</CODE>.
39 This file, which is designed to work with pre-ANSI and ANSI C compilers
40 as well as C99 and C++ compilers, should be included, either directly
41 or via some other header file, with the directive
42 \code
43 #include <ppl_c.h>
44 \endcode
45 If this directive does not work, then your compiler is unable to find
46 the file <CODE>ppl_c.h</CODE>. So check that the library is installed
47 (if it is not installed, you may want to <CODE>make install</CODE>,
48 perhaps with root privileges) in the right place
49 (if not you may want to reconfigure the library using the appropriate
50 pathname for the <CODE>--prefix</CODE> option); and that your compiler
51 knows where it is installed (if not you should add the path to the
52 directory where <CODE>ppl_c.h</CODE> is located to the compiler's
53 include file search path; this is usually done with the
54 <CODE>-I</CODE> option).
55 
56 The name space of the PPL's C interface is <CODE>PPL_*</CODE> for
57 preprocessor symbols, enumeration values and variables; and
58 <CODE>ppl_*</CODE> for data types and function names. The interface
59 systematically uses <EM>opaque data types</EM> (generic pointers that
60 completely hide the internal representations from the client code) and
61 provides all required access functions. By using just the interface,
62 the client code can exploit all the functionalities of the library yet
63 avoid directly manipulating the library's data structures.  The advantages
64 are that (1) applications do not depend on the internals of the library
65 (these may change from release to release), and (2) the interface
66 invariants can be thoroughly checked (by the access functions).
67 
68 \note
69 All functions taking as input argument an opaque pointer datatype assume
70 that such an argument is actually <em>referring to a valid PPL object</em>.
71 For instance, a function with an argument having type
72 <code>ppl_MIP_Problem_t</code> will expect a valid MIP_Problem object,
73 previously initialized by calling, e.g., <code>ppl_new_MIP_Problem</code>.
74 If that is not the case (e.g., if a null pointer is passed in),
75 the behavior is undefined.
76 
77 The PPL's C interface is initialized by means of the
78 <CODE>ppl_initialize</CODE> function.  This function must
79 be called <EM>before using any other interface of the library</EM>.
80 The application can release the resources allocated by the library by
81 calling the <CODE>ppl_finalize</CODE> function. After this function
82 is called <EM>no other interface of the library may be used</EM>
83 until the interface is re-initialized using <CODE>ppl_initialize</CODE>.
84 
85 Any application using the PPL should make sure that only the
86 intended version(s) of the library are ever used.  The version used can be
87 checked at compile-time thanks to the macros PPL_VERSION_MAJOR,
88 PPL_VERSION_MINOR, PPL_VERSION_REVISION and PPL_VERSION_BETA, which
89 give, respectively major, minor, revision and beta numbers of the PPL
90 version.  This is an example of their use:
91 \code
92 #if PPL_VERSION_MAJOR == 0 && PPL_VERSION_MINOR < 6
93 # error "PPL version 0.6 or following is required"
94 #endif
95 \endcode
96 Compile-time checking, however, is not normally enough, particularly in
97 an environment where there is dynamic linking.  Run-time checking can
98 be performed by means of the functions <CODE>ppl_version_major</CODE>,
99 <CODE>ppl_version_minor</CODE>, <CODE>ppl_version_revision</CODE>, and
100 <CODE>ppl_version_beta</CODE>. The PPL's C interface also provides
101 functions <CODE>ppl_version</CODE>, returning character string
102 containing the full version number, and <CODE>ppl_banner</CODE>,
103 returning a string that, in addition, provides (pointers to) other
104 useful information for the library user.
105 
106 All programs using the PPL's C interface must link with the
107 following libraries: <CODE>libppl_c</CODE> (PPL's C interface),
108 <CODE>libppl</CODE> (PPL's core), <CODE>libgmpxx</CODE> (GMP's C++
109 interface), and <CODE>libgmp</CODE> (GMP's library core).  On most
110 Unix-like systems, this is done by adding <CODE>-lppl_c</CODE>,
111 <CODE>-lppl</CODE>, <CODE>-lgmpxx</CODE>, and <CODE>-lgmp</CODE> to
112 the compiler's or linker's command line.  For example:
113 \verbatim
114 gcc myprogram.o -lppl_c -lppl -lgmpxx -lgmp
115 \endverbatim
116 If this does not work, it means that your compiler/linker is not
117 finding the libraries where it expects.  Again, this could be because you
118 forgot to install the library or you installed it in a non-standard
119 location.  In the latter case you will need to use the appropriate
120 options (usually <CODE>-L</CODE>) and, if you use shared libraries,
121 some sort of run-time path selection mechanisms.  Consult your
122 compiler's documentation for details.  Notice that the PPL is built
123 using <A HREF="http://www.gnu.org/software/libtool/">Libtool</A> and
124 an application can exploit this fact to significantly simplify the
125 linking phase.  See Libtool's documentation for details.  Those
126 working under Linux can find a lot of useful information on how to use
127 program libraries (including static, shared, and dynamically loaded
128 libraries) in the
129 <A HREF="http://www.dwheeler.com/program-library/">Program Library
130 HOWTO</A>.
131 
132 For examples on how to use the functions provided by the C interface,
133 you are referred to the directory <CODE>demos/ppl_lpsol/</CODE> in
134 the source distribution.  It contains a <EM>Mixed Integer (Linear)
135 Programming</EM> solver written in C.  In order to use this solver
136 you will need to install
137 <A HREF="http://www.gnu.org/software/glpk/">GLPK</A> (the GNU Linear
138 Programming Kit): this is used to read linear programs in MPS format.
139 */ /* \mainpage */
140 
141 /*
142   For some reason, GMP up to and including version 4.1.3 requires
143   <stdio.h> to be included before <gmp.h>.
144 */
145 
146 #include <stdio.h>
147 #include <gmp.h>
148 #include <stddef.h>
149 
150 /*
151   PPL_PROTO is a macro used to wrap function prototypes, so that
152   compilers that don't understand ANSI C prototypes still work, and
153   ANSI C compilers can issue warnings about type mismatches.
154 */
155 #if defined(__STDC__)                              \
156   || defined(__cplusplus)                          \
157   || defined (_AIX)                                \
158   || (defined (__mips) && defined (_SYSTYPE_SVR4)) \
159   || defined(_WIN32)
160 # define PPL_PROTO(protos) protos
161 #else
162 # define PPL_PROTO(protos) ()
163 #endif
164 
165 #ifdef __cplusplus
166 extern "C" {
167 #endif
168 
169 /*! \defgroup Init Library Initialization and Finalization
170   Functions for initialization/finalization of the library,
171   as well as setting/resetting of floating-point rounding mode.
172 */
173 /*@{*/
174 
175 /*! \brief
176   Initializes the Parma Polyhedra Library.
177   This function must be called before any other function.
178 
179   \return
180   <CODE>PPL_ERROR_INVALID_ARGUMENT</CODE> if the library
181   was already initialized.
182 */
183 int
184 ppl_initialize PPL_PROTO((void));
185 
186 /*! \brief
187   Finalizes the Parma Polyhedra Library.
188   This function must be called after any other function.
189 
190   \return
191   <CODE>PPL_ERROR_INVALID_ARGUMENT</CODE> if the library
192   was already finalized.
193 */
194 int
195 ppl_finalize PPL_PROTO((void));
196 
197 /*! \brief
198   Sets the FPU rounding mode so that the PPL abstractions based on
199   floating point numbers work correctly.
200 
201   This is performed automatically at initialization-time.  Calling
202   this function is needed only if restore_pre_PPL_rounding() has been
203   previously called.
204 */
205 int
206 ppl_set_rounding_for_PPL PPL_PROTO((void));
207 
208 /*! \brief
209   Sets the FPU rounding mode as it was before initialization of the PPL.
210 
211   After calling this function it is absolutely necessary to call
212   set_rounding_for_PPL() before using any PPL abstractions based on
213   floating point numbers.
214   This is performed automatically at finalization-time.
215 */
216 int
217 ppl_restore_pre_PPL_rounding PPL_PROTO((void));
218 
219 /*! \brief
220   Writes to \p p the precision parameter used for irrational calculations.
221 */
222 int
223 ppl_irrational_precision PPL_PROTO((unsigned* p));
224 
225 /*! \brief
226   Sets the precision parameter used for irrational calculations.
227 
228   If \p p is less than or equal to <CODE>INT_MAX</CODE>, sets the
229   precision parameter used for irrational calculations to \p p.
230   Then, in the irrational calculations returning an unbounded rational,
231   (e.g., when computing a square root), the lesser between numerator
232   and denominator will be limited to 2**\p p.
233 */
234 int
235 ppl_set_irrational_precision PPL_PROTO((unsigned p));
236 
237 /*@}*/ /* Init */
238 
239 /*! \defgroup Version Version Checking
240   Symbolic constants and functions related to library version checking.
241 */
242 /*@{*/
243 
244 #include "ppl_c_version.h"
245 
246 /*! \brief
247   Returns the major number of the PPL version.
248 */
249 int
250 ppl_version_major PPL_PROTO((void));
251 
252 /*! \brief
253   Returns the minor number of the PPL version.
254 */
255 int
256 ppl_version_minor PPL_PROTO((void));
257 
258 /*! \brief
259   Returns the revision number of the PPL version.
260 */
261 int
262 ppl_version_revision PPL_PROTO((void));
263 
264 /*! \brief
265   Returns the beta number of the PPL version.
266 */
267 int
268 ppl_version_beta PPL_PROTO((void));
269 
270 /*! \brief
271   Writes to \c *p a pointer to a character string containing the
272   PPL version.
273 */
274 int
275 ppl_version PPL_PROTO((const char** p));
276 
277 /*! \brief
278   Writes to \c *p a pointer to a character string containing the PPL banner.
279 
280   The banner provides information about the PPL version, the licensing,
281   the lack of any warranty whatsoever, the C++ compiler used to build
282   the library, where to report bugs and where to look for further
283   information.
284 */
285 int
286 ppl_banner PPL_PROTO((const char** p));
287 
288 /*@}*/ /* Version Checking */
289 
290 /*! \defgroup Error Error Handling
291   Symbolic constants and functions related to error reporting/handling.
292 */
293 /*@{*/
294 
295 /*! \brief
296   Defines the error codes that any function may return.
297 */
298 enum ppl_enum_error_code {
299   /*! \hideinitializer
300     The virtual memory available to the process has been exhausted. */
301   PPL_ERROR_OUT_OF_MEMORY = -2,
302   /*! \hideinitializer
303     A function has been invoked with an invalid argument. */
304   PPL_ERROR_INVALID_ARGUMENT = -3,
305   /*! \hideinitializer
306     A function has been invoked outside its domain of definition. */
307   PPL_ERROR_DOMAIN_ERROR = -4,
308   /*! \hideinitializer
309     The construction of an object that would exceed its maximum
310     permitted size was attempted. */
311   PPL_ERROR_LENGTH_ERROR = -5,
312   /*! \hideinitializer
313     An arithmetic overflow occurred and the computation was consequently
314     interrupted.  This can <EM>only</EM> happen in library's incarnations
315     using bounded integers as coefficients. */
316   PPL_ARITHMETIC_OVERFLOW = -6,
317   /*! \hideinitializer
318     An error occurred during a C input/output operation.  A more
319     precise indication of what went wrong is available via
320     <CODE>errno</CODE>. */
321   PPL_STDIO_ERROR = -7,
322   /*! \hideinitializer
323     An internal error that was diagnosed by the PPL itself.
324     This indicates a bug in the PPL. */
325   PPL_ERROR_INTERNAL_ERROR = -8,
326   /*! \hideinitializer
327     A standard exception has been raised by the C++ run-time environment.
328     This indicates a bug in the PPL. */
329   PPL_ERROR_UNKNOWN_STANDARD_EXCEPTION = -9,
330   /*! \hideinitializer
331     A totally unknown, totally unexpected error happened.
332     This indicates a bug in the PPL. */
333   PPL_ERROR_UNEXPECTED_ERROR = -10,
334   /*! \hideinitializer
335     An exception has been raised by the PPL as a timeout previously set
336     by the user has expired.
337   */
338   PPL_TIMEOUT_EXCEPTION = -11,
339   /*! \hideinitializer
340     The client program attempted to use the PPL in a way that violates
341     its internal logic.  This happens, for instance, when the client
342     attempts to use the timeout facilities on a system that does not
343     support them. */
344   PPL_ERROR_LOGIC_ERROR = -12
345 };
346 
347 /*! \brief
348   Installs the user-defined error handler pointed at by \p h.
349 
350   The error handler takes an error code and a textual description that
351   gives further information about the actual error.  The C string
352   containing the textual description is read-only and its existence is
353   not guaranteed after the handler has returned.
354 */
355 int
356 ppl_set_error_handler PPL_PROTO((void (*h)(enum ppl_enum_error_code code,
357                                            const char* description)));
358 
359 /*@}*/ /* Error */
360 
361 /*! \defgroup Timeout Timeout Handling
362   Functions for setting and resetting timeouts.
363 */
364 /*@{*/
365 
366 /*! \brief
367   Sets the timeout for computations whose completion could require
368   an exponential amount of time.
369 
370   \param csecs
371   The number of centiseconds sometimes after which a timeout will occur;
372   it must be strictly greater than zero.
373 
374   Computations taking exponential time will be interrupted some time
375   after \p csecs centiseconds have elapsed since the call to
376   the timeout setting function. If the computation is interrupted that
377   way, the interrupted function will return error code
378   <code>PPL_TIMEOUT_EXCEPTION</code>.
379   Otherwise, if the computation completes without being interrupted,
380   then the timeout should be reset by calling
381   <code>ppl_reset_timeout()</code>.
382 */
383 int
384 ppl_set_timeout PPL_PROTO((unsigned csecs));
385 
386 /*! \brief
387   Resets the timeout time so that the computation is not interrupted.
388 */
389 int
390 ppl_reset_timeout PPL_PROTO((void));
391 
392 /*! \brief
393   Sets a threshold for computations whose completion could require
394   an exponential amount of time.
395 
396   \return
397   <CODE>PPL_ERROR_INVALID_ARGUMENT</CODE> if \p unscaled_weight is zero
398   or if the computed weight threshold exceeds the maximum allowed value.
399 
400   \param unscaled_weight
401   The unscaled maximum computational weight; it has to be non-zero.
402 
403   \param scale
404   The scaling factor to be applied to \p unscaled_weight.
405 
406   If \p unscaled_weight has value \f$u\f$ and \p scale has value \f$s\f$,
407   then the (scaled) weight threshold is computed as \f$w = u \cdot 2^s\f$.
408   Computations taking exponential time will be interrupted some time
409   after reaching the complexity threshold \f$w\f$.
410   If the computation is interrupted that way, the interrupted function
411   will return error code <code>PPL_TIMEOUT_EXCEPTION</code>.
412   Otherwise, if the computation completes without being interrupted,
413   then the deterministic timeout should be reset by calling
414   <code>ppl_reset_deterministic_timeout()</code>.
415 
416   \note
417   This "timeout" checking functionality is said to be \e deterministic
418   because it is not based on actual elapsed time. Its behavior will
419   only depend on (some of the) computations performed in the PPL library
420   and it will be otherwise independent from the computation environment
421   (CPU, operating system, compiler, etc.).
422 
423   \warning
424   The weight mechanism is under beta testing. In particular,
425   there is still no clear relation between the weight threshold and
426   the actual computational complexity. As a consequence, client
427   applications should be ready to reconsider the tuning of these
428   weight thresholds when upgrading to newer version of the PPL.
429 */
430 int
431 ppl_set_deterministic_timeout PPL_PROTO((unsigned long unscaled_weight,
432                                          unsigned scale));
433 
434 /*! \brief
435   Resets the deterministic timeout so that the computation is not interrupted.
436 */
437 int
438 ppl_reset_deterministic_timeout PPL_PROTO((void));
439 
440 /*@}*/ /* Timeout */
441 
442 /*! \defgroup Datatypes Library Datatypes
443   \brief
444   Typedefs for the library datatypes and related symbolic constants.
445 
446   The datatypes provided by the library should be manipulated
447   by means of the corresponding opaque pointer types and
448   the functions working on them.
449 
450   \note
451   To simplify the detection of common programming mistakes,
452   we provide both pointer-to-const and pointer-to-nonconst
453   opaque pointers, with implicit conversions mapping each
454   pointer-to-nonconst to the corresponding pointer-to-const when needed.
455   The user of the C interface is therefore recommended to adopt
456   the pointer-to-const type whenever read-only access is meant.
457 */
458 /*@{*/
459 
460 /*! \brief
461   An unsigned integral type for representing space dimensions.
462 */
463 typedef size_t ppl_dimension_type;
464 
465 /*! \brief
466   Writes to \p m the maximum space dimension this library can handle.
467 */
468 int
469 ppl_max_space_dimension PPL_PROTO((ppl_dimension_type* m));
470 
471 /*! \brief
472   Writes to \p m a value that does not designate a valid dimension.
473 */
474 int
475 ppl_not_a_dimension PPL_PROTO((ppl_dimension_type* m));
476 
477 /*! \brief
478   Pretty-prints \p var to <CODE>stdout</CODE>.
479 */
480 int
481 ppl_io_print_variable PPL_PROTO((ppl_dimension_type var));
482 
483 /*! \brief
484   Pretty-prints \p var to the given output \p stream.
485 */
486 int
487 ppl_io_fprint_variable PPL_PROTO((FILE* stream, ppl_dimension_type var));
488 
489 /*! \brief
490   Pretty-prints \p var to a malloc-allocated string, a pointer to which
491   is returned via \p strp.
492 */
493 int
494 ppl_io_asprint_variable PPL_PROTO((char** strp, ppl_dimension_type var));
495 
496 /*! \brief
497   The type of output functions used for printing variables.
498 
499   An output function for variables must write a textual representation
500   for \p var to a character buffer, null-terminate it, and return a
501   pointer to the beginning of the buffer.  In case the operation fails,
502   0 should be returned and perhaps <CODE>errno</CODE> should be set
503   in a meaningful way.  The library does nothing with the buffer, besides
504   printing its contents.
505 */
506 typedef const char*
507 ppl_io_variable_output_function_type(ppl_dimension_type var);
508 
509 /*! \brief
510   Sets the output function to be used for printing variables to \p p.
511 */
512 int
513 ppl_io_set_variable_output_function(ppl_io_variable_output_function_type* p);
514 
515 /*! \brief
516   Writes a pointer to the current variable output function to \p pp.
517 */
518 int
519 ppl_io_get_variable_output_function(ppl_io_variable_output_function_type** pp);
520 
521 /*! \brief Utility function for the wrapping of lines of text.
522 
523   \param src
524   The source string holding the text to wrap.
525 
526   \param indent_depth
527   The indentation depth.
528 
529   \param preferred_first_line_length
530   The preferred length for the first line of text.
531 
532   \param preferred_line_length
533   The preferred length for all the lines but the first one.
534 
535   \return
536   The wrapped string in a malloc-allocated buffer.
537 */
538 char*
539 ppl_io_wrap_string(const char* src,
540                    unsigned indent_depth,
541                    unsigned preferred_first_line_length,
542                    unsigned preferred_line_length);
543 
544 /*@}*/ /* Datatypes */
545 
546 #undef PPL_TYPE_DECLARATION
547 
548 #define PPL_TYPE_DECLARATION(Type)                                    \
549 /*! \brief Opaque pointer \ingroup Datatypes */                       \
550 typedef struct ppl_##Type##_tag* ppl_##Type##_t;                      \
551 /*! \brief Opaque pointer to const object \ingroup Datatypes */       \
552 typedef struct ppl_##Type##_tag const* ppl_const_##Type##_t;
553 
554 /*! \interface ppl_Coefficient_tag
555   \brief
556   Types and functions for coefficients.
557 
558   The types and functions for coefficients provide an interface towards
559   \extref{Parma_Polyhedra_Library::Coefficient, Coefficient}.
560   Depending on configuration, the PPL coefficients may be implemented
561   by the unbounded precision integers provided by GMP (default),
562   or by bounded precision integers (with checks for overflows).
563 */
564 PPL_TYPE_DECLARATION(Coefficient)
565 
566 /*! \interface ppl_Linear_Expression_tag
567   \brief
568   Types and functions for linear expressions.
569 
570   The types and functions for linear expression provide an interface towards
571   \extref{Parma_Polyhedra_Library::Linear_Expression, Linear_Expression}.
572 */
573 PPL_TYPE_DECLARATION(Linear_Expression)
574 
575 /*! \interface ppl_Constraint_tag
576   \brief
577   Types and functions for constraints.
578 
579   The types and functions for constraints provide an interface towards
580   \extref{Parma_Polyhedra_Library::Constraint, Constraint}.
581 */
582 PPL_TYPE_DECLARATION(Constraint)
583 
584 /*! \interface ppl_Constraint_System_tag
585   \brief
586   Types and functions for constraint systems.
587 
588   The types and functions for constraint systems provide an interface
589   towards
590   \extref{Parma_Polyhedra_Library::Constraint_System, Constraint_System}.
591 */
592 PPL_TYPE_DECLARATION(Constraint_System)
593 
594 /*! \interface ppl_Constraint_System_const_iterator_tag
595   \brief
596   Types and functions for iterating on constraint systems.
597 
598   The types and functions for constraint systems iterators provide
599   read-only access to the elements of a constraint system by interfacing
600   \extref{Parma_Polyhedra_Library::Constraint_System_const_iterator,
601   Constraint_System::const_iterator}.
602 */
603 PPL_TYPE_DECLARATION(Constraint_System_const_iterator)
604 
605 /*! \interface ppl_Generator_tag
606   \brief
607   Types and functions for generators.
608 
609   The types and functions for generators provide an interface
610   towards \extref{Parma_Polyhedra_Library::Generator, Generator}.
611 */
612 PPL_TYPE_DECLARATION(Generator)
613 
614 /*! \interface ppl_Generator_System_tag
615   \brief
616   Types and functions for generator systems.
617 
618   The types and functions for generator systems provide an interface
619   towards
620   \extref{Parma_Polyhedra_Library::Generator_System, Generator_System}.
621 */
622 PPL_TYPE_DECLARATION(Generator_System)
623 
624 /*! \interface ppl_Generator_System_const_iterator_tag
625   \brief
626   Types and functions for iterating on generator systems.
627 
628   The types and functions for generator systems iterators provide
629   read-only access to the elements of a generator system by interfacing
630   \extref{Parma_Polyhedra_Library::Generator_System_const_iterator,
631   Generator_System::const_iterator}.
632 */
633 PPL_TYPE_DECLARATION(Generator_System_const_iterator)
634 
635 /*! \interface ppl_Congruence_tag
636   \brief
637   Types and functions for congruences.
638 
639   The types and functions for congruences provide an interface
640   towards \extref{Parma_Polyhedra_Library::Congruence, Congruence}.
641 */
642 PPL_TYPE_DECLARATION(Congruence)
643 
644 /*! \interface ppl_Congruence_System_tag
645   \brief
646   Types and functions for congruence systems.
647 
648   The types and functions for congruence systems provide an interface
649   towards
650   \extref{Parma_Polyhedra_Library::Congruence_System, Congruence_System}.
651 */
652 PPL_TYPE_DECLARATION(Congruence_System)
653 
654 /*! \interface ppl_Congruence_System_const_iterator_tag
655   \brief
656   Types and functions for iterating on congruence systems.
657 
658   The types and functions for congruence systems iterators provide
659   read-only access to the elements of a congruence system by interfacing
660   \extref{Parma_Polyhedra_Library::Congruence_System::const_iterator,
661   Congruence_System::const_iterator}.
662 */
663 PPL_TYPE_DECLARATION(Congruence_System_const_iterator)
664 
665 /*! \interface ppl_Grid_Generator_tag
666   \brief
667   Types and functions for grid generators.
668 
669   The types and functions for grid generators provide an interface
670   towards \extref{Parma_Polyhedra_Library::Grid_Generator, Grid_Generator}.
671 */
672 PPL_TYPE_DECLARATION(Grid_Generator)
673 
674 /*! \interface ppl_Grid_Generator_System_tag
675   \brief
676   Types and functions for grid generator systems.
677 
678   The types and functions for grid generator systems provide an interface
679   towards
680   \extref{Parma_Polyhedra_Library::Grid_Generator_System,
681   Grid_Generator_System}.
682 */
683 PPL_TYPE_DECLARATION(Grid_Generator_System)
684 
685 /*! \interface ppl_Grid_Generator_System_const_iterator_tag
686   \brief
687   Types and functions for iterating on grid generator systems.
688 
689   The types and functions for grid generator systems iterators provide
690   read-only access to the elements of a grid generator system by interfacing
691   \extref{Parma_Polyhedra_Library::Grid_Generator_System::const_iterator,
692   Grid_Generator_System::const_iterator}.
693 */
694 PPL_TYPE_DECLARATION(Grid_Generator_System_const_iterator)
695 
696 /*! \interface ppl_MIP_Problem_tag
697   \brief
698   Types and functions for MIP problems.
699 
700   The types and functions for MIP problems provide an interface
701   towards \extref{Parma_Polyhedra_Library::MIP_Problem, MIP_Problem}.
702 */
703 PPL_TYPE_DECLARATION(MIP_Problem)
704 
705 /*! \interface ppl_PIP_Problem_tag
706   \brief
707   Types and functions for PIP problems.
708 
709   The types and functions for PIP problems provide an interface
710   towards \extref{Parma_Polyhedra_Library::PIP_Problem, PIP_Problem}.
711 */
712 PPL_TYPE_DECLARATION(PIP_Problem)
713 
714 /*! \interface ppl_PIP_Tree_Node_tag
715   \brief
716   Types and functions for generic PIP tree nodes.
717 
718   The types and functions for tree nodes provide an interface
719   towards \extref{Parma_Polyhedra_Library::PIP_Tree_Node, PIP_Tree_Node}.
720 */
721 PPL_TYPE_DECLARATION(PIP_Tree_Node)
722 
723 /*! \interface ppl_PIP_Decision_Node_tag
724   \brief
725   Types and functions for PIP decision nodes.
726 
727   The types and functions for decision nodes provide an interface towards
728   \extref{Parma_Polyhedra_Library::PIP_Decision_Node, PIP_Decision_Node}.
729 */
730 PPL_TYPE_DECLARATION(PIP_Decision_Node)
731 
732 /*! \interface ppl_PIP_Solution_Node_tag
733   \brief
734   Types and functions for PIP solution nodes.
735 
736   The types and functions for solution nodes provide an interface towards
737   \extref{Parma_Polyhedra_Library::PIP_Solution_Node, PIP_Solution_Node}.
738 */
739 PPL_TYPE_DECLARATION(PIP_Solution_Node)
740 
741 /*! \interface ppl_Artificial_Parameter_tag
742   \brief
743   Types and functions for PIP artificial parameters.
744 
745   The types and functions for PIP artificial parameters provide
746   an interface towards
747   \extref{Parma_Polyhedra_Library::PIP_Tree_Node::Artificial_Parameter, Artificial_Parameter}.
748 */
749 PPL_TYPE_DECLARATION(Artificial_Parameter)
750 PPL_TYPE_DECLARATION(Artificial_Parameter_Sequence)
751 
752 /*! \interface ppl_Artificial_Parameter_Sequence_const_iterator_tag
753   \brief
754   Types and functions for iterating on PIP artificial parameters.
755 */
756 PPL_TYPE_DECLARATION(Artificial_Parameter_Sequence_const_iterator)
757 
758 
759 #undef PPL_DECLARE_PRINT_FUNCTIONS
760 #undef PPL_DECLARE_ASCII_DUMP_LOAD_FUNCTIONS
761 #undef PPL_DECLARE_IO_FUNCTIONS
762 #undef PPL_DECLARE_AND_DOCUMENT_PRINT_FUNCTIONS
763 #undef PPL_DECLARE_AND_DOCUMENT_ASCII_DUMP_LOAD_FUNCTIONS
764 #undef PPL_DECLARE_AND_DOCUMENT_IO_FUNCTIONS
765 
766 #define PPL_DECLARE_PRINT_FUNCTIONS(Type)                               \
767 /*! \relates ppl_##Type##_tag */                                        \
768 int                                                                     \
769 ppl_io_print_##Type PPL_PROTO((ppl_const_##Type##_t x));                \
770 /*! \relates ppl_##Type##_tag */                                        \
771 int                                                                     \
772 ppl_io_fprint_##Type PPL_PROTO((FILE* stream, ppl_const_##Type##_t x)); \
773 /*! \relates ppl_##Type##_tag */                                        \
774 int                                                                     \
775 ppl_io_asprint_##Type PPL_PROTO((char** strp, ppl_const_##Type##_t x));
776 
777 #define PPL_DECLARE_ASCII_DUMP_LOAD_FUNCTIONS(Type) \
778 /*! \relates ppl_##Type##_tag */                    \
779 int                                                 \
780 ppl_##Type##_ascii_dump                             \
781 PPL_PROTO((ppl_const_##Type##_t x, FILE* stream));  \
782 /*! \relates ppl_##Type##_tag */                    \
783 int                                                 \
784 ppl_##Type##_ascii_load                             \
785 PPL_PROTO((ppl_##Type##_t x, FILE* stream));
786 
787 #define PPL_DECLARE_IO_FUNCTIONS(Type)      \
788 PPL_DECLARE_PRINT_FUNCTIONS(Type)           \
789 PPL_DECLARE_ASCII_DUMP_LOAD_FUNCTIONS(Type)
790 
791 #define PPL_DECLARE_AND_DOCUMENT_PRINT_FUNCTIONS(Type)                  \
792 /*! \relates ppl_##Type##_tag \brief Prints \p x to \c stdout. */       \
793 int                                                                     \
794 ppl_io_print_##Type PPL_PROTO((ppl_const_##Type##_t x));                \
795 /*! \relates ppl_##Type##_tag \brief Prints \p x to the given output \p stream. */ \
796 int                                                                     \
797 ppl_io_fprint_##Type PPL_PROTO((FILE* stream, ppl_const_##Type##_t x)); \
798 /*! \relates ppl_##Type##_tag \brief Prints \p x to a malloc-allocated string, a pointer to which is returned via \p strp. */ \
799 int                                                                     \
800 ppl_io_asprint_##Type PPL_PROTO((char** strp, ppl_const_##Type##_t x));
801 
802 
803 #define PPL_DECLARE_AND_DOCUMENT_ASCII_DUMP_LOAD_FUNCTIONS(Type) \
804 /*! \relates ppl_##Type##_tag \brief Dumps an ascii representation of \p x on \p stream. */ \
805 int                                                              \
806 ppl_##Type##_ascii_dump                                          \
807 PPL_PROTO((ppl_const_##Type##_t x, FILE* stream));               \
808 /*! \relates ppl_##Type##_tag \brief Loads an ascii representation of \p x from \p stream. */ \
809 int                                                              \
810 ppl_##Type##_ascii_load                                          \
811 PPL_PROTO((ppl_##Type##_t x, FILE* stream));
812 
813 #define PPL_DECLARE_AND_DOCUMENT_IO_FUNCTIONS(Type)      \
814 /*! \brief \name Input/Output Functions */               \
815 /*@{*/                                                   \
816 PPL_DECLARE_AND_DOCUMENT_PRINT_FUNCTIONS(Type)           \
817 PPL_DECLARE_AND_DOCUMENT_ASCII_DUMP_LOAD_FUNCTIONS(Type) \
818 /*@}*/ /* Input/Output Functions */
819 
820 
821 /*! \brief \name Constructors, Assignment and Destructor */
822 /*@{*/
823 
824 /*! \relates ppl_Coefficient_tag \brief
825   Creates a new coefficient with value 0 and writes a handle for the
826   newly created coefficient at address \p pc.
827 */
828 int
829 ppl_new_Coefficient PPL_PROTO((ppl_Coefficient_t* pc));
830 
831 /*! \relates ppl_Coefficient_tag \brief
832   Creates a new coefficient with the value given by the GMP integer
833   \p z and writes a handle for the newly created coefficient
834   at address \p pc.
835 */
836 int
837 ppl_new_Coefficient_from_mpz_t PPL_PROTO((ppl_Coefficient_t* pc, mpz_t z));
838 
839 /*! \relates ppl_Coefficient_tag \brief
840   Builds a coefficient that is a copy of \p c; writes a handle
841   for the newly created coefficient at address \p pc.
842 */
843 int
844 ppl_new_Coefficient_from_Coefficient PPL_PROTO((ppl_Coefficient_t* pc,
845                                                 ppl_const_Coefficient_t c));
846 
847 /*! \relates ppl_Coefficient_tag \brief
848   Assign to \p dst the value given by the GMP integer \p z.
849 */
850 int
851 ppl_assign_Coefficient_from_mpz_t PPL_PROTO((ppl_Coefficient_t dst, mpz_t z));
852 
853 /*! \relates ppl_Coefficient_tag \brief
854   Assigns a copy of the coefficient \p src to \p dst.
855 */
856 int
857 ppl_assign_Coefficient_from_Coefficient
858 PPL_PROTO((ppl_Coefficient_t dst, ppl_const_Coefficient_t src));
859 
860 /*! \relates ppl_Coefficient_tag \brief
861   Invalidates the handle \p c: this makes sure the corresponding
862   resources will eventually be released.
863 */
864 int
865 ppl_delete_Coefficient PPL_PROTO((ppl_const_Coefficient_t c));
866 
867 /*@}*/ /* Constructors, Assignment and Destructor */
868 
869 /*! \brief \name Read-Only Accessor Functions */
870 /*@{*/
871 
872 /*! \relates ppl_Coefficient_tag \brief
873   Sets the value of the GMP integer \p z to the value of \p c.
874 */
875 int
876 ppl_Coefficient_to_mpz_t PPL_PROTO((ppl_const_Coefficient_t c, mpz_t z));
877 
878 /*! \relates ppl_Coefficient_tag \brief
879   Returns a positive integer if \p c is well formed, i.e., if it
880   satisfies all its implementation invariants; returns 0 and perhaps
881   makes some noise if \p c is broken.  Useful for debugging purposes.
882 */
883 int
884 ppl_Coefficient_OK PPL_PROTO((ppl_const_Coefficient_t c));
885 
886 /*! \relates ppl_Coefficient_tag \brief
887   Returns a positive integer if coefficients are bounded; returns 0
888   otherwise.
889 */
890 int
891 ppl_Coefficient_is_bounded PPL_PROTO((void));
892 
893 /*! \relates ppl_Coefficient_tag \brief
894   Returns a positive integer if coefficients are bounded, in which case
895   \p min is set to their minimum value; returns 0 otherwise.
896 */
897 int
898 ppl_Coefficient_min PPL_PROTO((mpz_t min));
899 
900 /*! \relates ppl_Coefficient_tag \brief
901   Returns a positive integer if coefficients are bounded, in which case
902   \p max is set to their maximum value; returns 0 otherwise.
903 */
904 int
905 ppl_Coefficient_max PPL_PROTO((mpz_t max));
906 
907 /*@}*/ /* Read-Only Accessor Functions */
908 
909 /* No ascii dump for Coefficient */
910 /*! \brief \name I/O Functions */
911 /*@{*/
912 PPL_DECLARE_AND_DOCUMENT_PRINT_FUNCTIONS(Coefficient)
913 /*@}*/ /* I/O Functions */
914 
915 
916 /*! \brief \name Constructors, Assignment and Destructor */
917 /*@{*/
918 
919 /*! \relates ppl_Linear_Expression_tag \brief
920   Creates a new linear expression corresponding to the constant 0 in a
921   zero-dimensional space; writes a handle for the new linear
922   expression at address \p ple.
923 */
924 int
925 ppl_new_Linear_Expression PPL_PROTO((ppl_Linear_Expression_t* ple));
926 
927 /*! \relates ppl_Linear_Expression_tag \brief
928   Creates a new linear expression corresponding to the constant 0 in a
929   <TT>d</TT>-dimensional space; writes a handle for the new linear
930   expression at address \p ple.
931 */
932 int
933 ppl_new_Linear_Expression_with_dimension
934 PPL_PROTO((ppl_Linear_Expression_t* ple, ppl_dimension_type d));
935 
936 /*! \relates ppl_Linear_Expression_tag \brief
937   Builds a linear expression that is a copy of \p le; writes a handle
938   for the newly created linear expression at address \p ple.
939 */
940 int
941 ppl_new_Linear_Expression_from_Linear_Expression
942 PPL_PROTO((ppl_Linear_Expression_t* ple, ppl_const_Linear_Expression_t le));
943 
944 /*! \relates ppl_Linear_Expression_tag \brief
945   Builds a linear expression corresponding to constraint \p c;
946   writes a handle for the newly created linear expression at address \p ple.
947 */
948 int
949 ppl_new_Linear_Expression_from_Constraint
950 PPL_PROTO((ppl_Linear_Expression_t* ple, ppl_const_Constraint_t c));
951 
952 /*! \relates ppl_Linear_Expression_tag \brief
953   Builds a linear expression corresponding to generator \p g;
954   writes a handle for the newly created linear expression at address \p ple.
955 */
956 int
957 ppl_new_Linear_Expression_from_Generator
958 PPL_PROTO((ppl_Linear_Expression_t* ple, ppl_const_Generator_t g));
959 
960 /*! \relates ppl_Linear_Expression_tag \brief
961   Builds a linear expression corresponding to congruence \p c;
962   writes a handle for the newly created linear expression at address \p ple.
963 */
964 int
965 ppl_new_Linear_Expression_from_Congruence
966 PPL_PROTO((ppl_Linear_Expression_t* ple, ppl_const_Congruence_t c));
967 
968 /*! \relates ppl_Linear_Expression_tag \brief
969   Builds a linear expression corresponding to grid generator \p g;
970   writes a handle for the newly created linear expression at address \p ple.
971 */
972 int
973 ppl_new_Linear_Expression_from_Grid_Generator
974 PPL_PROTO((ppl_Linear_Expression_t* ple, ppl_const_Grid_Generator_t g));
975 
976 /*! \relates ppl_Linear_Expression_tag \brief
977   Assigns a copy of the linear expression \p src to \p dst.
978 */
979 int
980 ppl_assign_Linear_Expression_from_Linear_Expression
981 PPL_PROTO((ppl_Linear_Expression_t dst, ppl_const_Linear_Expression_t src));
982 
983 /*! \relates ppl_Linear_Expression_tag \brief
984   Invalidates the handle \p le: this makes sure the corresponding
985   resources will eventually be released.
986 */
987 int
988 ppl_delete_Linear_Expression PPL_PROTO((ppl_const_Linear_Expression_t le));
989 
990 /*@}*/ /* Constructors, Assignment and Destructor */
991 
992 /*! \brief \name Functions that Do Not Modify the Linear Expression */
993 /*@{*/
994 
995 /*! \relates ppl_Linear_Expression_tag \brief
996   Writes to \p m the space dimension of \p le.
997 */
998 int
999 ppl_Linear_Expression_space_dimension
1000 PPL_PROTO((ppl_const_Linear_Expression_t le, ppl_dimension_type* m));
1001 
1002 /*! \relates ppl_Linear_Expression_tag \brief
1003   Copies into \p n the coefficient of variable \p var in
1004   the linear expression \p le.
1005 */
1006 int
1007 ppl_Linear_Expression_coefficient PPL_PROTO((ppl_const_Linear_Expression_t le,
1008                                              ppl_dimension_type var,
1009                                              ppl_Coefficient_t n));
1010 
1011 /*! \relates ppl_Linear_Expression_tag \brief
1012   Copies into \p n the inhomogeneous term of linear expression \p le.
1013 */
1014 int
1015 ppl_Linear_Expression_inhomogeneous_term
1016 PPL_PROTO((ppl_const_Linear_Expression_t le, ppl_Coefficient_t n));
1017 
1018 /*! \relates ppl_Linear_Expression_tag \brief
1019   Returns a positive integer if \p le is well formed, i.e., if it
1020   satisfies all its implementation invariants; returns 0 and perhaps
1021   makes some noise if \p le is broken.  Useful for debugging purposes.
1022 */
1023 int
1024 ppl_Linear_Expression_OK PPL_PROTO((ppl_const_Linear_Expression_t le));
1025 
1026 /*! \relates ppl_Linear_Expression_tag \brief
1027     Returns <CODE>true</CODE> if and only if \p *this is \f$0\f$.
1028 */
1029 int
1030 ppl_Linear_Expression_is_zero PPL_PROTO((ppl_const_Linear_Expression_t le));
1031 
1032 /*! \relates ppl_Linear_Expression_tag \brief
1033     Returns <CODE>true</CODE> if and only if all the homogeneous
1034     terms of \p *this are \f$0\f$.
1035 */
1036 int
1037 ppl_Linear_Expression_all_homogeneous_terms_are_zero
1038 PPL_PROTO((ppl_const_Linear_Expression_t le));
1039 
1040 /*@}*/ /* Functions that Do Not Modify the Linear Expression */
1041 
1042 /*! \brief \name Functions that May Modify the Linear Expression */
1043 /*@{*/
1044 
1045 /*! \relates ppl_Linear_Expression_tag \brief
1046   Adds \p n to the coefficient of variable \p var in the linear
1047   expression \p le.  The space dimension is set to be the maximum
1048   between \p var + 1 and the old space dimension.
1049 */
1050 int
1051 ppl_Linear_Expression_add_to_coefficient
1052 PPL_PROTO((ppl_Linear_Expression_t le,
1053            ppl_dimension_type var,
1054            ppl_const_Coefficient_t n));
1055 
1056 /*! \relates ppl_Linear_Expression_tag \brief
1057   Adds \p n to the inhomogeneous term of the linear expression \p le.
1058 */
1059 int
1060 ppl_Linear_Expression_add_to_inhomogeneous
1061 PPL_PROTO((ppl_Linear_Expression_t le, ppl_const_Coefficient_t n));
1062 
1063 /*! \relates ppl_Linear_Expression_tag \brief
1064   Adds the linear expression \p src to \p dst.
1065 */
1066 int
1067 ppl_add_Linear_Expression_to_Linear_Expression
1068 PPL_PROTO((ppl_Linear_Expression_t dst, ppl_const_Linear_Expression_t src));
1069 
1070 /*! \relates ppl_Linear_Expression_tag \brief
1071   Subtracts the linear expression \p src from \p dst.
1072 */
1073 int
1074 ppl_subtract_Linear_Expression_from_Linear_Expression
1075 PPL_PROTO((ppl_Linear_Expression_t dst, ppl_const_Linear_Expression_t src));
1076 
1077 /*! \relates ppl_Linear_Expression_tag \brief
1078   Multiply the linear expression \p dst by \p n.
1079 */
1080 int
1081 ppl_multiply_Linear_Expression_by_Coefficient
1082 PPL_PROTO((ppl_Linear_Expression_t le, ppl_const_Coefficient_t n));
1083 
1084 /*@}*/ /* Functions that May Modify the Linear Expression */
1085 
1086 PPL_DECLARE_AND_DOCUMENT_IO_FUNCTIONS(Linear_Expression)
1087 
1088 /*! \brief \ingroup Datatypes
1089   Describes the relations represented by a constraint.
1090 */
1091 enum ppl_enum_Constraint_Type {
1092   /*! The constraint is of the form \f$e < 0\f$. */
1093   PPL_CONSTRAINT_TYPE_LESS_THAN,
1094   /*! The constraint is of the form \f$e \leq 0\f$. */
1095   PPL_CONSTRAINT_TYPE_LESS_OR_EQUAL,
1096   /*! The constraint is of the form \f$e = 0\f$. */
1097   PPL_CONSTRAINT_TYPE_EQUAL,
1098   /*! The constraint is of the form \f$e \geq 0\f$. */
1099   PPL_CONSTRAINT_TYPE_GREATER_OR_EQUAL,
1100   /*! The constraint is of the form \f$e > 0\f$. */
1101   PPL_CONSTRAINT_TYPE_GREATER_THAN
1102 };
1103 
1104 /*! \brief \name Constructors, Assignment and Destructor */
1105 /*@{*/
1106 
1107 /*! \relates ppl_Constraint_tag \brief
1108   Creates the new constraint `\p le \p rel 0' and writes a handle for
1109   it at address \p pc.  The space dimension of the new constraint is
1110   equal to the space dimension of \p le.
1111 */
1112 int
1113 ppl_new_Constraint PPL_PROTO((ppl_Constraint_t* pc,
1114                               ppl_const_Linear_Expression_t le,
1115                               enum ppl_enum_Constraint_Type rel));
1116 
1117 /*! \relates ppl_Constraint_tag \brief
1118   Creates the unsatisfiable (zero-dimension space) constraint \f$0 = 1\f$
1119   and writes a handle for it at address \p pc.
1120 */
1121 int
1122 ppl_new_Constraint_zero_dim_false PPL_PROTO((ppl_Constraint_t* pc));
1123 
1124 /*! \relates ppl_Constraint_tag \brief
1125   Creates the true (zero-dimension space) constraint \f$0 \leq 1\f$,
1126   also known as <EM>positivity constraint</EM>.
1127   A handle for the newly created constraint is written at address \p pc.
1128 */
1129 int
1130 ppl_new_Constraint_zero_dim_positivity PPL_PROTO((ppl_Constraint_t* pc));
1131 
1132 /*! \relates ppl_Constraint_tag \brief
1133   Builds a constraint that is a copy of \p c; writes a handle
1134   for the newly created constraint at address \p pc.
1135 */
1136 int
1137 ppl_new_Constraint_from_Constraint PPL_PROTO((ppl_Constraint_t* pc,
1138                                               ppl_const_Constraint_t c));
1139 
1140 /*! \relates ppl_Constraint_tag \brief
1141   Assigns a copy of the constraint \p src to \p dst.
1142 */
1143 int
1144 ppl_assign_Constraint_from_Constraint PPL_PROTO((ppl_Constraint_t dst,
1145                                                  ppl_const_Constraint_t src));
1146 
1147 /*! \relates ppl_Constraint_tag \brief
1148   Invalidates the handle \p c: this makes sure the corresponding
1149   resources will eventually be released.
1150 */
1151 int
1152 ppl_delete_Constraint PPL_PROTO((ppl_const_Constraint_t c));
1153 
1154 /*@}*/ /* Constructors, Assignment and Destructor */
1155 
1156 /*! \brief \name Functions that Do Not Modify the Constraint */
1157 /*@{*/
1158 
1159 /*! \relates ppl_Constraint_tag \brief
1160   Writes to \p m the space dimension of \p c.
1161 */
1162 int
1163 ppl_Constraint_space_dimension PPL_PROTO((ppl_const_Constraint_t c,
1164                                           ppl_dimension_type* m));
1165 
1166 /*! \relates ppl_Constraint_tag \brief
1167   Returns the type of constraint \p c.
1168 */
1169 int
1170 ppl_Constraint_type PPL_PROTO((ppl_const_Constraint_t c));
1171 
1172 /*! \relates ppl_Constraint_tag \brief
1173   Copies into \p n the coefficient of variable \p var in
1174   constraint \p c.
1175 */
1176 int
1177 ppl_Constraint_coefficient PPL_PROTO((ppl_const_Constraint_t c,
1178                                       ppl_dimension_type var,
1179                                       ppl_Coefficient_t n));
1180 
1181 /*! \relates ppl_Constraint_tag \brief
1182   Copies into \p n the inhomogeneous term of constraint \p c.
1183 */
1184 int
1185 ppl_Constraint_inhomogeneous_term PPL_PROTO((ppl_const_Constraint_t c,
1186                                              ppl_Coefficient_t n));
1187 
1188 /*! \relates ppl_Constraint_tag \brief
1189   Returns a positive integer if \p c is well formed, i.e., if it
1190   satisfies all its implementation invariants; returns 0 and perhaps
1191   makes some noise if \p c is broken.  Useful for debugging purposes.
1192 */
1193 int
1194 ppl_Constraint_OK PPL_PROTO((ppl_const_Constraint_t c));
1195 
1196 /*@}*/ /* Functions that Do Not Modify the Constraint */
1197 
1198 PPL_DECLARE_AND_DOCUMENT_IO_FUNCTIONS(Constraint)
1199 
1200 
1201 /*! \brief \name Constructors, Assignment and Destructor */
1202 /*@{*/
1203 
1204 /*! \relates ppl_Constraint_System_tag \brief
1205   Builds an empty system of constraints and writes a handle to it at
1206   address \p pcs.
1207 */
1208 int
1209 ppl_new_Constraint_System PPL_PROTO((ppl_Constraint_System_t* pcs));
1210 
1211 /*! \relates ppl_Constraint_System_tag \brief
1212   Builds a zero-dimensional, unsatisfiable constraint system and
1213   writes a handle to it at address \p pcs.
1214 */
1215 int
1216 ppl_new_Constraint_System_zero_dim_empty
1217 PPL_PROTO((ppl_Constraint_System_t* pcs));
1218 
1219 /*! \relates ppl_Constraint_System_tag \brief
1220   Builds the singleton constraint system containing only a copy of
1221   constraint \p c; writes a handle for the newly created system at
1222   address \p pcs.
1223 */
1224 int
1225 ppl_new_Constraint_System_from_Constraint
1226 PPL_PROTO((ppl_Constraint_System_t* pcs, ppl_const_Constraint_t c));
1227 
1228 /*! \relates ppl_Constraint_System_tag \brief
1229   Builds a constraint system that is a copy of \p cs; writes a handle
1230   for the newly created system at address \p pcs.
1231 */
1232 int
1233 ppl_new_Constraint_System_from_Constraint_System
1234 PPL_PROTO((ppl_Constraint_System_t* pcs, ppl_const_Constraint_System_t cs));
1235 
1236 /*! \relates ppl_Constraint_System_tag \brief
1237   Assigns a copy of the constraint system \p src to \p dst.
1238 */
1239 int
1240 ppl_assign_Constraint_System_from_Constraint_System
1241 PPL_PROTO((ppl_Constraint_System_t dst, ppl_const_Constraint_System_t src));
1242 
1243 /*! \relates ppl_Constraint_System_tag \brief
1244   Invalidates the handle \p cs: this makes sure the corresponding
1245   resources will eventually be released.
1246 */
1247 int
1248 ppl_delete_Constraint_System PPL_PROTO((ppl_const_Constraint_System_t cs));
1249 
1250 /*@}*/ /* Constructors, Assignment and Destructor */
1251 
1252 /*! \brief \name Functions that Do Not Modify the Constraint System */
1253 /*@{*/
1254 
1255 /*! \relates ppl_Constraint_System_tag \brief
1256   Writes to \p m the dimension of the vector space enclosing \p cs.
1257 */
1258 int
1259 ppl_Constraint_System_space_dimension
1260 PPL_PROTO((ppl_const_Constraint_System_t cs, ppl_dimension_type* m));
1261 
1262 /*! \relates ppl_Constraint_System_tag \brief
1263   Returns a positive integer if \p cs contains no (non-trivial) constraint;
1264   returns 0 otherwise.
1265 */
1266 int
1267 ppl_Constraint_System_empty
1268 PPL_PROTO((ppl_const_Constraint_System_t cs));
1269 
1270 /*! \relates ppl_Constraint_System_tag \brief
1271   Returns a positive integer if \p cs contains any (non-trivial) strict
1272   inequality; returns 0 otherwise.
1273 */
1274 int
1275 ppl_Constraint_System_has_strict_inequalities
1276 PPL_PROTO((ppl_const_Constraint_System_t cs));
1277 
1278 /*! \relates ppl_Constraint_System_tag \brief
1279   Assigns to \p cit a const iterator "pointing" to the beginning of
1280   the constraint system \p cs.
1281 */
1282 int
1283 ppl_Constraint_System_begin
1284 PPL_PROTO((ppl_const_Constraint_System_t cs,
1285            ppl_Constraint_System_const_iterator_t cit));
1286 
1287 /*! \relates ppl_Constraint_System_tag \brief
1288   Assigns to \p cit a const iterator "pointing" past the end of the
1289   constraint system \p cs.
1290 */
1291 int
1292 ppl_Constraint_System_end
1293 PPL_PROTO((ppl_const_Constraint_System_t cs,
1294            ppl_Constraint_System_const_iterator_t cit));
1295 
1296 /*! \relates ppl_Constraint_System_tag \brief
1297   Returns a positive integer if \p cs is well formed, i.e., if it
1298   satisfies all its implementation invariants; returns 0 and perhaps
1299   makes some noise if \p cs is broken.  Useful for debugging purposes.
1300 */
1301 int
1302 ppl_Constraint_System_OK PPL_PROTO((ppl_const_Constraint_System_t cs));
1303 
1304 /*@}*/ /* Functions that Do Not Modify the Constraint System */
1305 
1306 /*! \brief \name Functions that May Modify the Constraint System */
1307 /*@{*/
1308 
1309 /*! \relates ppl_Constraint_System_tag \brief
1310   Removes all the constraints from the constraint system \p cs
1311   and sets its space dimension to 0.
1312 */
1313 int
1314 ppl_Constraint_System_clear PPL_PROTO((ppl_Constraint_System_t cs));
1315 
1316 /*! \relates ppl_Constraint_System_tag \brief
1317   Inserts a copy of the constraint \p c into \p cs; the space
1318   dimension is increased, if necessary.
1319 */
1320 int
1321 ppl_Constraint_System_insert_Constraint PPL_PROTO((ppl_Constraint_System_t cs,
1322                                                    ppl_const_Constraint_t c));
1323 
1324 /*@}*/ /* Functions that May Modify the Constraint System */
1325 
1326 PPL_DECLARE_AND_DOCUMENT_IO_FUNCTIONS(Constraint_System)
1327 
1328 
1329 /*! \brief \name Constructors, Assignment and Destructor */
1330 /*@{*/
1331 
1332 /*! \relates ppl_Constraint_System_const_iterator_tag \brief
1333   Builds a new `const iterator' and writes a handle to it at address
1334   \p pcit.
1335 */
1336 int
1337 ppl_new_Constraint_System_const_iterator
1338 PPL_PROTO((ppl_Constraint_System_const_iterator_t* pcit));
1339 
1340 /*! \relates ppl_Constraint_System_const_iterator_tag \brief
1341   Builds a const iterator that is a copy of \p cit; writes a
1342   handle for the newly created const iterator at address \p pcit.
1343 */
1344 int
1345 ppl_new_Constraint_System_const_iterator_from_Constraint_System_const_iterator
1346 PPL_PROTO((ppl_Constraint_System_const_iterator_t* pcit,
1347            ppl_const_Constraint_System_const_iterator_t cit));
1348 
1349 /*! \relates ppl_Constraint_System_const_iterator_tag \brief
1350   Assigns a copy of the const iterator \p src to \p dst.
1351 */
1352 int
1353 ppl_assign_Constraint_System_const_iterator_from_Constraint_System_const_iterator
1354 PPL_PROTO((ppl_Constraint_System_const_iterator_t dst,
1355            ppl_const_Constraint_System_const_iterator_t src));
1356 
1357 /*! \relates ppl_Constraint_System_const_iterator_tag \brief
1358   Invalidates the handle \p cit: this makes sure the corresponding
1359   resources will eventually be released.
1360 */
1361 int
1362 ppl_delete_Constraint_System_const_iterator
1363 PPL_PROTO((ppl_const_Constraint_System_const_iterator_t cit));
1364 
1365 /*@}*/ /* Constructors, Assignment and Destructor */
1366 
1367 /*! \brief \name Dereferencing, Incrementing and Equality Testing */
1368 /*@{*/
1369 
1370 /*! \relates ppl_Constraint_System_const_iterator_tag \brief
1371   Dereference \p cit writing a const handle to the resulting
1372   constraint at address \p pc.
1373 */
1374 int
1375 ppl_Constraint_System_const_iterator_dereference
1376 PPL_PROTO((ppl_const_Constraint_System_const_iterator_t cit,
1377            ppl_const_Constraint_t* pc));
1378 
1379 /*! \relates ppl_Constraint_System_const_iterator_tag \brief
1380   Increment \p cit so that it "points" to the next constraint.
1381 */
1382 int
1383 ppl_Constraint_System_const_iterator_increment
1384 PPL_PROTO((ppl_Constraint_System_const_iterator_t cit));
1385 
1386 /*! \relates ppl_Constraint_System_const_iterator_tag \brief
1387   Returns a positive integer if the iterators corresponding to \p x and
1388   \p y are equal; returns 0 if they are different.
1389 */
1390 int
1391 ppl_Constraint_System_const_iterator_equal_test
1392 PPL_PROTO((ppl_const_Constraint_System_const_iterator_t x,
1393            ppl_const_Constraint_System_const_iterator_t y));
1394 
1395 /*@}*/ /* Dereferencing, Incrementing and Equality Testing */
1396 
1397 
1398 /*! \brief \ingroup Datatypes
1399   Describes the different kinds of generators.
1400 */
1401 enum ppl_enum_Generator_Type {
1402   /*! The generator is a line. */
1403   PPL_GENERATOR_TYPE_LINE,
1404   /*! The generator is a ray. */
1405   PPL_GENERATOR_TYPE_RAY,
1406   /*! The generator is a point. */
1407   PPL_GENERATOR_TYPE_POINT,
1408   /*! The generator is a closure point. */
1409   PPL_GENERATOR_TYPE_CLOSURE_POINT
1410 };
1411 
1412 /*! \brief \name Constructors, Assignment and Destructor */
1413 /*@{*/
1414 
1415 /*! \relates ppl_Generator_tag \brief
1416   Creates a new generator of direction \p le and type \p t.  If the
1417   generator to be created is a point or a closure point, the divisor
1418   \p d is applied to \p le.  For other types of generators \p d is
1419   simply disregarded.  A handle for the new generator is written at
1420   address \p pg.  The space dimension of the new generator is equal to
1421   the space dimension of \p le.
1422 */
1423 int
1424 ppl_new_Generator PPL_PROTO((ppl_Generator_t* pg,
1425                              ppl_const_Linear_Expression_t le,
1426                              enum ppl_enum_Generator_Type t,
1427                              ppl_const_Coefficient_t d));
1428 
1429 /*! \relates ppl_Generator_tag \brief
1430   Creates the point that is the origin of the zero-dimensional space
1431   \f$\Rset^0\f$.  Writes a handle for the new generator at address
1432   \p pg.
1433 */
1434 int
1435 ppl_new_Generator_zero_dim_point PPL_PROTO((ppl_Generator_t* pg));
1436 
1437 /*! \relates ppl_Generator_tag \brief
1438   Creates, as a closure point, the point that is the origin of the
1439   zero-dimensional space \f$\Rset^0\f$.  Writes a handle for the new
1440   generator at address \p pg.
1441 */
1442 int
1443 ppl_new_Generator_zero_dim_closure_point PPL_PROTO((ppl_Generator_t* pg));
1444 
1445 /*! \relates ppl_Generator_tag \brief
1446   Builds a generator that is a copy of \p g; writes a handle
1447   for the newly created generator at address \p pg.
1448 */
1449 int
1450 ppl_new_Generator_from_Generator PPL_PROTO((ppl_Generator_t* pg,
1451                                             ppl_const_Generator_t g));
1452 
1453 /*! \relates ppl_Generator_tag \brief
1454   Assigns a copy of the generator \p src to \p dst.
1455 */
1456 int
1457 ppl_assign_Generator_from_Generator PPL_PROTO((ppl_Generator_t dst,
1458                                                ppl_const_Generator_t src));
1459 
1460 /*! \relates ppl_Generator_tag \brief
1461   Invalidates the handle \p g: this makes sure the corresponding
1462   resources will eventually be released.
1463 */
1464 int
1465 ppl_delete_Generator PPL_PROTO((ppl_const_Generator_t g));
1466 
1467 /*@}*/ /* Constructors, Assignment and Destructor */
1468 
1469 /*! \brief \name Functions that Do Not Modify the Generator */
1470 /*@{*/
1471 
1472 /*! \relates ppl_Generator_tag \brief
1473   Writes to \p m the space dimension of \p g.
1474 */
1475 int
1476 ppl_Generator_space_dimension PPL_PROTO((ppl_const_Generator_t g,
1477                                          ppl_dimension_type* m));
1478 
1479 /*! \relates ppl_Generator_tag \brief
1480   Returns the type of generator \p g.
1481 */
1482 int
1483 ppl_Generator_type PPL_PROTO((ppl_const_Generator_t g));
1484 
1485 /*! \relates ppl_Generator_tag \brief
1486   Copies into \p n the coefficient of variable \p var in generator \p g.
1487 */
1488 int
1489 ppl_Generator_coefficient PPL_PROTO((ppl_const_Generator_t g,
1490                                      ppl_dimension_type var,
1491                                      ppl_Coefficient_t n));
1492 
1493 /*! \relates ppl_Generator_tag \brief
1494   If \p g is a point or a closure point assigns its divisor to \p n.
1495 */
1496 int
1497 ppl_Generator_divisor PPL_PROTO((ppl_const_Generator_t g,
1498                                  ppl_Coefficient_t n));
1499 
1500 /*! \relates ppl_Generator_tag \brief
1501   Returns a positive integer if \p g is well formed, i.e., if it
1502   satisfies all its implementation invariants; returns 0 and perhaps
1503   makes some noise if \p g is broken.  Useful for debugging purposes.
1504 */
1505 int
1506 ppl_Generator_OK PPL_PROTO((ppl_const_Generator_t g));
1507 
1508 /*@}*/ /* Functions that Do Not Modify the Generator */
1509 
1510 PPL_DECLARE_AND_DOCUMENT_IO_FUNCTIONS(Generator)
1511 
1512 
1513 /*! \brief \name Constructors, Assignment and Destructor */
1514 /*@{*/
1515 
1516 /*! \relates ppl_Generator_System_tag \brief
1517   Builds an empty system of generators and writes a handle to it at
1518   address \p pgs.
1519 */
1520 int
1521 ppl_new_Generator_System PPL_PROTO((ppl_Generator_System_t* pgs));
1522 
1523 /*
1524   Creates the universe zero-dimensional system of generators (i.e.,
1525   containing the origin only).  Writes a handle to the new system at
1526   address \p pgs.
1527 */
1528 int
1529 ppl_new_Generator_System_zero_dim_univ
1530 PPL_PROTO((ppl_Generator_System_t* pgs));
1531 
1532 /*! \relates ppl_Generator_System_tag \brief
1533   Builds the singleton generator system containing only a copy of
1534   generator \p g; writes a handle for the newly created system at
1535   address \p pgs.
1536 */
1537 int
1538 ppl_new_Generator_System_from_Generator PPL_PROTO((ppl_Generator_System_t* pgs,
1539                                                    ppl_const_Generator_t g));
1540 
1541 /*! \relates ppl_Generator_System_tag \brief
1542   Builds a generator system that is a copy of \p gs; writes a handle
1543   for the newly created system at address \p pgs.
1544 */
1545 int
1546 ppl_new_Generator_System_from_Generator_System
1547 PPL_PROTO((ppl_Generator_System_t* pgs, ppl_const_Generator_System_t gs));
1548 
1549 /*! \relates ppl_Generator_System_tag \brief
1550   Assigns a copy of the generator system \p src to \p dst.
1551 */
1552 int
1553 ppl_assign_Generator_System_from_Generator_System
1554 PPL_PROTO((ppl_Generator_System_t dst, ppl_const_Generator_System_t src));
1555 
1556 /*! \relates ppl_Generator_System_tag \brief
1557   Invalidates the handle \p gs: this makes sure the corresponding
1558   resources will eventually be released.
1559 */
1560 int
1561 ppl_delete_Generator_System PPL_PROTO((ppl_const_Generator_System_t gs));
1562 
1563 /*@}*/ /* Constructors, Assignment and Destructor */
1564 
1565 /*! \brief \name Functions that Do Not Modify the Generator System */
1566 /*@{*/
1567 
1568 /*! \relates ppl_Generator_System_tag \brief
1569   Writes to \p m the dimension of the vector space enclosing \p gs.
1570 */
1571 int
1572 ppl_Generator_System_space_dimension
1573 PPL_PROTO((ppl_const_Generator_System_t gs, ppl_dimension_type* m));
1574 
1575 /*! \relates ppl_Generator_System_tag \brief
1576   Returns a positive integer if \p gs contains no generators;
1577   returns 0 otherwise.
1578 */
1579 int
1580 ppl_Generator_System_empty
1581 PPL_PROTO((ppl_const_Generator_System_t gs));
1582 
1583 /*! \relates ppl_Generator_System_tag \brief
1584   Assigns to \p git a const iterator "pointing" to the beginning of
1585   the generator system \p gs.
1586 */
1587 int
1588 ppl_Generator_System_begin
1589 PPL_PROTO((ppl_const_Generator_System_t gs,
1590            ppl_Generator_System_const_iterator_t git));
1591 
1592 /*! \relates ppl_Generator_System_tag \brief
1593   Assigns to \p git a const iterator "pointing" past the end of the
1594   generator system \p gs.
1595 */
1596 int
1597 ppl_Generator_System_end
1598 PPL_PROTO((ppl_const_Generator_System_t gs,
1599            ppl_Generator_System_const_iterator_t git));
1600 
1601 /*! \relates ppl_Generator_System_tag \brief
1602   Returns a positive integer if \p gs is well formed, i.e., if it
1603   satisfies all its implementation invariants; returns 0 and perhaps
1604   makes some noise if \p gs is broken.  Useful for debugging purposes.
1605 */
1606 int
1607 ppl_Generator_System_OK PPL_PROTO((ppl_const_Generator_System_t gs));
1608 
1609 /*@}*/ /* Functions that Do Not Modify the Generator System */
1610 
1611 /*! \brief \name Functions that May Modify the Generator System */
1612 /*@{*/
1613 
1614 /*! \relates ppl_Generator_System_tag \brief
1615   Removes all the generators from the generator system \p gs
1616   and sets its space dimension to 0.
1617 */
1618 int
1619 ppl_Generator_System_clear PPL_PROTO((ppl_Generator_System_t gs));
1620 
1621 /*! \relates ppl_Generator_System_tag \brief
1622   Inserts a copy of the generator \p g into \p gs; the space
1623   dimension is increased, if necessary.
1624 */
1625 int
1626 ppl_Generator_System_insert_Generator PPL_PROTO((ppl_Generator_System_t gs,
1627                                                  ppl_const_Generator_t g));
1628 
1629 /*@}*/ /* Functions that May Modify the Generator System */
1630 
1631 PPL_DECLARE_AND_DOCUMENT_IO_FUNCTIONS(Generator_System)
1632 
1633 
1634 /*! \brief \name Constructors, Assignment and Destructor */
1635 /*@{*/
1636 
1637 /*! \relates ppl_Generator_System_const_iterator_tag \brief
1638   Builds a new `const iterator' and writes a handle to it at address
1639   \p pgit.
1640 */
1641 int
1642 ppl_new_Generator_System_const_iterator
1643 PPL_PROTO((ppl_Generator_System_const_iterator_t* pgit));
1644 
1645 /*! \relates ppl_Generator_System_const_iterator_tag \brief
1646   Builds a const iterator that is a copy of \p git; writes a
1647   handle for the newly created const iterator at address \p pgit.
1648 */
1649 int
1650 ppl_new_Generator_System_const_iterator_from_Generator_System_const_iterator
1651 PPL_PROTO((ppl_Generator_System_const_iterator_t* pgit,
1652            ppl_const_Generator_System_const_iterator_t git));
1653 
1654 /*! \relates ppl_Generator_System_const_iterator_tag \brief
1655   Assigns a copy of the const iterator \p src to \p dst.
1656 */
1657 int
1658 ppl_assign_Generator_System_const_iterator_from_Generator_System_const_iterator
1659 PPL_PROTO((ppl_Generator_System_const_iterator_t dst,
1660            ppl_const_Generator_System_const_iterator_t src));
1661 
1662 /*! \relates ppl_Generator_System_const_iterator_tag \brief
1663   Invalidates the handle \p git: this makes sure the corresponding
1664   resources will eventually be released.
1665 */
1666 int
1667 ppl_delete_Generator_System_const_iterator
1668 PPL_PROTO((ppl_const_Generator_System_const_iterator_t git));
1669 
1670 /*@}*/ /* Constructors, Assignment and Destructor */
1671 
1672 /*! \brief \name Dereferencing, Incrementing and Equality Testing */
1673 /*@{*/
1674 
1675 /*! \relates ppl_Generator_System_const_iterator_tag \brief
1676   Dereference \p git writing a const handle to the resulting
1677   generator at address \p pg.
1678 */
1679 int
1680 ppl_Generator_System_const_iterator_dereference
1681 PPL_PROTO((ppl_const_Generator_System_const_iterator_t git,
1682            ppl_const_Generator_t* pg));
1683 
1684 /*! \relates ppl_Generator_System_const_iterator_tag \brief
1685   Increment \p git so that it "points" to the next generator.
1686 */
1687 int
1688 ppl_Generator_System_const_iterator_increment
1689 PPL_PROTO((ppl_Generator_System_const_iterator_t git));
1690 
1691 /*! \relates ppl_Generator_System_const_iterator_tag \brief
1692   Returns a positive integer if the iterators corresponding to \p x and
1693   \p y are equal; returns 0 if they are different.
1694 */
1695 int
1696 ppl_Generator_System_const_iterator_equal_test
1697 PPL_PROTO((ppl_const_Generator_System_const_iterator_t x,
1698            ppl_const_Generator_System_const_iterator_t y));
1699 
1700 /*@}*/ /* Dereferencing, Incrementing and Equality Testing */
1701 
1702 
1703 /*! \brief \name Constructors, Assignment and Destructor */
1704 /*@{*/
1705 
1706 /*! \relates ppl_Congruence_tag \brief
1707   Creates the new congruence \f$le = 0 \pmod{m}\f$ and writes a handle for
1708   it at address \p pc.  The space dimension of the new congruence is
1709   equal to the space dimension of \p le.
1710 */
1711 int
1712 ppl_new_Congruence PPL_PROTO((ppl_Congruence_t* pc,
1713                               ppl_const_Linear_Expression_t le,
1714                               ppl_const_Coefficient_t m));
1715 
1716 /*! \relates ppl_Congruence_tag \brief
1717   Creates the unsatisfiable (zero-dimension space) congruence
1718   \f$0 = 1 \pmod{0}\f$ and writes a handle for it at address \p pc.
1719 */
1720 int
1721 ppl_new_Congruence_zero_dim_false PPL_PROTO((ppl_Congruence_t* pc));
1722 
1723 /*! \relates ppl_Congruence_tag \brief
1724   Creates the true (zero-dimension space) congruence \f$0 = 1 \pmod{1}\f$,
1725   also known as <EM>integrality congruence</EM>.
1726   A handle for the newly created congruence is written at address \p pc.
1727 */
1728 int
1729 ppl_new_Congruence_zero_dim_integrality PPL_PROTO((ppl_Congruence_t* pc));
1730 
1731 /*! \relates ppl_Congruence_tag \brief
1732   Builds a congruence that is a copy of \p c; writes a handle
1733   for the newly created congruence at address \p pc.
1734 */
1735 int
1736 ppl_new_Congruence_from_Congruence PPL_PROTO((ppl_Congruence_t* pc,
1737                                               ppl_const_Congruence_t c));
1738 
1739 /*! \relates ppl_Congruence_tag \brief
1740   Assigns a copy of the congruence \p src to \p dst.
1741 */
1742 int
1743 ppl_assign_Congruence_from_Congruence PPL_PROTO((ppl_Congruence_t dst,
1744                                                  ppl_const_Congruence_t src));
1745 
1746 /*! \relates ppl_Congruence_tag \brief
1747   Invalidates the handle \p c: this makes sure the corresponding
1748   resources will eventually be released.
1749 */
1750 int
1751 ppl_delete_Congruence PPL_PROTO((ppl_const_Congruence_t c));
1752 
1753 /*@}*/ /* Constructors, Assignment and Destructor */
1754 
1755 /*! \brief \name Functions that Do Not Modify the Congruence */
1756 /*@{*/
1757 
1758 /*! \relates ppl_Congruence_tag \brief
1759   Writes to \p m the space dimension of \p c.
1760 */
1761 int
1762 ppl_Congruence_space_dimension PPL_PROTO((ppl_const_Congruence_t c,
1763                                           ppl_dimension_type* m));
1764 
1765 /*! \relates ppl_Congruence_tag \brief
1766   Copies into \p n the coefficient of variable \p var in
1767   congruence \p c.
1768 */
1769 int
1770 ppl_Congruence_coefficient PPL_PROTO((ppl_const_Congruence_t c,
1771                                       ppl_dimension_type var,
1772                                       ppl_Coefficient_t n));
1773 
1774 /*! \relates ppl_Congruence_tag \brief
1775   Copies into \p n the inhomogeneous term of congruence \p c.
1776 */
1777 int
1778 ppl_Congruence_inhomogeneous_term PPL_PROTO((ppl_const_Congruence_t c,
1779                                              ppl_Coefficient_t n));
1780 
1781 /*! \relates ppl_Congruence_tag \brief
1782   Copies into \p m the modulus of congruence \p c.
1783 */
1784 int
1785 ppl_Congruence_modulus PPL_PROTO((ppl_const_Congruence_t c,
1786                                   ppl_Coefficient_t m));
1787 
1788 /*! \relates ppl_Congruence_tag \brief
1789   Returns a positive integer if \p c is well formed, i.e., if it
1790   satisfies all its implementation invariants; returns 0 and perhaps
1791   makes some noise if \p c is broken.  Useful for debugging purposes.
1792 */
1793 int
1794 ppl_Congruence_OK PPL_PROTO((ppl_const_Congruence_t c));
1795 
1796 /*@}*/ /* Functions that Do Not Modify the Congruence */
1797 
1798 PPL_DECLARE_AND_DOCUMENT_IO_FUNCTIONS(Congruence)
1799 
1800 
1801 /*! \brief \name Constructors, Assignment and Destructor */
1802 /*@{*/
1803 
1804 /*! \relates ppl_Congruence_System_tag \brief
1805   Builds an empty system of congruences and writes a handle to it at
1806   address \p pcs.
1807 */
1808 int
1809 ppl_new_Congruence_System PPL_PROTO((ppl_Congruence_System_t* pcs));
1810 
1811 /*! \relates ppl_Congruence_System_tag \brief
1812   Builds a zero-dimensional, unsatisfiable congruence system and
1813   writes a handle to it at address \p pcs.
1814 */
1815 int
1816 ppl_new_Congruence_System_zero_dim_empty
1817 PPL_PROTO((ppl_Congruence_System_t* pcs));
1818 
1819 /*! \relates ppl_Congruence_System_tag \brief
1820   Builds the singleton congruence system containing only a copy of
1821   congruence \p c; writes a handle for the newly created system at
1822   address \p pcs.
1823 */
1824 int
1825 ppl_new_Congruence_System_from_Congruence
1826 PPL_PROTO((ppl_Congruence_System_t* pcs, ppl_const_Congruence_t c));
1827 
1828 /*! \relates ppl_Congruence_System_tag \brief
1829   Builds a congruence system that is a copy of \p cs; writes a handle
1830   for the newly created system at address \p pcs.
1831 */
1832 int
1833 ppl_new_Congruence_System_from_Congruence_System
1834 PPL_PROTO((ppl_Congruence_System_t* pcs, ppl_const_Congruence_System_t cs));
1835 
1836 /*! \relates ppl_Congruence_System_tag \brief
1837   Assigns a copy of the congruence system \p src to \p dst.
1838 */
1839 int
1840 ppl_assign_Congruence_System_from_Congruence_System
1841 PPL_PROTO((ppl_Congruence_System_t dst, ppl_const_Congruence_System_t src));
1842 
1843 /*! \relates ppl_Congruence_System_tag \brief
1844   Invalidates the handle \p cs: this makes sure the corresponding
1845   resources will eventually be released.
1846 */
1847 int
1848 ppl_delete_Congruence_System PPL_PROTO((ppl_const_Congruence_System_t cs));
1849 
1850 /*@}*/ /* Constructors, Assignment and Destructor */
1851 
1852 /*! \brief \name Functions that Do Not Modify the Congruence System */
1853 /*@{*/
1854 
1855 /*! \relates ppl_Congruence_System_tag \brief
1856   Writes to \p m the dimension of the vector space enclosing \p cs.
1857 */
1858 int
1859 ppl_Congruence_System_space_dimension
1860 PPL_PROTO((ppl_const_Congruence_System_t cs, ppl_dimension_type* m));
1861 
1862 /*! \relates ppl_Congruence_System_tag \brief
1863   Returns a positive integer if \p cs contains no (non-trivial) congruence;
1864   returns 0 otherwise.
1865 */
1866 int
1867 ppl_Congruence_System_empty
1868 PPL_PROTO((ppl_const_Congruence_System_t cs));
1869 
1870 /*! \relates ppl_Congruence_System_tag \brief
1871   Assigns to \p cit a const iterator "pointing" to the beginning of
1872   the congruence system \p cs.
1873 */
1874 int
1875 ppl_Congruence_System_begin
1876 PPL_PROTO((ppl_const_Congruence_System_t cs,
1877            ppl_Congruence_System_const_iterator_t cit));
1878 
1879 /*! \relates ppl_Congruence_System_tag \brief
1880   Assigns to \p cit a const iterator "pointing" past the end of the
1881   congruence system \p cs.
1882 */
1883 int
1884 ppl_Congruence_System_end
1885 PPL_PROTO((ppl_const_Congruence_System_t cs,
1886            ppl_Congruence_System_const_iterator_t cit));
1887 
1888 /*! \relates ppl_Congruence_System_tag \brief
1889   Returns a positive integer if \p cs is well formed, i.e., if it
1890   satisfies all its implementation invariants; returns 0 and perhaps
1891   makes some noise if \p cs is broken.  Useful for debugging purposes.
1892 */
1893 int
1894 ppl_Congruence_System_OK PPL_PROTO((ppl_const_Congruence_System_t cs));
1895 
1896 /*@}*/ /* Functions that Do Not Modify the Congruence System */
1897 
1898 /*! \brief \name Functions that May Modify the Congruence System */
1899 /*@{*/
1900 
1901 /*! \relates ppl_Congruence_System_tag \brief
1902   Removes all the congruences from the congruence system \p cs
1903   and sets its space dimension to 0.
1904 */
1905 int
1906 ppl_Congruence_System_clear PPL_PROTO((ppl_Congruence_System_t cs));
1907 
1908 /*! \relates ppl_Congruence_System_tag \brief
1909   Inserts a copy of the congruence \p c into \p cs; the space
1910   dimension is increased, if necessary.
1911 */
1912 int
1913 ppl_Congruence_System_insert_Congruence PPL_PROTO((ppl_Congruence_System_t cs,
1914                                                    ppl_const_Congruence_t c));
1915 
1916 /*@}*/ /* Functions that May Modify the Congruence System */
1917 
1918 PPL_DECLARE_AND_DOCUMENT_IO_FUNCTIONS(Congruence_System)
1919 
1920 
1921 /*! \brief \name Constructors, Assignment and Destructor */
1922 /*@{*/
1923 
1924 /*! \relates ppl_Congruence_System_const_iterator_tag \brief
1925   Builds a new `const iterator' and writes a handle to it at address
1926   \p pcit.
1927 */
1928 int
1929 ppl_new_Congruence_System_const_iterator
1930 PPL_PROTO((ppl_Congruence_System_const_iterator_t* pcit));
1931 
1932 /*! \relates ppl_Congruence_System_const_iterator_tag \brief
1933   Builds a const iterator that is a copy of \p cit; writes a
1934   handle for the newly created const iterator at address \p pcit.
1935 */
1936 int
1937 ppl_new_Congruence_System_const_iterator_from_Congruence_System_const_iterator
1938 PPL_PROTO((ppl_Congruence_System_const_iterator_t* pcit,
1939            ppl_const_Congruence_System_const_iterator_t cit));
1940 
1941 /*! \relates ppl_Congruence_System_const_iterator_tag \brief
1942   Assigns a copy of the const iterator \p src to \p dst.
1943 */
1944 int
1945 ppl_assign_Congruence_System_const_iterator_from_Congruence_System_const_iterator
1946 PPL_PROTO((ppl_Congruence_System_const_iterator_t dst,
1947            ppl_const_Congruence_System_const_iterator_t src));
1948 
1949 /*! \relates ppl_Congruence_System_const_iterator_tag \brief
1950   Invalidates the handle \p cit: this makes sure the corresponding
1951   resources will eventually be released.
1952 */
1953 int
1954 ppl_delete_Congruence_System_const_iterator
1955 PPL_PROTO((ppl_const_Congruence_System_const_iterator_t cit));
1956 
1957 /*@}*/ /* Constructors, Assignment and Destructor */
1958 
1959 /*! \brief \name Dereferencing, Incrementing and Equality Testing */
1960 /*@{*/
1961 
1962 /*! \relates ppl_Congruence_System_const_iterator_tag \brief
1963   Dereference \p cit writing a const handle to the resulting
1964   congruence at address \p pc.
1965 */
1966 int
1967 ppl_Congruence_System_const_iterator_dereference
1968 PPL_PROTO((ppl_const_Congruence_System_const_iterator_t cit,
1969            ppl_const_Congruence_t* pc));
1970 
1971 /*! \relates ppl_Congruence_System_const_iterator_tag \brief
1972   Increment \p cit so that it "points" to the next congruence.
1973 */
1974 int
1975 ppl_Congruence_System_const_iterator_increment
1976 PPL_PROTO((ppl_Congruence_System_const_iterator_t cit));
1977 
1978 /*! \relates ppl_Congruence_System_const_iterator_tag \brief
1979   Returns a positive integer if the iterators corresponding to \p x and
1980   \p y are equal; returns 0 if they are different.
1981 */
1982 int
1983 ppl_Congruence_System_const_iterator_equal_test
1984 PPL_PROTO((ppl_const_Congruence_System_const_iterator_t x,
1985            ppl_const_Congruence_System_const_iterator_t y));
1986 
1987 /*@}*/ /* Dereferencing, Incrementing and Equality Testing */
1988 
1989 
1990 /*! \brief \ingroup Datatypes
1991   Describes the different kinds of grid generators.
1992 */
1993 enum ppl_enum_Grid_Generator_Type {
1994   /*! The grid generator is a line. */
1995   PPL_GRID_GENERATOR_TYPE_LINE,
1996   /*! The grid generator is a parameter. */
1997   PPL_GRID_GENERATOR_TYPE_PARAMETER,
1998   /*! The grid generator is a point. */
1999   PPL_GRID_GENERATOR_TYPE_POINT
2000 };
2001 
2002 /*! \brief \name Constructors, Assignment and Destructor */
2003 /*@{*/
2004 
2005 /*! \relates ppl_Grid_Generator_tag \brief
2006   Creates a new grid generator of direction \p le and type \p t.  If the
2007   grid generator to be created is a point or a parameter, the divisor
2008   \p d is applied to \p le.  If it is a line, \p d is simply disregarded.
2009   A handle for the new grid generator is written at address \p pg.
2010   The space dimension of the new grid generator is equal to the space
2011   dimension of \p le.
2012 */
2013 int
2014 ppl_new_Grid_Generator PPL_PROTO((ppl_Grid_Generator_t* pg,
2015                                   ppl_const_Linear_Expression_t le,
2016                                   enum ppl_enum_Grid_Generator_Type t,
2017                                   ppl_const_Coefficient_t d));
2018 
2019 /*! \relates ppl_Grid_Generator_tag \brief
2020   Creates the point that is the origin of the zero-dimensional space
2021   \f$\Rset^0\f$.  Writes a handle for the new grid generator at address
2022   \p pg.
2023 */
2024 int
2025 ppl_new_Grid_Generator_zero_dim_point PPL_PROTO((ppl_Grid_Generator_t* pg));
2026 
2027 /*! \relates ppl_Grid_Generator_tag \brief
2028   Builds a grid generator that is a copy of \p g; writes a handle
2029   for the newly created grid generator at address \p pg.
2030 */
2031 int
2032 ppl_new_Grid_Generator_from_Grid_Generator
2033 PPL_PROTO((ppl_Grid_Generator_t* pg, ppl_const_Grid_Generator_t g));
2034 
2035 /*! \relates ppl_Grid_Generator_tag \brief
2036   Assigns a copy of the grid generator \p src to \p dst.
2037 */
2038 int
2039 ppl_assign_Grid_Generator_from_Grid_Generator
2040 PPL_PROTO((ppl_Grid_Generator_t dst,
2041            ppl_const_Grid_Generator_t src));
2042 
2043 /*! \relates ppl_Grid_Generator_tag \brief
2044   Invalidates the handle \p g: this makes sure the corresponding
2045   resources will eventually be released.
2046 */
2047 int
2048 ppl_delete_Grid_Generator PPL_PROTO((ppl_const_Grid_Generator_t g));
2049 
2050 /*@}*/ /* Constructors, Assignment and Destructor */
2051 
2052 /*! \brief \name Functions that Do Not Modify the Grid Generator */
2053 /*@{*/
2054 
2055 /*! \relates ppl_Grid_Generator_tag \brief
2056   Writes to \p m the space dimension of \p g.
2057 */
2058 int
2059 ppl_Grid_Generator_space_dimension PPL_PROTO((ppl_const_Grid_Generator_t g,
2060                                               ppl_dimension_type* m));
2061 
2062 /*! \relates ppl_Grid_Generator_tag \brief
2063   Returns the type of grid generator \p g.
2064 */
2065 int
2066 ppl_Grid_Generator_type PPL_PROTO((ppl_const_Grid_Generator_t g));
2067 
2068 /*! \relates ppl_Grid_Generator_tag \brief
2069   Copies into \p n the coefficient of variable \p var in
2070   grid generator \p g.
2071 */
2072 int
2073 ppl_Grid_Generator_coefficient PPL_PROTO((ppl_const_Grid_Generator_t g,
2074                                           ppl_dimension_type var,
2075                                           ppl_Coefficient_t n));
2076 
2077 /*! \relates ppl_Grid_Generator_tag \brief
2078   If \p g is a point or a parameter assigns its divisor to \p n.
2079 */
2080 int
2081 ppl_Grid_Generator_divisor PPL_PROTO((ppl_const_Grid_Generator_t g,
2082                                       ppl_Coefficient_t n));
2083 
2084 /*! \relates ppl_Grid_Generator_tag \brief
2085   Returns a positive integer if \p g is well formed, i.e., if it
2086   satisfies all its implementation invariants; returns 0 and perhaps
2087   makes some noise if \p g is broken.  Useful for debugging purposes.
2088 */
2089 int
2090 ppl_Grid_Generator_OK PPL_PROTO((ppl_const_Grid_Generator_t g));
2091 
2092 /*@}*/ /* Functions that Do Not Modify the Generator */
2093 
2094 PPL_DECLARE_AND_DOCUMENT_IO_FUNCTIONS(Grid_Generator)
2095 
2096 
2097 /*! \brief \name Constructors, Assignment and Destructor */
2098 /*@{*/
2099 
2100 /*! \relates ppl_Grid_Generator_System_tag \brief
2101   Builds an empty system of grid generators and writes a handle to it at
2102   address \p pgs.
2103 */
2104 int
2105 ppl_new_Grid_Generator_System PPL_PROTO((ppl_Grid_Generator_System_t* pgs));
2106 
2107 /*
2108   Creates the universe zero-dimensional system of grid generators (i.e.,
2109   containing the origin only).  Writes a handle to the new system at
2110   address \p pgs.
2111 */
2112 int
2113 ppl_new_Grid_Generator_System_zero_dim_univ
2114 PPL_PROTO((ppl_Grid_Generator_System_t* pgs));
2115 
2116 /*! \relates ppl_Grid_Generator_System_tag \brief
2117   Builds the singleton grid generator system containing only a copy of
2118   generator \p g; writes a handle for the newly created system at
2119   address \p pgs.
2120 */
2121 int
2122 ppl_new_Grid_Generator_System_from_Grid_Generator
2123 PPL_PROTO((ppl_Grid_Generator_System_t* pgs,
2124            ppl_const_Grid_Generator_t g));
2125 
2126 /*! \relates ppl_Grid_Generator_System_tag \brief
2127   Builds a grid generator system that is a copy of \p gs; writes a handle
2128   for the newly created system at address \p pgs.
2129 */
2130 int
2131 ppl_new_Grid_Generator_System_from_Grid_Generator_System
2132 PPL_PROTO((ppl_Grid_Generator_System_t* pgs,
2133            ppl_const_Grid_Generator_System_t gs));
2134 
2135 /*! \relates ppl_Grid_Generator_System_tag \brief
2136   Assigns a copy of the grid generator system \p src to \p dst.
2137 */
2138 int
2139 ppl_assign_Grid_Generator_System_from_Grid_Generator_System
2140 PPL_PROTO((ppl_Grid_Generator_System_t dst,
2141            ppl_const_Grid_Generator_System_t src));
2142 
2143 /*! \relates ppl_Grid_Generator_System_tag \brief
2144   Invalidates the handle \p gs: this makes sure the corresponding
2145   resources will eventually be released.
2146 */
2147 int
2148 ppl_delete_Grid_Generator_System
2149 PPL_PROTO((ppl_const_Grid_Generator_System_t gs));
2150 
2151 /*@}*/ /* Constructors, Assignment and Destructor */
2152 
2153 /*! \brief \name Functions that Do Not Modify the Grid Generator System */
2154 /*@{*/
2155 
2156 /*! \relates ppl_Grid_Generator_System_tag \brief
2157   Writes to \p m the dimension of the vector space enclosing \p gs.
2158 */
2159 int
2160 ppl_Grid_Generator_System_space_dimension
2161 PPL_PROTO((ppl_const_Grid_Generator_System_t gs, ppl_dimension_type* m));
2162 
2163 /*! \relates ppl_Grid_Generator_System_tag \brief
2164   Returns a positive integer if \p gs contains no generator;
2165   returns 0 otherwise.
2166 */
2167 int
2168 ppl_Grid_Generator_System_empty
2169 PPL_PROTO((ppl_const_Grid_Generator_System_t gs));
2170 
2171 /*! \relates ppl_Grid_Generator_System_tag \brief
2172   Assigns to \p git a const iterator "pointing" to the beginning of
2173   the grid generator system \p gs.
2174 */
2175 int
2176 ppl_Grid_Generator_System_begin
2177 PPL_PROTO((ppl_const_Grid_Generator_System_t gs,
2178            ppl_Grid_Generator_System_const_iterator_t git));
2179 
2180 /*! \relates ppl_Grid_Generator_System_tag \brief
2181   Assigns to \p git a const iterator "pointing" past the end of the
2182   grid generator system \p gs.
2183 */
2184 int
2185 ppl_Grid_Generator_System_end
2186 PPL_PROTO((ppl_const_Grid_Generator_System_t gs,
2187            ppl_Grid_Generator_System_const_iterator_t git));
2188 
2189 /*! \relates ppl_Grid_Generator_System_tag \brief
2190   Returns a positive integer if \p gs is well formed, i.e., if it
2191   satisfies all its implementation invariants; returns 0 and perhaps
2192   makes some noise if \p gs is broken.  Useful for debugging purposes.
2193 */
2194 int
2195 ppl_Grid_Generator_System_OK PPL_PROTO((ppl_const_Grid_Generator_System_t gs));
2196 
2197 /*@}*/ /* Functions that Do Not Modify the Grid Generator System */
2198 
2199 /*! \brief \name Functions that May Modify the Grid Generator System */
2200 /*@{*/
2201 
2202 /*! \relates ppl_Grid_Generator_System_tag \brief
2203   Removes all the generators from the grid generator system \p gs
2204   and sets its space dimension to 0.
2205 */
2206 int
2207 ppl_Grid_Generator_System_clear PPL_PROTO((ppl_Grid_Generator_System_t gs));
2208 
2209 /*! \relates ppl_Grid_Generator_System_tag \brief
2210   Inserts a copy of the grid generator \p g into \p gs; the space
2211   dimension is increased, if necessary.
2212 */
2213 int
2214 ppl_Grid_Generator_System_insert_Grid_Generator
2215 PPL_PROTO((ppl_Grid_Generator_System_t gs,
2216            ppl_const_Grid_Generator_t g));
2217 
2218 /*@}*/ /* Functions that May Modify the Grid Generator System */
2219 
2220 PPL_DECLARE_AND_DOCUMENT_IO_FUNCTIONS(Grid_Generator_System)
2221 
2222 
2223 /*! \brief \name Constructors, Assignment and Destructor */
2224 /*@{*/
2225 
2226 /*! \relates ppl_Grid_Generator_System_const_iterator_tag \brief
2227   Builds a new `const iterator' and writes a handle to it at address
2228   \p pgit.
2229 */
2230 int
2231 ppl_new_Grid_Generator_System_const_iterator
2232 PPL_PROTO((ppl_Grid_Generator_System_const_iterator_t* pgit));
2233 
2234 /*! \relates ppl_Grid_Generator_System_const_iterator_tag \brief
2235   Builds a const iterator that is a copy of \p git; writes a
2236   handle for the newly created const iterator at address \p pgit.
2237 */
2238 int
2239 ppl_new_Grid_Generator_System_const_iterator_from_Grid_Generator_System_const_iterator
2240 PPL_PROTO((ppl_Grid_Generator_System_const_iterator_t* pgit,
2241            ppl_const_Grid_Generator_System_const_iterator_t git));
2242 
2243 /*! \relates ppl_Grid_Generator_System_const_iterator_tag \brief
2244   Assigns a copy of the const iterator \p src to \p dst.
2245 */
2246 int
2247 ppl_assign_Grid_Generator_System_const_iterator_from_Grid_Generator_System_const_iterator
2248 PPL_PROTO((ppl_Grid_Generator_System_const_iterator_t dst,
2249            ppl_const_Grid_Generator_System_const_iterator_t src));
2250 
2251 /*! \relates ppl_Grid_Generator_System_const_iterator_tag \brief
2252   Invalidates the handle \p git: this makes sure the corresponding
2253   resources will eventually be released.
2254 */
2255 int
2256 ppl_delete_Grid_Generator_System_const_iterator
2257 PPL_PROTO((ppl_const_Grid_Generator_System_const_iterator_t git));
2258 
2259 /*@}*/ /* Constructors, Assignment and Destructor */
2260 
2261 /*! \brief \name Dereferencing, Incrementing and Equality Testing */
2262 /*@{*/
2263 
2264 /*! \relates ppl_Grid_Generator_System_const_iterator_tag \brief
2265   Dereference \p git writing a const handle to the resulting
2266   grid generator at address \p pg.
2267 */
2268 int
2269 ppl_Grid_Generator_System_const_iterator_dereference
2270 PPL_PROTO((ppl_const_Grid_Generator_System_const_iterator_t git,
2271            ppl_const_Grid_Generator_t* pg));
2272 
2273 /*! \relates ppl_Grid_Generator_System_const_iterator_tag \brief
2274   Increment \p git so that it "points" to the next grid generator.
2275 */
2276 int
2277 ppl_Grid_Generator_System_const_iterator_increment
2278 PPL_PROTO((ppl_Grid_Generator_System_const_iterator_t git));
2279 
2280 /*! \relates ppl_Grid_Generator_System_const_iterator_tag \brief
2281   Returns a positive integer if the iterators corresponding to \p x and
2282   \p y are equal; returns 0 if they are different.
2283 */
2284 int
2285 ppl_Grid_Generator_System_const_iterator_equal_test
2286 PPL_PROTO((ppl_const_Grid_Generator_System_const_iterator_t x,
2287            ppl_const_Grid_Generator_System_const_iterator_t y));
2288 
2289 /*@}*/ /* Dereferencing, Incrementing and Equality Testing */
2290 
2291 
2292 /*! \brief \ingroup Datatypes
2293   Code of the worst-case polynomial complexity class.
2294 */
2295 extern unsigned int PPL_COMPLEXITY_CLASS_POLYNOMIAL;
2296 
2297 /*! \brief \ingroup Datatypes
2298   Code of the worst-case exponential but typically polynomial
2299   complexity class.
2300 */
2301 extern unsigned int PPL_COMPLEXITY_CLASS_SIMPLEX;
2302 
2303 /*! \brief \ingroup Datatypes
2304   Code of the universal complexity class.
2305 */
2306 extern unsigned int PPL_COMPLEXITY_CLASS_ANY;
2307 
2308 /*! \brief \ingroup Datatypes
2309   Individual bit saying that the polyhedron and the set of points
2310   satisfying the constraint are disjoint.
2311 */
2312 extern unsigned int PPL_POLY_CON_RELATION_IS_DISJOINT;
2313 
2314 /*! \brief \ingroup Datatypes
2315   Individual bit saying that the polyhedron intersects the set of
2316   points satisfying the constraint, but it is not included in it.
2317 */
2318 extern unsigned int PPL_POLY_CON_RELATION_STRICTLY_INTERSECTS;
2319 
2320 /*! \brief \ingroup Datatypes
2321   Individual bit saying that the polyhedron is included in the set of
2322   points satisfying the constraint.
2323 */
2324 extern unsigned int PPL_POLY_CON_RELATION_IS_INCLUDED;
2325 
2326 /*! \brief \ingroup Datatypes
2327   Individual bit saying that the polyhedron is included in the set of
2328   points saturating the constraint.
2329 */
2330 extern unsigned int PPL_POLY_CON_RELATION_SATURATES;
2331 
2332 /*! \brief \ingroup Datatypes
2333   Individual bit saying that adding the generator would not change the
2334   polyhedron.
2335 */
2336 extern unsigned int PPL_POLY_GEN_RELATION_SUBSUMES;
2337 
2338 
2339 /*! \brief \ingroup Datatypes
2340   Widths of bounded integer types.
2341 */
2342 enum ppl_enum_Bounded_Integer_Type_Width {
2343   /*! \hideinitializer 8 bits. */
2344   PPL_BITS_8 = 8,
2345   /*! \hideinitializer 16 bits. */
2346   PPL_BITS_16 = 16,
2347   /*! \hideinitializer 32 bits. */
2348   PPL_BITS_32 = 32,
2349   /*! \hideinitializer 64 bits. */
2350   PPL_BITS_64 = 64,
2351   /*! \hideinitializer 128 bits. */
2352   PPL_BITS_128 = 128
2353 };
2354 
2355 /*! \brief \ingroup Datatypes
2356   Representation of bounded integer types.
2357 */
2358 enum ppl_enum_Bounded_Integer_Type_Representation {
2359   /*! Unsigned binary. */
2360   PPL_UNSIGNED,
2361   /*! \brief
2362     Signed binary where negative values are represented by the two's
2363     complement of the absolute value.
2364   */
2365   PPL_SIGNED_2_COMPLEMENT
2366 };
2367 
2368 /*! \brief \ingroup Datatypes
2369   Overflow behavior of bounded integer types.
2370 */
2371 enum ppl_enum_Bounded_Integer_Type_Overflow {
2372   /*! \brief
2373     On overflow, wrapping takes place.
2374 
2375     This means that, for a \f$w\f$-bit bounded integer, the computation
2376     happens modulo \f$2^w\f$.
2377   */
2378   PPL_OVERFLOW_WRAPS,
2379 
2380   /*! \brief
2381     On overflow, the result is undefined.
2382 
2383     This simply means that the result of the operation resulting in an
2384     overflow can take any value.
2385 
2386     \note
2387     Even though something more serious can happen in the system
2388     being analyzed ---due to, e.g., C's undefined behavior---, here we
2389     are only concerned with the results of arithmetic operations.
2390     It is the responsibility of the analyzer to ensure that other
2391     manifestations of undefined behavior are conservatively approximated.
2392   */
2393   PPL_OVERFLOW_UNDEFINED,
2394 
2395   /*! \brief
2396     Overflow is impossible.
2397 
2398     This is for the analysis of languages where overflow is trapped
2399     before it affects the state, for which, thus, any indication that
2400     an overflow may have affected the state is necessarily due to
2401     the imprecision of the analysis.
2402   */
2403   PPL_OVERFLOW_IMPOSSIBLE
2404 };
2405 
2406 /*! \brief \name Symbolic Constants */
2407 /*@{*/
2408 
2409 /*! \relates ppl_MIP_Problem_tag \brief
2410   Code of the "maximization" optimization mode.
2411 */
2412 extern int PPL_OPTIMIZATION_MODE_MAXIMIZATION;
2413 
2414 /*! \relates ppl_MIP_Problem_tag \brief
2415   Code of the "minimization" optimization mode.
2416 */
2417 extern int PPL_OPTIMIZATION_MODE_MINIMIZATION;
2418 
2419 /*! \relates ppl_MIP_Problem_tag \brief
2420   Code of the "unfeasible MIP problem" status.
2421 */
2422 extern int PPL_MIP_PROBLEM_STATUS_UNFEASIBLE;
2423 
2424 /*! \relates ppl_MIP_Problem_tag \brief
2425   Code of the "unbounded MIP problem" status.
2426 */
2427 extern int PPL_MIP_PROBLEM_STATUS_UNBOUNDED;
2428 
2429 /*! \relates ppl_MIP_Problem_tag \brief
2430   Code of the "optimized MIP problem" status.
2431 */
2432 extern int PPL_MIP_PROBLEM_STATUS_OPTIMIZED;
2433 
2434 /*! \relates ppl_MIP_Problem_tag \brief
2435   Code for the MIP problem's "pricing" control parameter name.
2436 */
2437 extern int PPL_MIP_PROBLEM_CONTROL_PARAMETER_NAME_PRICING;
2438 
2439 /*! \relates ppl_MIP_Problem_tag \brief
2440   Code of MIP problem's "textbook" pricing method.
2441 */
2442 extern int PPL_MIP_PROBLEM_CONTROL_PARAMETER_PRICING_TEXTBOOK;
2443 
2444 /*! \relates ppl_MIP_Problem_tag \brief
2445   Code of MIP problem's "exact steepest-edge" pricing method.
2446 */
2447 extern int PPL_MIP_PROBLEM_CONTROL_PARAMETER_PRICING_STEEPEST_EDGE_EXACT;
2448 
2449 /*! \relates ppl_MIP_Problem_tag \brief
2450   Code of MIP problem's "float steepest-edge" pricing method.
2451 */
2452 extern int PPL_MIP_PROBLEM_CONTROL_PARAMETER_PRICING_STEEPEST_EDGE_FLOAT;
2453 
2454 
2455 
2456 /*! \relates ppl_PIP_Problem_tag \brief
2457   Code of the "unfeasible PIP problem" status.
2458 */
2459 extern int PPL_PIP_PROBLEM_STATUS_UNFEASIBLE;
2460 
2461 /*! \relates ppl_PIP_Problem_tag \brief
2462   Code of the "optimized PIP problem" status.
2463 */
2464 extern int PPL_PIP_PROBLEM_STATUS_OPTIMIZED;
2465 
2466 /*! \relates ppl_PIP_Problem_tag \brief
2467   Code for the PIP problem's "cutting strategy" control parameter name.
2468 */
2469 extern int PPL_PIP_PROBLEM_CONTROL_PARAMETER_NAME_CUTTING_STRATEGY;
2470 
2471 /*! \relates ppl_PIP_Problem_tag \brief
2472   Code for the PIP problem's "pivot row strategy" control parameter name.
2473 */
2474 extern int PPL_PIP_PROBLEM_CONTROL_PARAMETER_NAME_PIVOT_ROW_STRATEGY;
2475 
2476 /*! \relates ppl_PIP_Problem_tag \brief
2477   Code of PIP problem's "first" cutting strategy.
2478 */
2479 extern int PPL_PIP_PROBLEM_CONTROL_PARAMETER_CUTTING_STRATEGY_FIRST;
2480 
2481 /*! \relates ppl_PIP_Problem_tag \brief
2482   Code of PIP problem's "deepest" cutting strategy.
2483 */
2484 extern int PPL_PIP_PROBLEM_CONTROL_PARAMETER_CUTTING_STRATEGY_DEEPEST;
2485 
2486 /*! \relates ppl_PIP_Problem_tag \brief
2487   Code of PIP problem's "all" cutting strategy.
2488 */
2489 extern int PPL_PIP_PROBLEM_CONTROL_PARAMETER_CUTTING_STRATEGY_ALL;
2490 
2491 /*! \relates ppl_PIP_Problem_tag \brief
2492   Code of PIP problem's "first" pivot row strategy.
2493 */
2494 extern int PPL_PIP_PROBLEM_CONTROL_PARAMETER_PIVOT_ROW_STRATEGY_FIRST;
2495 
2496 /*! \relates ppl_PIP_Problem_tag \brief
2497   Code of PIP problem's "max column" pivot row strategy.
2498 */
2499 extern int PPL_PIP_PROBLEM_CONTROL_PARAMETER_PIVOT_ROW_STRATEGY_MAX_COLUMN;
2500 
2501 /*@}*/ /* Symbolic Constants */
2502 
2503 /*! \brief \name Constructors, Assignment and Destructor */
2504 /*@{*/
2505 
2506 /*! \relates ppl_MIP_Problem_tag \brief
2507   Builds a trivial MIP problem of dimension \p d and writes a
2508   handle to it at address \p pmip.
2509 */
2510 int
2511 ppl_new_MIP_Problem_from_space_dimension PPL_PROTO((ppl_MIP_Problem_t* pmip,
2512                                                     ppl_dimension_type d));
2513 
2514 /*! \relates ppl_MIP_Problem_tag \brief
2515   Builds a MIP problem of space dimension \p d having feasible region \p cs,
2516   objective function \p le and optimization mode \p m; writes a handle to
2517   it at address \p pmip.
2518 */
2519 int
2520 ppl_new_MIP_Problem PPL_PROTO((ppl_MIP_Problem_t* pmip,
2521                                ppl_dimension_type d,
2522                                ppl_const_Constraint_System_t cs,
2523                                ppl_const_Linear_Expression_t le,
2524                                int m));
2525 
2526 /*! \relates ppl_MIP_Problem_tag \brief
2527   Builds a MIP problem that is a copy of \p mip; writes a handle
2528   for the newly created system at address \p pmip.
2529 */
2530 int
2531 ppl_new_MIP_Problem_from_MIP_Problem
2532 PPL_PROTO((ppl_MIP_Problem_t* pmip, ppl_const_MIP_Problem_t mip));
2533 
2534 /*! \relates ppl_MIP_Problem_tag \brief
2535   Assigns a copy of the MIP problem \p src to \p dst.
2536 */
2537 int
2538 ppl_assign_MIP_Problem_from_MIP_Problem
2539 PPL_PROTO((ppl_MIP_Problem_t dst, ppl_const_MIP_Problem_t src));
2540 
2541 /*! \relates ppl_MIP_Problem_tag \brief
2542   Invalidates the handle \p mip: this makes sure the corresponding
2543   resources will eventually be released.
2544 */
2545 int
2546 ppl_delete_MIP_Problem PPL_PROTO((ppl_const_MIP_Problem_t mip));
2547 
2548 /*@}*/ /* Constructors, Assignment and Destructor for MIP_Problem */
2549 
2550 /*! \brief \name Functions that Do Not Modify the MIP_Problem */
2551 /*@{*/
2552 
2553 /*! \relates ppl_MIP_Problem_tag \brief
2554   Writes to \p m the dimension of the vector space enclosing \p mip.
2555 */
2556 int
2557 ppl_MIP_Problem_space_dimension
2558 PPL_PROTO((ppl_const_MIP_Problem_t mip, ppl_dimension_type* m));
2559 
2560 /*! \relates ppl_MIP_Problem_tag \brief
2561   Writes to \p m the number of integer space dimensions of \p mip.
2562 */
2563 int
2564 ppl_MIP_Problem_number_of_integer_space_dimensions
2565 PPL_PROTO((ppl_const_MIP_Problem_t mip, ppl_dimension_type* m));
2566 
2567 /*! \relates ppl_MIP_Problem_tag \brief
2568   Writes in the first positions of the array \p ds all the integer space
2569   dimensions of problem \p mip. If the array is not big enough to hold
2570   all of the integer space dimensions, the behavior is undefined.
2571 */
2572 int
2573 ppl_MIP_Problem_integer_space_dimensions
2574 PPL_PROTO((ppl_const_MIP_Problem_t mip, ppl_dimension_type ds[]));
2575 
2576 /*! \relates ppl_MIP_Problem_tag \brief
2577   Writes to \p m the number of constraints defining
2578   the feasible region of \p mip.
2579 */
2580 int
2581 ppl_MIP_Problem_number_of_constraints PPL_PROTO((ppl_const_MIP_Problem_t mip,
2582                                                  ppl_dimension_type* m));
2583 
2584 /*! \relates ppl_MIP_Problem_tag \brief
2585   Writes at address \p pc a const handle to the \p i-th constraint
2586   defining the feasible region of the MIP problem \p mip
2587 */
2588 int
2589 ppl_MIP_Problem_constraint_at_index PPL_PROTO((ppl_const_MIP_Problem_t mip,
2590                                                ppl_dimension_type i,
2591                                                ppl_const_Constraint_t* pc));
2592 
2593 /*! \relates ppl_MIP_Problem_tag \brief
2594   Writes a const handle to the linear expression defining the
2595   objective function of the MIP problem \p mip at address \p ple.
2596 */
2597 int
2598 ppl_MIP_Problem_objective_function
2599 PPL_PROTO((ppl_const_MIP_Problem_t mip, ppl_const_Linear_Expression_t* ple));
2600 
2601 /*! \relates ppl_MIP_Problem_tag \brief
2602   Returns the optimization mode of the MIP problem \p mip.
2603 */
2604 int
2605 ppl_MIP_Problem_optimization_mode PPL_PROTO((ppl_const_MIP_Problem_t mip));
2606 
2607 /*! \relates ppl_MIP_Problem_tag \brief
2608   Returns a positive integer if \p mip is well formed, i.e., if it
2609   satisfies all its implementation invariants; returns 0 and perhaps
2610   makes some noise if \p mip is broken.  Useful for debugging purposes.
2611 */
2612 int
2613 ppl_MIP_Problem_OK PPL_PROTO((ppl_const_MIP_Problem_t mip));
2614 
2615 /*@}*/ /* Functions that Do Not Modify the MIP_Problem */
2616 
2617 /*! \brief \name Functions that May Modify the MIP_Problem */
2618 /*@{*/
2619 
2620 /*! \relates ppl_MIP_Problem_tag \brief
2621   Resets the MIP problem to be a trivial problem of space dimension 0.
2622 */
2623 int
2624 ppl_MIP_Problem_clear PPL_PROTO((ppl_MIP_Problem_t mip));
2625 
2626 /*! \relates ppl_MIP_Problem_tag \brief
2627   Adds \p d new dimensions to the space enclosing the MIP problem \p mip
2628   and to \p mip itself.
2629 */
2630 int
2631 ppl_MIP_Problem_add_space_dimensions_and_embed
2632 PPL_PROTO((ppl_MIP_Problem_t mip, ppl_dimension_type d));
2633 
2634 /*! \relates ppl_MIP_Problem_tag \brief
2635   Sets the space dimensions that are specified in first \p n positions
2636   of the array \p ds to be integer dimensions of problem \p mip.
2637   The presence of duplicates in \p ds is a waste but an innocuous one.
2638 */
2639 int
2640 ppl_MIP_Problem_add_to_integer_space_dimensions
2641 PPL_PROTO((ppl_MIP_Problem_t mip, ppl_dimension_type ds[], size_t n));
2642 
2643 /*! \relates ppl_MIP_Problem_tag \brief
2644   Modifies the feasible region of the MIP problem \p mip by adding a copy
2645   of the constraint \p c.
2646 */
2647 int
2648 ppl_MIP_Problem_add_constraint PPL_PROTO((ppl_MIP_Problem_t mip,
2649                                           ppl_const_Constraint_t c));
2650 
2651 /*! \relates ppl_MIP_Problem_tag \brief
2652   Modifies the feasible region of the MIP problem \p mip by adding a copy
2653   of the constraints in \p cs.
2654 */
2655 int
2656 ppl_MIP_Problem_add_constraints PPL_PROTO((ppl_MIP_Problem_t mip,
2657                                            ppl_const_Constraint_System_t cs));
2658 
2659 /*! \relates ppl_MIP_Problem_tag \brief
2660   Sets the objective function of the MIP problem \p mip to a copy of \p le.
2661 */
2662 int
2663 ppl_MIP_Problem_set_objective_function
2664 PPL_PROTO((ppl_MIP_Problem_t mip, ppl_const_Linear_Expression_t le));
2665 
2666 /*! \relates ppl_MIP_Problem_tag \brief
2667   Sets the optimization mode of the MIP problem \p mip to \p mode.
2668 */
2669 int
2670 ppl_MIP_Problem_set_optimization_mode PPL_PROTO((ppl_MIP_Problem_t mip,
2671                                                  int mode));
2672 
2673 /*@}*/ /* Functions that May Modify the MIP_Problem */
2674 
2675 /*! \brief \name Computing the Solution of the MIP_Problem */
2676 /*@{*/
2677 
2678 /*! \relates ppl_MIP_Problem_tag \brief
2679   Returns a positive integer if \p mip is satisfiable; returns 0 otherwise.
2680 */
2681 int
2682 ppl_MIP_Problem_is_satisfiable PPL_PROTO((ppl_const_MIP_Problem_t mip));
2683 
2684 /*! \relates ppl_MIP_Problem_tag \brief
2685   Solves the MIP problem \p mip, returning an exit status.
2686 
2687   \return
2688   <CODE>PPL_MIP_PROBLEM_STATUS_UNFEASIBLE</CODE> if the MIP problem
2689   is not satisfiable;
2690   <CODE>PPL_MIP_PROBLEM_STATUS_UNBOUNDED</CODE> if the MIP problem
2691   is satisfiable but there is no finite bound to the value of
2692   the objective function;
2693   <CODE>PPL_MIP_PROBLEM_STATUS_OPTIMIZED</CODE> if the MIP problem
2694   admits an optimal solution.
2695 */
2696 int
2697 ppl_MIP_Problem_solve PPL_PROTO((ppl_const_MIP_Problem_t mip));
2698 
2699 /*! \relates ppl_MIP_Problem_tag \brief
2700   Evaluates the objective function of \p mip on point \p g.
2701 
2702   \param mip
2703   The MIP problem defining the objective function;
2704 
2705   \param g
2706   The generator on which the objective function will be evaluated;
2707 
2708   \param num
2709   Will be assigned the numerator of the objective function value;
2710 
2711   \param den
2712   Will be assigned the denominator of the objective function value;
2713 */
2714 int
2715 ppl_MIP_Problem_evaluate_objective_function
2716 PPL_PROTO((ppl_const_MIP_Problem_t mip, ppl_const_Generator_t g,
2717            ppl_Coefficient_t num, ppl_Coefficient_t den));
2718 
2719 /*! \relates ppl_MIP_Problem_tag \brief
2720   Writes a const handle to a feasible point for the MIP problem \p mip
2721   at address \p pg.
2722 */
2723 int
2724 ppl_MIP_Problem_feasible_point PPL_PROTO((ppl_const_MIP_Problem_t mip,
2725                                           ppl_const_Generator_t* pg));
2726 
2727 /*! \relates ppl_MIP_Problem_tag \brief
2728   Writes a const handle to an optimizing point for the MIP problem \p mip
2729   at address \p pg.
2730 */
2731 int
2732 ppl_MIP_Problem_optimizing_point PPL_PROTO((ppl_const_MIP_Problem_t mip,
2733                                             ppl_const_Generator_t* pg));
2734 
2735 /*! \relates ppl_MIP_Problem_tag \brief
2736   Returns the optimal value for \p mip.
2737 
2738   \param mip
2739   The MIP problem;
2740 
2741   \param num
2742   Will be assigned the numerator of the optimal value;
2743 
2744   \param den
2745   Will be assigned the denominator of the optimal value.
2746 */
2747 int
2748 ppl_MIP_Problem_optimal_value
2749 PPL_PROTO((ppl_const_MIP_Problem_t mip,
2750            ppl_Coefficient_t num, ppl_Coefficient_t den));
2751 
2752 /*@}*/ /* Computing the Solution of the MIP_Problem */
2753 
2754 /*! \brief \name Querying/Setting Control Parameters */
2755 /*@{*/
2756 
2757 /*! \relates ppl_MIP_Problem_tag \brief
2758   Returns the value of control parameter \p name in problem \p mip.
2759 */
2760 int
2761 ppl_MIP_Problem_get_control_parameter
2762 PPL_PROTO((ppl_const_MIP_Problem_t mip, int name));
2763 
2764 /*! \relates ppl_MIP_Problem_tag \brief
2765   Sets control parameter \p value in problem \p mip.
2766 */
2767 int
2768 ppl_MIP_Problem_set_control_parameter
2769 PPL_PROTO((ppl_MIP_Problem_t mip, int value));
2770 
2771 /*! \relates ppl_MIP_Problem_tag \brief
2772   Writes into \p *sz the size in bytes of the memory occupied by \p mip.
2773 */
2774 int
2775 ppl_MIP_Problem_total_memory_in_bytes
2776 PPL_PROTO((ppl_const_MIP_Problem_t mip, size_t* sz));
2777 
2778 /*! \relates ppl_MIP_Problem_tag \brief
2779   Writes into \p *sz the size in bytes of the memory managed by \p mip.
2780 */
2781 int
2782 ppl_MIP_Problem_external_memory_in_bytes
2783 PPL_PROTO((ppl_const_MIP_Problem_t mip, size_t* sz));
2784 
2785 /*@}*/ /* Querying/Setting Control Parameters */
2786 
2787 
2788 /*! \brief \name Constructors, Assignment and Destructor */
2789 /*@{*/
2790 
2791 /*! \relates ppl_PIP_Problem_tag \brief
2792   Builds a trivial PIP problem of dimension \p d and writes a
2793   handle to it at address \p ppip.
2794 */
2795 int
2796 ppl_new_PIP_Problem_from_space_dimension PPL_PROTO((ppl_PIP_Problem_t* ppip,
2797                                                     ppl_dimension_type d));
2798 
2799 /*! \relates ppl_PIP_Problem_tag \brief
2800   Builds a PIP problem that is a copy of \p pip; writes a handle
2801   for the newly created problem at address \p ppip.
2802 */
2803 int
2804 ppl_new_PIP_Problem_from_PIP_Problem
2805 PPL_PROTO((ppl_PIP_Problem_t* ppip, ppl_const_PIP_Problem_t pip));
2806 
2807 /*! \relates ppl_PIP_Problem_tag \brief
2808   Assigns a copy of the PIP problem \p src to \p dst.
2809 */
2810 int
2811 ppl_assign_PIP_Problem_from_PIP_Problem
2812 PPL_PROTO((ppl_PIP_Problem_t dst, ppl_const_PIP_Problem_t src));
2813 
2814 /*! \relates ppl_PIP_Problem_tag \brief
2815   Builds a PIP problem having space dimension \p d from the sequence
2816   of constraints in the range \f$[\mathrm{first}, \mathrm{last})\f$;
2817   the \p n dimensions whose indices occur in \p ds are interpreted as
2818   parameters.
2819 */
2820 int
2821 ppl_new_PIP_Problem_from_constraints
2822 PPL_PROTO((ppl_PIP_Problem_t* ppip,
2823            ppl_dimension_type d,
2824            ppl_Constraint_System_const_iterator_t first,
2825            ppl_Constraint_System_const_iterator_t last,
2826            size_t n,
2827            ppl_dimension_type ds[]));
2828 
2829 /*! \relates ppl_PIP_Problem_tag \brief
2830   Invalidates the handle \p pip: this makes sure the corresponding
2831   resources will eventually be released.
2832 */
2833 int
2834 ppl_delete_PIP_Problem PPL_PROTO((ppl_const_PIP_Problem_t pip));
2835 
2836 /*@}*/ /* Constructors, Assignment and Destructor for PIP_Problem */
2837 
2838 /*! \brief \name Functions that Do Not Modify the PIP_Problem */
2839 /*@{*/
2840 
2841 /*! \relates ppl_PIP_Problem_tag \brief
2842   Writes to \p m the dimension of the vector space enclosing \p pip.
2843 
2844   The vector space dimensions includes both the problem variables
2845   and the problem parameters, but they do not include the artificial
2846   parameters.
2847 */
2848 int
2849 ppl_PIP_Problem_space_dimension
2850 PPL_PROTO((ppl_const_PIP_Problem_t pip, ppl_dimension_type* m));
2851 
2852 /*! \relates ppl_PIP_Problem_tag \brief
2853   Writes to \p m the number of parameter space dimensions of \p pip.
2854 */
2855 int
2856 ppl_PIP_Problem_number_of_parameter_space_dimensions
2857 PPL_PROTO((ppl_const_PIP_Problem_t pip, ppl_dimension_type* m));
2858 
2859 /*! \relates ppl_PIP_Problem_tag \brief
2860   Writes in the first positions of the array \p ds all the parameter space
2861   dimensions of problem \p pip. If the array is not big enough to hold
2862   all of the parameter space dimensions, the behavior is undefined.
2863 */
2864 int
2865 ppl_PIP_Problem_parameter_space_dimensions
2866 PPL_PROTO((ppl_const_PIP_Problem_t pip, ppl_dimension_type ds[]));
2867 
2868 /*! \relates ppl_PIP_Problem_tag \brief
2869   Writes into \p *pd the big parameter dimension of PIP problem \p pip.
2870 */
2871 int
2872 ppl_PIP_Problem_get_big_parameter_dimension
2873 PPL_PROTO((ppl_const_PIP_Problem_t pip, ppl_dimension_type* pd));
2874 
2875 /*! \relates ppl_PIP_Problem_tag \brief
2876   Writes to \p m the number of constraints defining
2877   the feasible region of \p pip.
2878 */
2879 int
2880 ppl_PIP_Problem_number_of_constraints PPL_PROTO((ppl_const_PIP_Problem_t pip,
2881                                                  ppl_dimension_type* m));
2882 
2883 /*! \relates ppl_PIP_Problem_tag \brief
2884   Writes at address \p pc a const handle to the \p i-th constraint
2885   defining the feasible region of the PIP problem \p pip
2886 */
2887 int
2888 ppl_PIP_Problem_constraint_at_index PPL_PROTO((ppl_const_PIP_Problem_t pip,
2889                                                ppl_dimension_type i,
2890                                                ppl_const_Constraint_t* pc));
2891 
2892 /*! \relates ppl_PIP_Problem_tag \brief
2893   Writes into \p *sz the size in bytes of the memory occupied by \p pip.
2894 */
2895 int
2896 ppl_PIP_Problem_total_memory_in_bytes
2897 PPL_PROTO((ppl_const_PIP_Problem_t pip, size_t* sz));
2898 
2899 /*! \relates ppl_PIP_Problem_tag \brief
2900   Writes into \p *sz the size in bytes of the memory managed by \p pip.
2901 */
2902 int
2903 ppl_PIP_Problem_external_memory_in_bytes
2904 PPL_PROTO((ppl_const_PIP_Problem_t pip, size_t* sz));
2905 
2906 /*! \relates ppl_PIP_Problem_tag \brief
2907   Returns a positive integer if \p pip is well formed, i.e., if it
2908   satisfies all its implementation invariants; returns 0 and perhaps
2909   makes some noise if \p pip is broken.  Useful for debugging purposes.
2910 */
2911 int
2912 ppl_PIP_Problem_OK PPL_PROTO((ppl_const_PIP_Problem_t pip));
2913 
2914 /*@}*/ /* Functions that Do Not Modify the PIP_Problem */
2915 
2916 /*! \brief \name Functions that May Modify the PIP_Problem */
2917 /*@{*/
2918 
2919 /*! \relates ppl_PIP_Problem_tag \brief
2920   Resets the PIP problem to be a trivial problem of space dimension 0.
2921 */
2922 int
2923 ppl_PIP_Problem_clear PPL_PROTO((ppl_PIP_Problem_t pip));
2924 
2925 /*! \relates ppl_PIP_Problem_tag \brief
2926   Adds <CODE>pip_vars + pip_params</CODE> new space dimensions
2927   and embeds the PIP problem \p pip in the new vector space.
2928 
2929   \param pip
2930   The PIP problem to be embedded in the new vector space.
2931 
2932   \param pip_vars
2933   The number of space dimensions to add that are interpreted as
2934   PIP problem variables (i.e., non parameters). These are added
2935   \e before adding the \p pip_params parameters.
2936 
2937   \param pip_params
2938   The number of space dimensions to add that are interpreted as
2939   PIP problem parameters. These are added \e after having added the
2940   \p pip_vars problem variables.
2941 
2942   The new space dimensions will be those having the highest indexes
2943   in the new PIP problem; they are initially unconstrained.
2944 */
2945 int
2946 ppl_PIP_Problem_add_space_dimensions_and_embed
2947 PPL_PROTO((ppl_PIP_Problem_t pip,
2948            ppl_dimension_type pip_vars,
2949            ppl_dimension_type pip_params));
2950 
2951 /*! \relates ppl_PIP_Problem_tag \brief
2952   Sets the space dimensions that are specified in first \p n positions
2953   of the array \p ds to be parameter dimensions of problem \p pip.
2954   The presence of duplicates in \p ds is a waste but an innocuous one.
2955 */
2956 int
2957 ppl_PIP_Problem_add_to_parameter_space_dimensions
2958 PPL_PROTO((ppl_PIP_Problem_t pip, ppl_dimension_type ds[], size_t n));
2959 
2960 /*! \relates ppl_PIP_Problem_tag \brief
2961   Sets the big parameter dimension of PIP problem \p pip to \p d.
2962 */
2963 int
2964 ppl_PIP_Problem_set_big_parameter_dimension
2965 PPL_PROTO((ppl_PIP_Problem_t pip, ppl_dimension_type d));
2966 
2967 /*! \relates ppl_PIP_Problem_tag \brief
2968   Modifies the feasible region of the PIP problem \p pip by adding a copy
2969   of the constraint \p c.
2970 */
2971 int
2972 ppl_PIP_Problem_add_constraint PPL_PROTO((ppl_PIP_Problem_t pip,
2973                                           ppl_const_Constraint_t c));
2974 
2975 /*! \relates ppl_PIP_Problem_tag \brief
2976   Modifies the feasible region of the PIP problem \p pip by adding a copy
2977   of the constraints in \p cs.
2978 */
2979 int
2980 ppl_PIP_Problem_add_constraints PPL_PROTO((ppl_PIP_Problem_t pip,
2981                                            ppl_const_Constraint_System_t cs));
2982 
2983 /*@}*/ /* Functions that May Modify the PIP_Problem */
2984 
2985 /*! \brief \name Computing and Printing the Solution of the PIP_Problem */
2986 /*@{*/
2987 
2988 /*! \relates ppl_PIP_Problem_tag \brief
2989   Returns a positive integer if \p pip is satisfiable and an optimal
2990   solution can be found; returns 0 otherwise.
2991 */
2992 int
2993 ppl_PIP_Problem_is_satisfiable PPL_PROTO((ppl_const_PIP_Problem_t pip));
2994 
2995 /*! \relates ppl_PIP_Problem_tag \brief
2996   Solves the PIP problem \p pip, returning an exit status.
2997 
2998   \return
2999   <CODE>PPL_PIP_PROBLEM_STATUS_UNFEASIBLE</CODE> if the PIP problem
3000   is not satisfiable;
3001   <CODE>PPL_PIP_PROBLEM_STATUS_OPTIMIZED</CODE> if the PIP problem
3002   admits an optimal solution.
3003 */
3004 int
3005 ppl_PIP_Problem_solve PPL_PROTO((ppl_const_PIP_Problem_t pip));
3006 
3007 /*! \relates ppl_PIP_Problem_tag \brief
3008   Writes to \p pip_tree a solution for \p pip, if it exists.
3009 */
3010 int
3011 ppl_PIP_Problem_solution PPL_PROTO((ppl_const_PIP_Problem_t pip,
3012                                     ppl_const_PIP_Tree_Node_t* pip_tree));
3013 
3014 /*! \relates ppl_PIP_Problem_tag \brief
3015   Writes to \p pip_tree an optimizing solution for \p pip, if it exists.
3016 */
3017 int
3018 ppl_PIP_Problem_optimizing_solution
3019 PPL_PROTO((ppl_const_PIP_Problem_t pip,
3020            ppl_const_PIP_Tree_Node_t* pip_tree));
3021 
3022 /*@}*/ /* Computing the Solution of the PIP_Problem */
3023 
3024 /*! \brief \name Querying/Setting Control Parameters */
3025 /*@{*/
3026 
3027 /*! \relates ppl_PIP_Problem_tag \brief
3028   Returns the value of control parameter \p name in problem \p pip.
3029 */
3030 int
3031 ppl_PIP_Problem_get_control_parameter
3032 PPL_PROTO((ppl_const_PIP_Problem_t pip, int name));
3033 
3034 /*! \relates ppl_PIP_Problem_tag \brief
3035   Sets control parameter \p value in problem \p pip.
3036 */
3037 int
3038 ppl_PIP_Problem_set_control_parameter
3039 PPL_PROTO((ppl_PIP_Problem_t pip, int value));
3040 
3041 /*@}*/ /* Querying/Setting Control Parameters */
3042 
3043 
3044 /*! \relates ppl_PIP_Tree_Node_tag \brief
3045   Writes to \p dpip_tree the solution node if \p spip_tree is
3046   a solution node, and 0 otherwise.
3047 */
3048 int
3049 ppl_PIP_Tree_Node_as_solution
3050 PPL_PROTO((ppl_const_PIP_Tree_Node_t spip_tree,
3051            ppl_const_PIP_Solution_Node_t* dpip_tree));
3052 
3053 /*! \relates ppl_PIP_Tree_Node_tag \brief
3054   Writes to \p dpip_tree the decision node if \p spip_tree
3055   is a decision node, and 0 otherwise.
3056 */
3057 int
3058 ppl_PIP_Tree_Node_as_decision
3059 PPL_PROTO((ppl_const_PIP_Tree_Node_t spip_tree,
3060            ppl_const_PIP_Decision_Node_t* dpip_tree));
3061 
3062 /*! \relates ppl_PIP_Tree_Node_tag \brief
3063   Writes to \p pcs the local system of parameter constraints
3064   at the pip tree node \p pip_tree.
3065 */
3066 int
3067 ppl_PIP_Tree_Node_get_constraints
3068 PPL_PROTO((ppl_const_PIP_Tree_Node_t pip_tree,
3069            ppl_const_Constraint_System_t* pcs));
3070 
3071 /*! \relates ppl_PIP_Tree_Node_tag \brief
3072   Returns a positive integer if \p pip_tree is well formed, i.e., if it
3073   satisfies all its implementation invariants; returns 0 and perhaps
3074   makes some noise if \p pip_tree is broken.  Useful for debugging purposes.
3075 */
3076 int
3077 ppl_PIP_Tree_Node_OK PPL_PROTO((ppl_const_PIP_Tree_Node_t pip));
3078 
3079 /*! \relates ppl_PIP_Tree_Node_tag \brief
3080   Writes to \p m the number of elements in the artificial parameter sequence
3081   in the pip tree node \p pip_tree.
3082 */
3083 int
3084 ppl_PIP_Tree_Node_number_of_artificials
3085 PPL_PROTO((ppl_const_PIP_Tree_Node_t pip_tree,
3086            ppl_dimension_type* m));
3087 
3088 /*! \relates ppl_PIP_Tree_Node_tag \brief
3089   Assigns to \p pit a const iterator "pointing" to the beginning of
3090   the artificial parameter sequence in the pip tree node \p pip_tree.
3091 */
3092 int
3093 ppl_PIP_Tree_Node_begin
3094 PPL_PROTO((ppl_const_PIP_Tree_Node_t pip_tree,
3095            ppl_Artificial_Parameter_Sequence_const_iterator_t pit));
3096 
3097 /*! \relates ppl_PIP_Tree_Node_tag \brief
3098   Assigns to \p pit a const iterator "pointing" to the end of
3099   the artificial parameter sequence in the pip tree node \p pip_tree.
3100 */
3101 int
3102 ppl_PIP_Tree_Node_end
3103 PPL_PROTO((ppl_const_PIP_Tree_Node_t pip_tree,
3104            ppl_Artificial_Parameter_Sequence_const_iterator_t pit));
3105 
3106 /*! \relates ppl_PIP_Solution_Node_tag \brief
3107   Writes to \p le a const pointer to the parametric expression of the values
3108   of variable \p var in solution node \p pip_sol.
3109 
3110   The linear expression assigned to \p le will only refer to
3111   (problem or artificial) parameters.
3112 
3113   \param pip_sol
3114   The solution tree node.
3115 
3116   \param var
3117   The variable which is queried about.
3118 
3119   \param le
3120   The returned expression for variable \p var.
3121 
3122   \return PPL_ERROR_INVALID_ARGUMENT
3123   Returned if \p var is dimension-incompatible with \p *this
3124   or if \p var is a problem parameter.
3125 */
3126 int
3127 ppl_PIP_Solution_Node_get_parametric_values
3128 PPL_PROTO((ppl_const_PIP_Solution_Node_t pip_sol,
3129            ppl_dimension_type var,
3130            ppl_const_Linear_Expression_t* le));
3131 
3132 /*! \relates ppl_PIP_Decision_Node_tag \brief
3133   Writes to \p pip_tree a const pointer to either the true branch
3134   (if \p b is not zero) or the false branch (if \p b is zero) of \p pip_dec.
3135 */
3136 int
3137 ppl_PIP_Decision_Node_get_child_node
3138 PPL_PROTO((ppl_const_PIP_Decision_Node_t pip_dec,
3139            int b,
3140            ppl_const_PIP_Tree_Node_t* pip_tree));
3141 
3142 /*! \relates ppl_Artificial_Parameter_tag \brief
3143   Copies into \p le the linear expression in artificial parameter \p ap.
3144 */
3145 int
3146 ppl_Artificial_Parameter_get_Linear_Expression
3147 PPL_PROTO((ppl_const_Artificial_Parameter_t ap,
3148            ppl_Linear_Expression_t le));
3149 
3150 /*! \relates ppl_Artificial_Parameter_tag \brief
3151   Copies into \p n the coefficient of variable \p var in
3152   the artificial parameter \p ap.
3153 */
3154 int
3155 ppl_Artificial_Parameter_coefficient
3156 PPL_PROTO((ppl_const_Artificial_Parameter_t ap,
3157            ppl_dimension_type var,
3158            ppl_Coefficient_t n));
3159 
3160 /*! \relates ppl_Artificial_Parameter_tag \brief
3161   Copies into \p n the inhomogeneous term of the artificial
3162   parameter \p ap.
3163 */
3164 int
3165 ppl_Artificial_Parameter_get_inhomogeneous_term
3166 PPL_PROTO((ppl_const_Artificial_Parameter_t ap,
3167            ppl_Coefficient_t n));
3168 
3169 /*! \relates ppl_Artificial_Parameter_tag \brief
3170   Copies into \p n the denominator in artificial parameter \p ap.
3171 */
3172 int
3173 ppl_Artificial_Parameter_denominator
3174 PPL_PROTO((ppl_const_Artificial_Parameter_t ap,
3175            ppl_Coefficient_t n));
3176 
3177 /*! \brief \name Constructors, Assignment and Destructor */
3178 /*@{*/
3179 
3180 /*! \relates ppl_Artificial_Parameter_Sequence_const_iterator_tag \brief
3181   Builds a new `const iterator' and writes a handle to it at address
3182   \p papit.
3183 */
3184 int
3185 ppl_new_Artificial_Parameter_Sequence_const_iterator
3186 PPL_PROTO((ppl_Artificial_Parameter_Sequence_const_iterator_t* papit));
3187 
3188 /*! \relates ppl_Artificial_Parameter_Sequence_const_iterator_tag \brief
3189   Builds a const iterator that is a copy of \p apit; writes a
3190   handle for the newly created const iterator at address \p papit.
3191 */
3192 int
3193 ppl_new_Artificial_Parameter_Sequence_const_iterator_from_Artificial_Parameter_Sequence_const_iterator
3194 PPL_PROTO((ppl_Artificial_Parameter_Sequence_const_iterator_t* papit,
3195            ppl_const_Artificial_Parameter_Sequence_const_iterator_t apit));
3196 
3197 /*! \relates ppl_Artificial_Parameter_Sequence_const_iterator_tag \brief
3198   Assigns a copy of the const iterator \p src to \p dst.
3199 */
3200 int
3201 ppl_assign_Artificial_Parameter_Sequence_const_iterator_from_Artificial_Parameter_Sequence_const_iterator
3202 PPL_PROTO((ppl_Artificial_Parameter_Sequence_const_iterator_t dst,
3203            ppl_const_Artificial_Parameter_Sequence_const_iterator_t src));
3204 
3205 /*! \relates ppl_Artificial_Parameter_Sequence_const_iterator_tag \brief
3206   Invalidates the handle \p apit: this makes sure the corresponding
3207   resources will eventually be released.
3208 */
3209 int
3210 ppl_delete_Artificial_Parameter_Sequence_const_iterator
3211 PPL_PROTO((ppl_const_Artificial_Parameter_Sequence_const_iterator_t apit));
3212 
3213 /*@}*/ /* Constructors, Assignment and Destructor */
3214 
3215 /*! \brief \name Dereferencing, Incrementing and Equality Testing */
3216 /*@{*/
3217 
3218 /*! \relates ppl_Artificial_Parameter_Sequence_const_iterator_tag \brief
3219   Dereference \p apit writing a const handle to the resulting
3220   artificial parameter at address \p pap.
3221 */
3222 int
3223 ppl_Artificial_Parameter_Sequence_const_iterator_dereference
3224 PPL_PROTO((ppl_const_Artificial_Parameter_Sequence_const_iterator_t apit,
3225            ppl_const_Artificial_Parameter_t* pap));
3226 
3227 /*! \relates ppl_Artificial_Parameter_Sequence_const_iterator_tag \brief
3228   Increment \p apit so that it "points" to the next artificial parameter.
3229 */
3230 int
3231 ppl_Artificial_Parameter_Sequence_const_iterator_increment
3232 PPL_PROTO((ppl_Artificial_Parameter_Sequence_const_iterator_t apit));
3233 
3234 /*! \relates ppl_Artificial_Parameter_Sequence_const_iterator_tag \brief
3235   Returns a positive integer if the iterators corresponding to \p x and
3236   \p y are equal; returns 0 if they are different.
3237 */
3238 int
3239 ppl_Artificial_Parameter_Sequence_const_iterator_equal_test
3240 PPL_PROTO((ppl_const_Artificial_Parameter_Sequence_const_iterator_t x,
3241            ppl_const_Artificial_Parameter_Sequence_const_iterator_t y));
3242 
3243 /*@}*/ /* Dereferencing, Incrementing and Equality Testing */
3244 
3245 PPL_DECLARE_AND_DOCUMENT_IO_FUNCTIONS(MIP_Problem)
3246 
3247 PPL_DECLARE_AND_DOCUMENT_IO_FUNCTIONS(PIP_Problem)
3248 
3249 PPL_DECLARE_AND_DOCUMENT_IO_FUNCTIONS(PIP_Tree_Node)
3250 
3251 PPL_DECLARE_AND_DOCUMENT_IO_FUNCTIONS(PIP_Solution_Node)
3252 
3253 PPL_DECLARE_AND_DOCUMENT_IO_FUNCTIONS(PIP_Decision_Node)
3254 
3255 PPL_DECLARE_AND_DOCUMENT_IO_FUNCTIONS(Artificial_Parameter)
3256 
3257 #include "ppl_c_domains.h"
3258 
3259 #ifdef __cplusplus
3260 } /* extern "C" */
3261 #endif
3262 
3263 #undef PPL_TYPE_DECLARATION
3264 #undef PPL_PROTO
3265 #undef PPL_DECLARE_PRINT_FUNCTIONS
3266 #undef PPL_DECLARE_ASCII_DUMP_LOAD_FUNCTIONS
3267 #undef PPL_DECLARE_IO_FUNCTIONS
3268 #undef PPL_DECLARE_AND_DOCUMENT_PRINT_FUNCTIONS
3269 #undef PPL_DECLARE_AND_DOCUMENT_ASCII_DUMP_LOAD_FUNCTIONS
3270 #undef PPL_DECLARE_AND_DOCUMENT_IO_FUNCTIONS
3271 
3272 #endif /* !defined(PPL_ppl_c_h) */
3273