PPL Configured Prolog Language Interface  1.2
ppl_prolog_common_defs.hh
Go to the documentation of this file.
1 /* Common part of the Prolog interfaces: declarations.
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_prolog_common_defs_hh
25 #define PPL_ppl_prolog_common_defs_hh 1
26 
27 #define PPL_NO_AUTOMATIC_INITIALIZATION
28 #include "ppl.hh"
29 #include "ppl_prolog_sysdep.hh"
30 #include "interfaced_boxes.hh"
31 #include <set>
32 #include <vector>
33 #include <exception>
34 #include <stdexcept>
35 #include <iostream>
36 
37 #ifndef PROLOG_TRACK_ALLOCATION
38 #define PROLOG_TRACK_ALLOCATION 0
39 #endif
40 #ifndef NOISY_PROLOG_TRACK_ALLOCATION
41 #define NOISY_PROLOG_TRACK_ALLOCATION 0
42 #endif
43 
44 namespace Parma_Polyhedra_Library {
45 
46 namespace Interfaces {
47 
48 namespace Prolog {
49 
50 #if PROLOG_TRACK_ALLOCATION || NOISY_PROLOG_TRACK_ALLOCATION
51 
52 class Allocation_Tracker {
53 public:
55  Allocation_Tracker();
56 
61  template <typename T>
62  void insert(const T* p);
63 
68  template <typename T>
69  void weak_insert(const T* p);
70 
72  template <typename T>
73  void check(const T* p) const;
74 
79  template <typename T>
80  void remove(const T* p);
81 
87  ~Allocation_Tracker();
88 
89 private:
91  typedef std::set<const void*, std::less<const void*> > Set;
92 
98  Set s;
99 
105  Set weak_s;
106 };
107 
108 extern Allocation_Tracker allocation_tracker;
109 
110 #define PPL_REGISTER(x) \
111  Parma_Polyhedra_Library::Interfaces::Prolog \
112  ::allocation_tracker.insert(x)
113 #define PPL_WEAK_REGISTER(x) \
114  Parma_Polyhedra_Library::Interfaces::Prolog \
115  ::allocation_tracker.weak_insert(x)
116 #define PPL_UNREGISTER(x) \
117  Parma_Polyhedra_Library::Interfaces::Prolog \
118  ::allocation_tracker.remove(x)
119 #define PPL_CHECK(x) \
120  Parma_Polyhedra_Library::Interfaces::Prolog \
121  ::allocation_tracker.check(x)
122 
123 #else // !PROLOG_TRACK_ALLOCATION && !NOISY_PROLOG_TRACK_ALLOCATION
124 
125 #define PPL_REGISTER(x)
126 #define PPL_WEAK_REGISTER(x)
127 #define PPL_UNREGISTER(x)
128 #define PPL_CHECK(x)
129 
130 #endif // !PROLOG_TRACK_ALLOCATION && !NOISY_PROLOG_TRACK_ALLOCATION
131 
133 private:
134  Prolog_term_ref t;
135  const char* w;
136 
137 public:
138  internal_exception(Prolog_term_ref term, const char* where)
139  : t(term),
140  w(where) {
141  }
142 
144  }
145 
146  virtual Prolog_term_ref term() const {
147  return t;
148  }
149 
150  virtual const char* where() const {
151  return w;
152  }
153 };
154 
156 private:
157  unsigned long m;
158 
159 public:
161  const char* where,
162  unsigned long max)
163  : internal_exception(term, where),
164  m(max) {
165  }
166 
167  unsigned long max() const {
168  return m;
169  }
170 };
171 
173 public:
174  non_linear(Prolog_term_ref term, const char* where)
175  : internal_exception(term, where) {
176  }
177 };
178 
180 public:
181  not_an_integer(Prolog_term_ref term, const char* where)
182  : internal_exception(term, where) {
183  }
184 };
185 
187 public:
188  not_unsigned_integer(Prolog_term_ref term, const char* where)
189  : internal_exception(term, where) {
190  }
191 };
192 
194 public:
195  not_a_boolean(Prolog_term_ref term, const char* where)
196  : internal_exception(term, where) {
197  }
198 };
199 
201 public:
202  not_a_variable(Prolog_term_ref term, const char* where)
203  : internal_exception(term, where) {
204  }
205 };
206 
208 public:
209  not_an_optimization_mode(Prolog_term_ref term, const char* where)
210  : internal_exception(term, where) {
211  }
212 };
213 
215 public:
216  not_a_bounded_integer_type_width(Prolog_term_ref term, const char* where)
217  : internal_exception(term, where) {
218  }
219 };
220 
222 public:
224  const char* where)
225  : internal_exception(term, where) {
226  }
227 };
228 
230 public:
231  not_a_bounded_integer_type_overflow(Prolog_term_ref term, const char* where)
232  : internal_exception(term, where) {
233  }
234 };
235 
237 public:
238  not_a_complexity_class(Prolog_term_ref term, const char* where)
239  : internal_exception(term, where) {
240  }
241 };
242 
244 public:
245  not_a_control_parameter_name(Prolog_term_ref term, const char* where)
246  : internal_exception(term, where) {
247  }
248 };
249 
251 public:
252  not_a_control_parameter_value(Prolog_term_ref term, const char* where)
253  : internal_exception(term, where) {
254  }
255 };
256 
258 public:
260  : internal_exception(term, where) {
261  }
262 };
263 
265 public:
267  : internal_exception(term, where) {
268  }
269 };
270 
272 public:
273  not_universe_or_empty(Prolog_term_ref term, const char* where)
274  : internal_exception(term, where) {
275  }
276 };
277 
279 public:
280  not_a_relation(Prolog_term_ref term, const char* where)
281  : internal_exception(term, where) {
282  }
283 };
284 
286 public:
287  not_a_nil_terminated_list(Prolog_term_ref term, const char* where)
288  : internal_exception(term, where) {
289  }
290 };
291 
293 private:
295 
296 public:
298  : n(value) {
299  }
300 
302  return n;
303  }
304 };
305 
307 public:
308  ppl_handle_mismatch(Prolog_term_ref term, const char* where)
309  : internal_exception(term, where) {
310  }
311 };
312 
314 private:
315  const char* w;
316 
317 public:
318  unknown_interface_error(const char* s)
319  : w(s) {
320  }
321 
322  const char* where() const {
323  return w;
324  }
325 };
326 
327 // For variables.
328 extern Prolog_atom a_dollar_VAR;
329 
330 // For linear expressions.
331 extern Prolog_atom a_plus;
332 extern Prolog_atom a_minus;
333 extern Prolog_atom a_asterisk;
334 
335 // To represent rational numbers as fractions.
336 extern Prolog_atom a_slash;
337 
338 // For constraints.
339 extern Prolog_atom a_less_than;
340 extern Prolog_atom a_equal_less_than;
341 extern Prolog_atom a_equal;
342 extern Prolog_atom a_greater_than_equal;
343 extern Prolog_atom a_greater_than;
344 
345 // For congruences.
346 extern Prolog_atom a_is_congruent_to;
347 extern Prolog_atom a_modulo;
348 
349 // For generators.
350 extern Prolog_atom a_line;
351 extern Prolog_atom a_ray;
352 extern Prolog_atom a_point;
353 extern Prolog_atom a_closure_point;
354 
355 // For grid_generators.
356 extern Prolog_atom a_grid_line;
357 extern Prolog_atom a_parameter;
358 extern Prolog_atom a_grid_point;
359 
360 // For the relation between a polyhedron and a constraint.
361 extern Prolog_atom a_is_disjoint;
362 extern Prolog_atom a_strictly_intersects;
363 extern Prolog_atom a_is_included;
364 extern Prolog_atom a_saturates;
365 
366 // For the relation between a polyhedron and a generator.
367 extern Prolog_atom a_subsumes;
368 
369 // Denotes a closed interval boundary.
370 extern Prolog_atom a_c;
371 
372 // Denotes the empty set such as the empty interval or polyhedron.
373 extern Prolog_atom a_empty;
374 
375 // Denotes an open interval boundary.
376 extern Prolog_atom a_o;
377 
378 // Denotes the constructor that turns two boundaries into a proper interval.
379 extern Prolog_atom a_i;
380 
381 // Denote the -infinity and +infinity interval boundaries.
382 extern Prolog_atom a_minf;
383 extern Prolog_atom a_pinf;
384 
385 // Denote complexity classes.
386 extern Prolog_atom a_polynomial;
387 extern Prolog_atom a_simplex;
388 extern Prolog_atom a_any;
389 
390 // Denote possible widths of bounded integer types.
391 extern Prolog_atom a_bits_8;
392 extern Prolog_atom a_bits_16;
393 extern Prolog_atom a_bits_32;
394 extern Prolog_atom a_bits_64;
395 extern Prolog_atom a_bits_128;
396 
397 // Denote possible representations of bounded integer types.
398 extern Prolog_atom a_unsigned;
399 extern Prolog_atom a_signed_2_complement;
400 
401 // Denote possible overflow behavior of bounded integer types.
402 extern Prolog_atom a_overflow_wraps;
403 extern Prolog_atom a_overflow_undefined;
404 extern Prolog_atom a_overflow_impossible;
405 
406 // Boolean constants.
407 extern Prolog_atom a_true;
408 extern Prolog_atom a_false;
409 
410 
412  Prolog_atom* p_atom;
413  const char* name;
414 };
415 
416 extern const Prolog_Interface_Atom prolog_interface_atoms[];
417 
418 void
419 handle_exception(const Prolog_unsigned_out_of_range& e);
420 
421 void
422 handle_exception(const not_unsigned_integer& e);
423 
424 void
425 handle_exception(const not_a_boolean& e);
426 
427 void
428 handle_exception(const non_linear& e);
429 
430 void
431 handle_exception(const not_a_variable& e);
432 
433 void
434 handle_exception(const not_an_integer& e);
435 
436 void
437 handle_exception(const ppl_handle_mismatch& e);
438 
439 void
440 handle_exception(const not_an_optimization_mode& e);
441 
442 void
443 handle_exception(const not_a_complexity_class& e);
444 
445 void
446 handle_exception(const not_a_bounded_integer_type_width& e);
447 
448 void
449 handle_exception(const not_a_bounded_integer_type_representation& e);
450 
451 void
452 handle_exception(const not_a_bounded_integer_type_overflow& e);
453 
454 void
455 handle_exception(const not_a_control_parameter_name& e);
456 
457 void
458 handle_exception(const not_a_control_parameter_value& e);
459 
460 void
461 handle_exception(const not_a_pip_problem_control_parameter_name& e);
462 
463 void
464 handle_exception(const not_a_pip_problem_control_parameter_value& e);
465 
466 void
467 handle_exception(const not_universe_or_empty& e);
468 
469 void
470 handle_exception(const not_a_relation& e);
471 
472 void
473 handle_exception(const not_a_nil_terminated_list& e);
474 
475 void
476 handle_exception(const PPL_integer_out_of_range& e);
477 
478 void
479 handle_exception(const unknown_interface_error& e);
480 
481 void
482 handle_exception(const std::overflow_error& e);
483 
484 void
485 handle_exception(const std::domain_error& e);
486 
487 void
488 handle_exception(const std::length_error& e);
489 
490 void
491 handle_exception(const std::invalid_argument& e);
492 
493 void
494 handle_exception(const std::logic_error& e);
495 
496 void
497 handle_exception(const std::bad_alloc&);
498 
499 void
500 handle_exception(const std::exception& e);
501 
502 void
503 handle_exception();
504 
507 public:
508  void throw_me() const {
509  throw *this;
510  }
511  int priority() const {
512  return 0;
513  }
514 };
515 
516 void
517 handle_exception(const timeout_exception&);
518 
521 public:
522  void throw_me() const {
523  throw *this;
524  }
525  int priority() const {
526  return 0;
527  }
528 };
529 
530 void
531 handle_exception(const deterministic_timeout_exception&);
532 
533 #define CATCH_ALL \
534  catch (const Prolog_unsigned_out_of_range& e) { \
535  handle_exception(e); \
536  } \
537  catch (const not_unsigned_integer& e) { \
538  handle_exception(e); \
539  } \
540  catch (const non_linear& e) { \
541  handle_exception(e); \
542  } \
543  catch (const not_a_variable& e) { \
544  handle_exception(e); \
545  } \
546  catch (const not_an_integer& e) { \
547  handle_exception(e); \
548  } \
549  catch (const ppl_handle_mismatch& e) { \
550  handle_exception(e); \
551  } \
552  catch (const not_an_optimization_mode& e) { \
553  handle_exception(e); \
554  } \
555  catch (const not_a_complexity_class& e) { \
556  handle_exception(e); \
557  } \
558  catch (const not_a_bounded_integer_type_width& e) { \
559  handle_exception(e); \
560  } \
561  catch (const not_a_bounded_integer_type_representation& e) { \
562  handle_exception(e); \
563  } \
564  catch (const not_a_bounded_integer_type_overflow& e) { \
565  handle_exception(e); \
566  } \
567  catch (const not_a_control_parameter_name& e) { \
568  handle_exception(e); \
569  } \
570  catch (const not_a_control_parameter_value& e) { \
571  handle_exception(e); \
572  } \
573  catch (const not_a_pip_problem_control_parameter_name& e) { \
574  handle_exception(e); \
575  } \
576  catch (const not_a_pip_problem_control_parameter_value& e) { \
577  handle_exception(e); \
578  } \
579  catch (const not_universe_or_empty& e) { \
580  handle_exception(e); \
581  } \
582  catch (const not_a_relation& e) { \
583  handle_exception(e); \
584  } \
585  catch (const not_a_nil_terminated_list& e) { \
586  handle_exception(e); \
587  } \
588  catch (const PPL_integer_out_of_range& e) { \
589  handle_exception(e); \
590  } \
591  catch (const unknown_interface_error& e) { \
592  handle_exception(e); \
593  } \
594  catch (const timeout_exception& e) { \
595  handle_exception(e); \
596  } \
597  catch (const deterministic_timeout_exception& e) { \
598  handle_exception(e); \
599  } \
600  catch(const std::overflow_error& e) { \
601  handle_exception(e); \
602  } \
603  catch(const std::domain_error& e) { \
604  handle_exception(e); \
605  } \
606  catch(const std::length_error& e) { \
607  handle_exception(e); \
608  } \
609  catch(const std::invalid_argument& e) { \
610  handle_exception(e); \
611  } \
612  catch (const std::logic_error& e) { \
613  handle_exception(e); \
614  } \
615  catch (const std::bad_alloc& e) { \
616  handle_exception(e); \
617  } \
618  catch (const std::exception& e) { \
619  handle_exception(e); \
620  } \
621  catch (...) { \
622  handle_exception(); \
623  } \
624  return PROLOG_FAILURE
625 
626 
627 Prolog_term_ref
628 variable_term(dimension_type varid);
629 
630 template <typename U>
631 U
632 term_to_unsigned(Prolog_term_ref t, const char* where) {
633  using namespace Parma_Polyhedra_Library;
635  if (!Prolog_is_integer(t))
636  throw not_unsigned_integer(t, where);
637 
638  U d = 0;
639  long l;
640  if (Prolog_get_long(t, &l))
641  if (l < 0)
642  throw not_unsigned_integer(t, where);
643  else if (static_cast<unsigned long>(l) > std::numeric_limits<U>::max())
644  throw Prolog_unsigned_out_of_range(t, where,
645  std::numeric_limits<U>::max());
646  else
647  d = l;
648  else {
650  Prolog_get_Coefficient(t, v);
651  if (v < 0)
652  throw not_unsigned_integer(t, where);
654  if (result_overflow(r))
655  throw Prolog_unsigned_out_of_range(t, where,
656  std::numeric_limits<U>::max());
657  }
658  return d;
659 }
660 
661 Prolog_atom
662 term_to_boolean(Prolog_term_ref t, const char* where);
663 
664 Prolog_atom
665 term_to_universe_or_empty(Prolog_term_ref t, const char* where);
666 
667 Prolog_term_ref
669 
670 Prolog_atom
671 term_to_complexity_class(Prolog_term_ref t, const char* where);
672 
673 Prolog_atom
674 term_to_bounded_integer_type_width(Prolog_term_ref t, const char* where);
675 
676 Prolog_atom
677 term_to_bounded_integer_type_representation(Prolog_term_ref t,
678  const char* where);
679 
680 Prolog_atom
681 term_to_bounded_integer_type_overflow(Prolog_term_ref t, const char* where);
682 
683 template <typename T>
684 T*
685 term_to_handle(Prolog_term_ref t, const char* where) {
686  if (Prolog_is_address(t)) {
687  void* p;
688  if (Prolog_get_address(t, &p))
689  return static_cast<T*>(p);
690  }
691  throw ppl_handle_mismatch(t, where);
692 }
693 
694 enum Boundary_Kind {
695  LOWER_BOUNDARY,
696  UPPER_BOUNDARY
697 };
698 
699 bool
700 term_to_boundary(Prolog_term_ref t_b, Boundary_Kind kind,
701  bool& finite, bool& closed,
703 
705 term_to_relation_symbol(Prolog_term_ref t_r, const char* where);
706 
708 integer_term_to_Coefficient(Prolog_term_ref t);
709 
710 Prolog_term_ref
711 Coefficient_to_integer_term(const Parma_Polyhedra_Library::Coefficient& n);
712 
713 bool
714 unify_long(Prolog_term_ref t, long l);
715 
716 bool
717 unify_ulong(Prolog_term_ref t, unsigned long l);
718 
720 build_linear_expression(Prolog_term_ref t, const char* where);
721 
723 build_constraint(Prolog_term_ref t, const char* where);
724 
726 build_congruence(Prolog_term_ref t, const char* where);
727 
729 build_generator(Prolog_term_ref t, const char* where);
730 
732 build_grid_generator(Prolog_term_ref t, const char* where);
733 
734 Prolog_term_ref
735 get_linear_expression(const Parma_Polyhedra_Library::Linear_Expression& le);
736 
737 Prolog_term_ref
738 constraint_term(const Parma_Polyhedra_Library::Constraint& c);
739 
740 Prolog_term_ref
741 congruence_term(const Parma_Polyhedra_Library::Congruence& cg);
742 
743 Prolog_term_ref
744 generator_term(const Parma_Polyhedra_Library::Generator& g);
745 
746 Prolog_term_ref
747 grid_generator_term(const Parma_Polyhedra_Library::Grid_Generator& g);
748 
750 term_to_Variable(Prolog_term_ref t, const char* where);
751 
753 term_to_Coefficient(Prolog_term_ref t, const char* where);
754 
755 Prolog_atom
756 term_to_optimization_mode(Prolog_term_ref t, const char* where);
757 
758 Prolog_atom
759 term_to_control_parameter_name(Prolog_term_ref t, const char* where);
760 
761 Prolog_atom
762 term_to_control_parameter_value(Prolog_term_ref t, const char* where);
763 
764 Prolog_atom
765 term_to_pip_problem_control_parameter_name(Prolog_term_ref t, const char* where);
766 
767 Prolog_atom
768 term_to_pip_problem_control_parameter_value(Prolog_term_ref t, const char* where);
769 
770 void
771 check_nil_terminating(Prolog_term_ref t, const char* where);
772 
773 } // namespace Prolog
774 
775 } // namespace Interfaces
776 
777 } // namespace Parma_Polyhedra_Library
778 
779 extern "C" Prolog_foreign_return_type
780 ppl_version_major(Prolog_term_ref t_v);
781 
782 extern "C" Prolog_foreign_return_type
783 ppl_version_minor(Prolog_term_ref t_v);
784 
785 extern "C" Prolog_foreign_return_type
786 ppl_version_revision(Prolog_term_ref t_v);
787 
788 extern "C" Prolog_foreign_return_type
789 ppl_version_beta(Prolog_term_ref t_v);
790 
791 extern "C" Prolog_foreign_return_type
792 ppl_version(Prolog_term_ref t_v);
793 
794 extern "C" Prolog_foreign_return_type
795 ppl_banner(Prolog_term_ref t_b);
796 
797 extern "C" Prolog_foreign_return_type
798 ppl_max_space_dimension(Prolog_term_ref t_msd);
799 
800 extern "C" Prolog_foreign_return_type
802 
803 extern "C" Prolog_foreign_return_type
804 ppl_finalize();
805 
806 extern "C" Prolog_foreign_return_type
808 
809 extern "C" Prolog_foreign_return_type
811 
812 extern "C" Prolog_foreign_return_type
813 ppl_irrational_precision(Prolog_term_ref t_p);
814 
815 extern "C" Prolog_foreign_return_type
816 ppl_set_irrational_precision(Prolog_term_ref t_p);
817 
818 extern "C" Prolog_foreign_return_type
819 ppl_set_timeout_exception_atom(Prolog_term_ref t_tea);
820 
821 extern "C" Prolog_foreign_return_type
822 ppl_timeout_exception_atom(Prolog_term_ref t);
823 
824 extern "C" Prolog_foreign_return_type
825 ppl_set_timeout(Prolog_term_ref t_csecs);
826 
827 extern "C" Prolog_foreign_return_type
829 
830 extern "C" Prolog_foreign_return_type
831 ppl_set_deterministic_timeout(Prolog_term_ref t_unscaled_weight,
832  Prolog_term_ref t_scale);
833 
834 extern "C" Prolog_foreign_return_type
836 
837 extern "C" Prolog_foreign_return_type
838 ppl_Coefficient_bits(Prolog_term_ref t_bits);
839 
840 extern "C" Prolog_foreign_return_type
842 
843 extern "C" Prolog_foreign_return_type
844 ppl_Coefficient_min(Prolog_term_ref t_min);
845 
846 extern "C" Prolog_foreign_return_type
847 ppl_Coefficient_max(Prolog_term_ref t_max);
848 
849 extern "C" Prolog_foreign_return_type
851 (Prolog_term_ref t_nd, Prolog_term_ref t_mip);
852 
853 extern "C" Prolog_foreign_return_type
854 ppl_new_MIP_Problem(Prolog_term_ref t_nd,
855  Prolog_term_ref t_clist,
856  Prolog_term_ref t_le_expr,
857  Prolog_term_ref t_opt,
858  Prolog_term_ref t_mip);
859 
860 extern "C" Prolog_foreign_return_type
861 ppl_new_MIP_Problem_from_MIP_Problem(Prolog_term_ref t_mip_source,
862  Prolog_term_ref t_mip);
863 
864 extern "C" Prolog_foreign_return_type
865 ppl_MIP_Problem_swap(Prolog_term_ref t_lhs, Prolog_term_ref t_rhs);
866 
867 extern "C" Prolog_foreign_return_type
868 ppl_delete_MIP_Problem(Prolog_term_ref t_mip);
869 
870 extern "C" Prolog_foreign_return_type
871 ppl_MIP_Problem_space_dimension(Prolog_term_ref t_mip, Prolog_term_ref t_sd);
872 
873 extern "C" Prolog_foreign_return_type
874 ppl_MIP_Problem_integer_space_dimensions(Prolog_term_ref t_mip,
875  Prolog_term_ref t_vlist);
876 
877 extern "C" Prolog_foreign_return_type
878 ppl_MIP_Problem_constraints(Prolog_term_ref t_mip,
879  Prolog_term_ref t_clist);
880 
881 extern "C" Prolog_foreign_return_type
882 ppl_MIP_Problem_objective_function(Prolog_term_ref t_mip,
883  Prolog_term_ref t_le_expr);
884 
885 extern "C" Prolog_foreign_return_type
886 ppl_MIP_Problem_optimization_mode(Prolog_term_ref t_mip,
887  Prolog_term_ref t_opt);
888 
889 extern "C" Prolog_foreign_return_type
890 ppl_MIP_Problem_get_control_parameter(Prolog_term_ref t_mip,
891  Prolog_term_ref t_cp_name,
892  Prolog_term_ref t_cp_value);
893 
894 extern "C" Prolog_foreign_return_type
895 ppl_MIP_Problem_clear(Prolog_term_ref t_mip);
896 
897 extern "C" Prolog_foreign_return_type
899 (Prolog_term_ref t_mip, Prolog_term_ref t_nnd);
900 
901 extern "C" Prolog_foreign_return_type
903  Prolog_term_ref t_vlist);
904 
905 extern "C" Prolog_foreign_return_type
906 ppl_MIP_Problem_add_constraint(Prolog_term_ref t_mip, Prolog_term_ref t_c);
907 
908 extern "C" Prolog_foreign_return_type
909 ppl_MIP_Problem_add_constraints(Prolog_term_ref t_mip,
910  Prolog_term_ref t_clist);
911 
912 extern "C" Prolog_foreign_return_type
913 ppl_MIP_Problem_set_objective_function(Prolog_term_ref t_mip,
914  Prolog_term_ref t_le_expr);
915 
916 extern "C" Prolog_foreign_return_type
917 ppl_MIP_Problem_set_optimization_mode(Prolog_term_ref t_mip,
918  Prolog_term_ref t_opt);
919 
920 extern "C" Prolog_foreign_return_type
921 ppl_MIP_Problem_set_control_parameter(Prolog_term_ref t_mip,
922  Prolog_term_ref t_cp_value);
923 
924 extern "C" Prolog_foreign_return_type
925 ppl_MIP_Problem_is_satisfiable(Prolog_term_ref t_mip);
926 
927 extern "C" Prolog_foreign_return_type
928 ppl_MIP_Problem_solve(Prolog_term_ref t_mip, Prolog_term_ref t_status);
929 
930 extern "C" Prolog_foreign_return_type
931 ppl_MIP_Problem_feasible_point(Prolog_term_ref t_mip,
932  Prolog_term_ref t_g);
933 
934 extern "C" Prolog_foreign_return_type
935 ppl_MIP_Problem_optimizing_point(Prolog_term_ref t_mip,
936  Prolog_term_ref t_g);
937 
938 extern "C" Prolog_foreign_return_type
939 ppl_MIP_Problem_optimal_value(Prolog_term_ref t_mip,
940  Prolog_term_ref t_n,
941  Prolog_term_ref t_d);
942 
943 extern "C" Prolog_foreign_return_type
944 ppl_MIP_Problem_evaluate_objective_function(Prolog_term_ref t_mip,
945  Prolog_term_ref t_g,
946  Prolog_term_ref t_n,
947  Prolog_term_ref t_d);
948 
949 extern "C" Prolog_foreign_return_type
950 ppl_MIP_Problem_OK(Prolog_term_ref t_mip);
951 
952 extern "C" Prolog_foreign_return_type
953 ppl_MIP_Problem_ascii_dump(Prolog_term_ref t_mip);
954 
955 
956 extern "C" Prolog_foreign_return_type
957 ppl_new_PIP_Problem_from_space_dimension(Prolog_term_ref t_nd,
958  Prolog_term_ref t_pip);
959 
960 extern "C" Prolog_foreign_return_type
961 ppl_new_PIP_Problem_from_PIP_Problem(Prolog_term_ref t_pip_source,
962  Prolog_term_ref t_pip);
963 
964 extern "C" Prolog_foreign_return_type
965 ppl_new_PIP_Problem(Prolog_term_ref t_dim,
966  Prolog_term_ref t_cs,
967  Prolog_term_ref t_params,
968  Prolog_term_ref t_pip);
969 
970 extern "C" Prolog_foreign_return_type
971 ppl_PIP_Problem_swap(Prolog_term_ref t_lhs, Prolog_term_ref t_rhs);
972 
973 extern "C" Prolog_foreign_return_type
974 ppl_delete_PIP_Problem(Prolog_term_ref t_pip);
975 
976 extern "C" Prolog_foreign_return_type
977 ppl_PIP_Problem_space_dimension(Prolog_term_ref t_pip, Prolog_term_ref t_sd);
978 
979 extern "C" Prolog_foreign_return_type
980 ppl_PIP_Problem_parameter_space_dimensions(Prolog_term_ref t_pip,
981  Prolog_term_ref t_vlist);
982 
983 extern "C" Prolog_foreign_return_type
984 ppl_PIP_Problem_constraints(Prolog_term_ref t_pip, Prolog_term_ref t_cs);
985 
986 extern "C" Prolog_foreign_return_type
987 ppl_PIP_Problem_get_control_parameter(Prolog_term_ref t_pip,
988  Prolog_term_ref t_cp_name,
989  Prolog_term_ref t_cp_value);
990 
991 extern "C" Prolog_foreign_return_type
992 ppl_PIP_Problem_clear(Prolog_term_ref t_pip);
993 
994 extern "C" Prolog_foreign_return_type
996 (Prolog_term_ref t_pip,
997  Prolog_term_ref t_num_vars,
998  Prolog_term_ref t_num_params);
999 
1000 extern "C" Prolog_foreign_return_type
1002  Prolog_term_ref t_vlist);
1003 
1004 extern "C" Prolog_foreign_return_type
1005 ppl_PIP_Problem_add_constraint(Prolog_term_ref t_pip, Prolog_term_ref t_c);
1006 
1007 extern "C" Prolog_foreign_return_type
1008 ppl_PIP_Problem_add_constraints(Prolog_term_ref t_pip,
1009  Prolog_term_ref t_clist);
1010 
1011 extern "C" Prolog_foreign_return_type
1012 ppl_PIP_Problem_set_control_parameter(Prolog_term_ref t_pip,
1013  Prolog_term_ref t_cp_value);
1014 
1015 extern "C" Prolog_foreign_return_type
1016 ppl_PIP_Problem_is_satisfiable(Prolog_term_ref t_pip);
1017 
1018 extern "C" Prolog_foreign_return_type
1019 ppl_PIP_Problem_solve(Prolog_term_ref t_pip, Prolog_term_ref t_status);
1020 
1021 extern "C" Prolog_foreign_return_type
1022 ppl_PIP_Problem_solution(Prolog_term_ref t_pip,
1023  Prolog_term_ref t_pip_tree);
1024 
1025 extern "C" Prolog_foreign_return_type
1026 ppl_PIP_Problem_optimizing_solution(Prolog_term_ref t_pip,
1027  Prolog_term_ref t_pip_tree);
1028 
1029 extern "C" Prolog_foreign_return_type
1030 ppl_PIP_Problem_has_big_parameter_dimension(Prolog_term_ref t_pip,
1031  Prolog_term_ref t_d);
1032 
1033 extern "C" Prolog_foreign_return_type
1034 ppl_PIP_Problem_set_big_parameter_dimension(Prolog_term_ref t_pip,
1035  Prolog_term_ref t_d);
1036 
1037 extern "C" Prolog_foreign_return_type
1038 ppl_PIP_Problem_OK(Prolog_term_ref t_pip);
1039 
1040 extern "C" Prolog_foreign_return_type
1041 ppl_PIP_Problem_ascii_dump(Prolog_term_ref t_pip);
1042 
1043 extern "C" Prolog_foreign_return_type
1044 ppl_PIP_Tree_Node_constraints(Prolog_term_ref t_tree_node,
1045  Prolog_term_ref t_clist);
1046 
1047 extern "C" Prolog_foreign_return_type
1048 ppl_PIP_Tree_Node_is_solution(Prolog_term_ref t_tree_node);
1049 
1050 extern "C" Prolog_foreign_return_type
1051 ppl_PIP_Tree_Node_is_decision(Prolog_term_ref t_tree_node);
1052 
1053 extern "C" Prolog_foreign_return_type
1054 ppl_PIP_Tree_Node_is_bottom(Prolog_term_ref t_tree_node);
1055 
1056 extern "C" Prolog_foreign_return_type
1057 ppl_PIP_Tree_Node_artificials(Prolog_term_ref t_tree_node,
1058  Prolog_term_ref t_artlist);
1059 
1060 extern "C" Prolog_foreign_return_type
1061 ppl_PIP_Tree_Node_OK(Prolog_term_ref t_pip_tree);
1062 
1063 extern "C" Prolog_foreign_return_type
1064 ppl_PIP_Tree_Node_parametric_values(Prolog_term_ref t_pip_sol,
1065  Prolog_term_ref t_var,
1066  Prolog_term_ref t_pvalue_list);
1067 
1068 extern "C" Prolog_foreign_return_type
1069 ppl_PIP_Tree_Node_true_child(Prolog_term_ref t_pip_dec,
1070  Prolog_term_ref t_pip_tree);
1071 
1072 extern "C" Prolog_foreign_return_type
1073 ppl_PIP_Tree_Node_false_child(Prolog_term_ref t_pip_dec,
1074  Prolog_term_ref t_pip_tree);
1075 
1076 using namespace Parma_Polyhedra_Library;
1078 
1080 
1081 #endif // !defined(PPL_ppl_prolog_common_defs_hh)
int result_overflow(Result r)
Enable_If< Is_Native_Or_Checked< To >::value &&Is_Special< From >::value, Result >::type assign_r(To &to, const From &, Rounding_Dir dir)
Prolog_foreign_return_type ppl_PIP_Problem_ascii_dump(Prolog_term_ref t_pip)
Prolog_foreign_return_type ppl_MIP_Problem_clear(Prolog_term_ref t_mip)
Prolog_foreign_return_type ppl_PIP_Problem_optimizing_solution(Prolog_term_ref t_pip, Prolog_term_ref t_pip_tree)
Prolog_foreign_return_type ppl_PIP_Problem_set_control_parameter(Prolog_term_ref t_pip, Prolog_term_ref t_cp_value)
Prolog_foreign_return_type ppl_reset_deterministic_timeout()
Prolog_foreign_return_type ppl_MIP_Problem_optimization_mode(Prolog_term_ref t_mip, Prolog_term_ref t_opt)
Prolog_foreign_return_type ppl_MIP_Problem_add_constraints(Prolog_term_ref t_mip, Prolog_term_ref t_clist)
Prolog_foreign_return_type ppl_PIP_Tree_Node_true_child(Prolog_term_ref t_pip_dec, Prolog_term_ref t_pip_tree)
Prolog_foreign_return_type ppl_new_MIP_Problem(Prolog_term_ref t_nd, Prolog_term_ref t_clist, Prolog_term_ref t_le_expr, Prolog_term_ref t_opt, Prolog_term_ref t_mip)
size_t dimension_type
Prolog_foreign_return_type ppl_MIP_Problem_is_satisfiable(Prolog_term_ref t_mip)
Prolog_foreign_return_type ppl_MIP_Problem_solve(Prolog_term_ref t_mip, Prolog_term_ref t_status)
Prolog_foreign_return_type ppl_PIP_Problem_get_control_parameter(Prolog_term_ref t_pip, Prolog_term_ref t_cp_name, Prolog_term_ref t_cp_value)
Prolog_foreign_return_type ppl_PIP_Problem_swap(Prolog_term_ref t_lhs, Prolog_term_ref t_rhs)
Prolog_foreign_return_type ppl_MIP_Problem_constraints(Prolog_term_ref t_mip, Prolog_term_ref t_clist)
Prolog_foreign_return_type ppl_PIP_Problem_set_big_parameter_dimension(Prolog_term_ref t_pip, Prolog_term_ref t_d)
Prolog_foreign_return_type ppl_PIP_Tree_Node_parametric_values(Prolog_term_ref t_pip_sol, Prolog_term_ref t_var, Prolog_term_ref t_pvalue_list)
Prolog_foreign_return_type ppl_version_beta(Prolog_term_ref t_v)
#define PPL_DIRTY_TEMP_COEFFICIENT(id)
Prolog_foreign_return_type ppl_PIP_Problem_space_dimension(Prolog_term_ref t_pip, Prolog_term_ref t_sd)
Prolog_foreign_return_type ppl_PIP_Problem_has_big_parameter_dimension(Prolog_term_ref t_pip, Prolog_term_ref t_d)
Prolog_foreign_return_type ppl_Coefficient_bits(Prolog_term_ref t_bits)
Prolog_foreign_return_type ppl_PIP_Tree_Node_is_solution(Prolog_term_ref t_tree_node)
Prolog_foreign_return_type ppl_MIP_Problem_add_constraint(Prolog_term_ref t_mip, Prolog_term_ref t_c)
Prolog_foreign_return_type ppl_MIP_Problem_set_control_parameter(Prolog_term_ref t_mip, Prolog_term_ref t_cp_value)
Prolog_foreign_return_type ppl_PIP_Problem_add_to_parameter_space_dimensions(Prolog_term_ref t_pip, Prolog_term_ref t_vlist)
Result
Prolog_foreign_return_type ppl_PIP_Problem_solve(Prolog_term_ref t_pip, Prolog_term_ref t_status)
Prolog_foreign_return_type ppl_version_major(Prolog_term_ref t_v)
Prolog_foreign_return_type ppl_timeout_exception_atom(Prolog_term_ref t)
Prolog_foreign_return_type ppl_version_revision(Prolog_term_ref t_v)
Prolog_foreign_return_type ppl_set_deterministic_timeout(Prolog_term_ref t_unscaled_weight, Prolog_term_ref t_scale)
Prolog_foreign_return_type ppl_PIP_Tree_Node_constraints(Prolog_term_ref t_tree_node, Prolog_term_ref t_clist)
Prolog_foreign_return_type ppl_version(Prolog_term_ref t_v)
Prolog_foreign_return_type ppl_MIP_Problem_feasible_point(Prolog_term_ref t_mip, Prolog_term_ref t_g)
Prolog_foreign_return_type ppl_MIP_Problem_evaluate_objective_function(Prolog_term_ref t_mip, Prolog_term_ref t_g, Prolog_term_ref t_n, Prolog_term_ref t_d)
Prolog_foreign_return_type ppl_new_PIP_Problem(Prolog_term_ref t_dim, Prolog_term_ref t_cs, Prolog_term_ref t_params, Prolog_term_ref t_pip)
Prolog_foreign_return_type ppl_set_rounding_for_PPL()
Prolog_foreign_return_type ppl_PIP_Problem_add_constraint(Prolog_term_ref t_pip, Prolog_term_ref t_c)
Prolog_unsigned_out_of_range(Prolog_term_ref term, const char *where, unsigned long max)
Prolog_foreign_return_type ppl_MIP_Problem_set_objective_function(Prolog_term_ref t_mip, Prolog_term_ref t_le_expr)
Prolog_foreign_return_type ppl_Coefficient_max(Prolog_term_ref t_max)
Prolog_foreign_return_type ppl_delete_PIP_Problem(Prolog_term_ref t_pip)
Prolog_foreign_return_type ppl_MIP_Problem_OK(Prolog_term_ref t_mip)
Prolog_foreign_return_type ppl_PIP_Tree_Node_is_bottom(Prolog_term_ref t_tree_node)
Prolog_foreign_return_type ppl_new_MIP_Problem_from_MIP_Problem(Prolog_term_ref t_mip_source, Prolog_term_ref t_mip)
Prolog_foreign_return_type ppl_MIP_Problem_space_dimension(Prolog_term_ref t_mip, Prolog_term_ref t_sd)
Prolog_foreign_return_type ppl_set_timeout_exception_atom(Prolog_term_ref t_tea)
Prolog_foreign_return_type ppl_MIP_Problem_get_control_parameter(Prolog_term_ref t_mip, Prolog_term_ref t_cp_name, Prolog_term_ref t_cp_value)
Prolog_foreign_return_type ppl_PIP_Problem_clear(Prolog_term_ref t_pip)
Prolog_foreign_return_type ppl_new_MIP_Problem_from_space_dimension(Prolog_term_ref t_nd, Prolog_term_ref t_mip)
Prolog_foreign_return_type ppl_MIP_Problem_add_space_dimensions_and_embed(Prolog_term_ref t_mip, Prolog_term_ref t_nnd)
Prolog_foreign_return_type ppl_banner(Prolog_term_ref t_b)
Prolog_foreign_return_type ppl_PIP_Problem_OK(Prolog_term_ref t_pip)
Prolog_foreign_return_type ppl_version_minor(Prolog_term_ref t_v)
Prolog_foreign_return_type ppl_PIP_Problem_parameter_space_dimensions(Prolog_term_ref t_pip, Prolog_term_ref t_vlist)
const mpz_class & raw_value(const GMP_Integer &x)
Prolog_foreign_return_type ppl_delete_MIP_Problem(Prolog_term_ref t_mip)
Prolog_foreign_return_type ppl_PIP_Tree_Node_is_decision(Prolog_term_ref t_tree_node)
Prolog_foreign_return_type ppl_PIP_Problem_add_constraints(Prolog_term_ref t_pip, Prolog_term_ref t_clist)
PPL_COEFFICIENT_TYPE Coefficient
Prolog_foreign_return_type ppl_restore_pre_PPL_rounding()
Prolog_foreign_return_type ppl_PIP_Problem_solution(Prolog_term_ref t_pip, Prolog_term_ref t_pip_tree)
Prolog_foreign_return_type ppl_PIP_Problem_add_space_dimensions_and_embed(Prolog_term_ref t_pip, Prolog_term_ref t_num_vars, Prolog_term_ref t_num_params)
Prolog_foreign_return_type ppl_PIP_Tree_Node_artificials(Prolog_term_ref t_tree_node, Prolog_term_ref t_artlist)
PPL_integer_out_of_range(const Parma_Polyhedra_Library::Coefficient &value)
Prolog_foreign_return_type ppl_MIP_Problem_set_optimization_mode(Prolog_term_ref t_mip, Prolog_term_ref t_opt)
Prolog_foreign_return_type ppl_PIP_Tree_Node_false_child(Prolog_term_ref t_pip_dec, Prolog_term_ref t_pip_tree)
Prolog_foreign_return_type ppl_new_PIP_Problem_from_PIP_Problem(Prolog_term_ref t_pip_source, Prolog_term_ref t_pip)
Prolog_foreign_return_type ppl_finalize()
Prolog_foreign_return_type ppl_PIP_Problem_is_satisfiable(Prolog_term_ref t_pip)
Prolog_foreign_return_type ppl_set_irrational_precision(Prolog_term_ref t_p)
Prolog_foreign_return_type ppl_Coefficient_min(Prolog_term_ref t_min)
Prolog_foreign_return_type ppl_new_PIP_Problem_from_space_dimension(Prolog_term_ref t_nd, Prolog_term_ref t_pip)
Prolog_foreign_return_type ppl_MIP_Problem_swap(Prolog_term_ref t_lhs, Prolog_term_ref t_rhs)
Prolog_foreign_return_type ppl_Coefficient_is_bounded()
Prolog_foreign_return_type ppl_set_timeout(Prolog_term_ref t_csecs)
Prolog_foreign_return_type ppl_irrational_precision(Prolog_term_ref t_p)
Prolog_foreign_return_type ppl_MIP_Problem_objective_function(Prolog_term_ref t_mip, Prolog_term_ref t_le_expr)
Prolog_foreign_return_type ppl_MIP_Problem_ascii_dump(Prolog_term_ref t_mip)
Prolog_foreign_return_type ppl_reset_timeout()
Prolog_foreign_return_type ppl_PIP_Problem_constraints(Prolog_term_ref t_pip, Prolog_term_ref t_cs)
Prolog_foreign_return_type ppl_MIP_Problem_integer_space_dimensions(Prolog_term_ref t_mip, Prolog_term_ref t_vlist)
Prolog_foreign_return_type ppl_MIP_Problem_optimal_value(Prolog_term_ref t_mip, Prolog_term_ref t_n, Prolog_term_ref t_d)
Prolog_foreign_return_type ppl_MIP_Problem_optimizing_point(Prolog_term_ref t_mip, Prolog_term_ref t_g)
Prolog_foreign_return_type ppl_PIP_Tree_Node_OK(Prolog_term_ref t_pip_tree)
Prolog_foreign_return_type ppl_MIP_Problem_add_to_integer_space_dimensions(Prolog_term_ref t_mip, Prolog_term_ref t_vlist)
Prolog_foreign_return_type ppl_initialize()
Prolog_foreign_return_type ppl_max_space_dimension(Prolog_term_ref t_msd)