[PPL-devel] [GIT] ppl/ppl(pip): Added the c interface for as_decision() and as_solution ().
Patricia Hill
p.m.hill at leeds.ac.uk
Fri Oct 9 14:04:18 CEST 2009
Module: ppl/ppl
Branch: pip
Commit: 50e259b4f41c623bdc490f3f2c2616b9c45eece2
URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=50e259b4f41c623bdc490f3f2c2616b9c45eece2
Author: Patricia Hill <p.m.hill at leeds.ac.uk>
Date: Thu Oct 8 20:52:56 2009 +0100
Added the c interface for as_decision() and as_solution().
---
interfaces/C/ppl_c_header.h | 26 +++++++++++++------
interfaces/C/ppl_c_implementation_common.cc | 15 +++++++++++
.../C/ppl_c_implementation_common.inlines.hh | 4 +++
3 files changed, 37 insertions(+), 8 deletions(-)
diff --git a/interfaces/C/ppl_c_header.h b/interfaces/C/ppl_c_header.h
index 4dd294b..d187ba6 100644
--- a/interfaces/C/ppl_c_header.h
+++ b/interfaces/C/ppl_c_header.h
@@ -695,6 +695,8 @@ PPL_TYPE_DECLARATION(MIP_Problem)
*/
PPL_TYPE_DECLARATION(PIP_Problem)
PPL_TYPE_DECLARATION(PIP_Tree_Node)
+PPL_TYPE_DECLARATION(PIP_Decision_Node)
+PPL_TYPE_DECLARATION(PIP_Solution_Node)
#undef PPL_DECLARE_PRINT_FUNCTIONS
@@ -2319,11 +2321,6 @@ extern int PPL_MIP_PROBLEM_CONTROL_PARAMETER_PRICING_STEEPEST_EDGE_FLOAT;
extern int PPL_PIP_PROBLEM_STATUS_UNFEASIBLE;
/*! \relates ppl_PIP_Problem_tag \brief
- Code of the "unbounded PIP problem" status.
-*/
-extern int PPL_PIP_PROBLEM_STATUS_UNBOUNDED;
-
-/*! \relates ppl_PIP_Problem_tag \brief
Code of the "optimized PIP problem" status.
*/
extern int PPL_PIP_PROBLEM_STATUS_OPTIMIZED;
@@ -2785,9 +2782,6 @@ ppl_PIP_Problem_is_satisfiable PPL_PROTO((ppl_const_PIP_Problem_t pip));
\return
<CODE>PPL_PIP_PROBLEM_STATUS_UNFEASIBLE</CODE> if the PIP problem
is not satisfiable;
- <CODE>PPL_PIP_PROBLEM_STATUS_UNBOUNDED</CODE> if the PIP problem
- is satisfiable but there is no finite bound to the value of
- the objective function;
<CODE>PPL_PIP_PROBLEM_STATUS_OPTIMIZED</CODE> if the PIP problem
admits an optimal solution.
*/
@@ -2900,6 +2894,22 @@ int
ppl_PIP_Problem_set_control_parameter
PPL_PROTO((ppl_PIP_Problem_t pip, int value));
+/*! \relates ppl_PIP_Problem_tag \brief
+ Returns \p this if \p *this is a solution node, 0 otherwise.
+*/
+int
+ppl_PIP_Problem_as_solution
+PPL_PROTO((ppl_const_PIP_Tree_Node_t spip_tree,
+ ppl_const_PIP_Solution_Node_t* dpip_tree));
+
+/*! \relates ppl_PIP_Problem_tag \brief
+ Returns \p this if \p *this is a decision node, 0 otherwise.
+*/
+int
+ppl_PIP_Problem_as_decision
+PPL_PROTO((ppl_const_PIP_Tree_Node_t spip_tree,
+ ppl_const_PIP_Decision_Node_t* dpip_tree));
+
/*@}*/ /* Querying/Setting Control Parameters */
PPL_DECLARE_AND_DOCUMENT_IO_FUNCTIONS(MIP_Problem)
diff --git a/interfaces/C/ppl_c_implementation_common.cc b/interfaces/C/ppl_c_implementation_common.cc
index 73a1816..b7da61c 100644
--- a/interfaces/C/ppl_c_implementation_common.cc
+++ b/interfaces/C/ppl_c_implementation_common.cc
@@ -2237,6 +2237,21 @@ ppl_PIP_Problem_OK(ppl_const_PIP_Problem_t pip) try {
}
CATCH_ALL
+int
+ppl_PIP_Problem_as_solution(ppl_const_PIP_Tree_Node_t spip_tree,
+ ppl_const_PIP_Solution_Node_t* dpip_tree) try {
+ *dpip_tree = to_const(to_const(spip_tree)->as_solution());
+ return 0;
+}
+CATCH_ALL
+
+int
+ppl_PIP_Problem_as_decision(ppl_const_PIP_Tree_Node_t spip_tree,
+ ppl_const_PIP_Decision_Node_t* dpip_tree) try {
+ *dpip_tree = to_const(to_const(spip_tree)->as_decision());
+ return 0;
+}
+CATCH_ALL
int
ppl_io_print_variable(ppl_dimension_type var) try {
diff --git a/interfaces/C/ppl_c_implementation_common.inlines.hh b/interfaces/C/ppl_c_implementation_common.inlines.hh
index 2065879..178be80 100644
--- a/interfaces/C/ppl_c_implementation_common.inlines.hh
+++ b/interfaces/C/ppl_c_implementation_common.inlines.hh
@@ -81,6 +81,10 @@ DECLARE_CONVERSIONS(PIP_Problem, PIP_Problem)
DECLARE_CONVERSIONS(PIP_Tree_Node, PIP_Tree_Node)
+DECLARE_CONVERSIONS(PIP_Decision_Node, PIP_Decision_Node)
+
+DECLARE_CONVERSIONS(PIP_Solution_Node, PIP_Solution_Node)
+
inline Relation_Symbol
relation_symbol(enum ppl_enum_Constraint_Type t) {
switch (t) {
More information about the PPL-devel
mailing list