[PPL-devel] [GIT] ppl/ppl(master): Added ppl_PIP_Problem_has_big_parameter_dimension

Patricia Hill p.m.hill at leeds.ac.uk
Thu Apr 8 17:22:15 CEST 2010


Module: ppl/ppl
Branch: master
Commit: be24cc575d751884fdf867291842645b3c8096ae
URL:    http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=be24cc575d751884fdf867291842645b3c8096ae

Author: Patricia Hill <p.m.hill at leeds.ac.uk>
Date:   Thu Apr  8 16:20:40 2010 +0100

Added ppl_PIP_Problem_has_big_parameter_dimension
that returns true if and only if the pip problem has a
big parameter set.

---

 interfaces/OCaml/OCaml_interface.dox   |    5 +++++
 interfaces/OCaml/ppl_ocaml_common.cc   |   12 +++++++++++-
 interfaces/OCaml/ppl_ocaml_globals.ml  |    5 ++++-
 interfaces/OCaml/ppl_ocaml_globals.mli |    5 ++++-
 interfaces/OCaml/tests/test1.ml        |    9 +++++++++
 5 files changed, 33 insertions(+), 3 deletions(-)

diff --git a/interfaces/OCaml/OCaml_interface.dox b/interfaces/OCaml/OCaml_interface.dox
index 7d9fb8b..affac00 100644
--- a/interfaces/OCaml/OCaml_interface.dox
+++ b/interfaces/OCaml/OCaml_interface.dox
@@ -531,6 +531,11 @@ defining parametric integer programming problems.
    Exception is thrown if no big parameter dimension has been set.
 
 <H2><CODE>
+  ppl_PIP_Problem_has_big_parameter_dimension handle
+</CODE></H2>
+   Returns true if and only if the dimension for the big parameter has been set.
+
+<H2><CODE>
   ppl_PIP_Problem_is_satisfiable handle
 </CODE></H2>
   Returns true if the PIP Problem referenced by
diff --git a/interfaces/OCaml/ppl_ocaml_common.cc b/interfaces/OCaml/ppl_ocaml_common.cc
index 305c569..a852f53 100644
--- a/interfaces/OCaml/ppl_ocaml_common.cc
+++ b/interfaces/OCaml/ppl_ocaml_common.cc
@@ -1371,7 +1371,7 @@ CATCH_ALL
 extern "C"
 CAMLprim value
 ppl_PIP_Problem_set_big_parameter_dimension(value caml_pip,
-				                  value caml_dim) try {
+				            value caml_dim) try {
   CAMLparam2(caml_pip, caml_dim);
   dimension_type ppl_dim = value_to_ppl_dimension(caml_dim);
   PIP_Problem& ppl_pip = *p_PIP_Problem_val(caml_pip);
@@ -1396,6 +1396,16 @@ CATCH_ALL
 
 extern "C"
 CAMLprim value
+ppl_PIP_Problem_has_big_parameter_dimension(value caml_pip) try {
+  CAMLparam1(caml_pip);
+  PIP_Problem& ppl_pip = *p_PIP_Problem_val(caml_pip);
+  dimension_type d = ppl_pip.get_big_parameter_dimension();
+  CAMLreturn(Val_bool(d != not_a_dimension()));
+}
+CATCH_ALL
+
+extern "C"
+CAMLprim value
 ppl_PIP_Problem_is_satisfiable(value caml_pip) try {
   CAMLparam1(caml_pip);
   PIP_Problem& ppl_pip = *p_PIP_Problem_val(caml_pip);
diff --git a/interfaces/OCaml/ppl_ocaml_globals.ml b/interfaces/OCaml/ppl_ocaml_globals.ml
index 3d1e7a4..408febf 100644
--- a/interfaces/OCaml/ppl_ocaml_globals.ml
+++ b/interfaces/OCaml/ppl_ocaml_globals.ml
@@ -362,8 +362,11 @@ external ppl_PIP_Problem_optimizing_solution:
 external ppl_PIP_Problem_get_big_parameter_dimension:
   pip_problem -> int = "ppl_PIP_Problem_get_big_parameter_dimension"
 
+external ppl_PIP_Problem_has_big_parameter_dimension:
+  pip_problem -> bool = "ppl_PIP_Problem_has_big_parameter_dimension"
+
 external ppl_PIP_Problem_set_big_parameter_dimension:
-  pip_problem -> int = "ppl_PIP_Problem_set_big_parameter_dimension"
+  pip_problem -> int -> unit = "ppl_PIP_Problem_set_big_parameter_dimension"
 
 external ppl_PIP_Problem_OK:
   pip_problem -> bool
diff --git a/interfaces/OCaml/ppl_ocaml_globals.mli b/interfaces/OCaml/ppl_ocaml_globals.mli
index 8ffb016..79cff49 100644
--- a/interfaces/OCaml/ppl_ocaml_globals.mli
+++ b/interfaces/OCaml/ppl_ocaml_globals.mli
@@ -317,7 +317,10 @@ val ppl_PIP_Problem_get_big_parameter_dimension:
   pip_problem -> int
 
 val ppl_PIP_Problem_set_big_parameter_dimension:
-  pip_problem -> int
+  pip_problem -> int -> unit
+
+val ppl_PIP_Problem_has_big_parameter_dimension:
+  pip_problem -> bool
 
 val ppl_PIP_Problem_OK:
   pip_problem -> bool
diff --git a/interfaces/OCaml/tests/test1.ml b/interfaces/OCaml/tests/test1.ml
index 66d6b8a..a3d84aa 100644
--- a/interfaces/OCaml/tests/test1.ml
+++ b/interfaces/OCaml/tests/test1.ml
@@ -533,6 +533,15 @@ let out = if (i == Cutting_Strategy_First)
   else "PIP Problem Control Parameter test failed"
     in (print_string_if_noisy out);;
 print_string_if_noisy "\n";;
+let b0 = ppl_PIP_Problem_has_big_parameter_dimension pip2;;
+ppl_PIP_Problem_set_big_parameter_dimension pip2 7;;
+let big_par = ppl_PIP_Problem_get_big_parameter_dimension pip2;;
+let b1 = ppl_PIP_Problem_has_big_parameter_dimension pip2;;
+let out = if (not b0 & b1 & (big_par = 7))
+  then "ppl_PIP_Problem big parameter dimension tests succeeded"
+  else "ppl_PIP_Problem big parameter dimension tests failed"
+    in (print_string_if_noisy out);;
+print_string_if_noisy "\n";;
 let out = if (ppl_PIP_Problem_is_satisfiable pip2)
   then "ppl_PIP_Problem_is_satisfiable test succeeded"
   else "ppl_PIP_Problem_is_satisfiable test failed"




More information about the PPL-devel mailing list