This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "roboptim-core-plugin-ipopt".
The branch, master has been updated
via 5969cebdb6746deb3dd17c2afed109649a2f2e19 (commit)
from 457e3a7c13b08437cb3d7eb3c34d9dd8ab8dfdbf (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 5969cebdb6746deb3dd17c2afed109649a2f2e19
Author: Thomas Moulard <[email protected]>
Date: Mon Mar 1 11:46:23 2010 +0100
Upgrade to RobOptim core 0.5.6.
CAUTION: starting from now, $(libdir)/roboptim-core /MUST/
be in your LT_LIBRARY_PATH! It is also recommended to remove
manually your old $(libdir)/roboptim-core-ipopt* files.
* configure.ac: Require newer roboptim-core.
* include/roboptim/core/plugin/ipopt.hh:
Declare parameters management methods.
* src/Makefile.am: Install plug-in in separate directory.
* src/roboptim-core-ipopt-plugin.cc: Management parameters properly.
* tests/plugin.stdout,
* tests/simple.stdout: Regenerate.
Signed-off-by: Thomas Moulard <[email protected]>
diff --git a/ChangeLog b/ChangeLog
index ed628fd..dfc762e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2010-03-01 Thomas Moulard <[email protected]>
+
+ Upgrade to RobOptim core 0.5.6.
+
+ CAUTION: starting from now, $(libdir)/roboptim-core /MUST/
+ be in your LT_LIBRARY_PATH! It is also recommended to remove
+ manually your old $(libdir)/roboptim-core-ipopt* files.
+
+ * configure.ac: Require newer roboptim-core.
+ * include/roboptim/core/plugin/ipopt.hh:
+ Declare parameters management methods.
+ * src/Makefile.am: Install plug-in in separate directory.
+ * src/roboptim-core-ipopt-plugin.cc: Management parameters properly.
+ * tests/plugin.stdout,
+ * tests/simple.stdout: Regenerate.
+
2009-08-24 Thomas Moulard <[email protected]>
Update to new SourceForge URLs.
diff --git a/configure.ac b/configure.ac
index b935d04..927ad3b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -58,7 +58,7 @@ JRL_PROG_DOXYGEN
LT_INIT([dlopen])
# Search for roboptim-core.
-ROBOPTIM_CORE_PKG_CONFIG([roboptim-core >= 0.2])
+ROBOPTIM_CORE_PKG_CONFIG([roboptim-core >= 0.5.6])
# Search for Ipopt.
IPOPT_HEADERS(, [AC_MSG_FAILURE(["Ipopt header not found."])])
diff --git a/include/roboptim/core/plugin/ipopt.hh
b/include/roboptim/core/plugin/ipopt.hh
index 5e85c49..e0fec0b 100644
--- a/include/roboptim/core/plugin/ipopt.hh
+++ b/include/roboptim/core/plugin/ipopt.hh
@@ -17,11 +17,17 @@
#ifndef ROBOPTIM_CORE_IPOPT_HH
# define ROBOPTIM_CORE_IPOPT_HH
+# include <roboptim/core/sys.hh>
+# include <roboptim/core/portability.hh>
+
# include <boost/mpl/vector.hpp>
+
# include <coin/IpSmartPtr.hpp>
+
# include <roboptim/core/solver.hh>
# include <roboptim/core/twice-derivable-function.hh>
+
/// \brief Ipopt classes.
namespace Ipopt
{
@@ -47,8 +53,9 @@ namespace roboptim
///
/// \warning Ipopt needs twice derivable functions, so be sure
/// to provide hessians in your function's problems.
- class IpoptSolver : public Solver<TwiceDerivableFunction,
- boost::mpl::vector<TwiceDerivableFunction> >
+ class ROBOPTIM_DLLEXPORT IpoptSolver
+ : public Solver<TwiceDerivableFunction,
+ boost::mpl::vector<TwiceDerivableFunction> >
{
public:
friend class detail::MyTNLP;
@@ -74,6 +81,16 @@ namespace roboptim
virtual Ipopt::SmartPtr<Ipopt::IpoptApplication> getIpoptApplication ()
throw ();
private:
+ /// \brief Initialize parameters.
+ ///
+ /// Add solver parameters. Called during construction.
+ void initializeParameters () throw ();
+
+ /// \brief Read parameters and update associated options in Ipopt.
+ ///
+ /// Called before solving problem.
+ void updateParameters () throw ();
+
/// \brief Smart pointer to the Ipopt non linear problem description.
Ipopt::SmartPtr<Ipopt::TNLP> nlp_;
/// \brief Smart pointer to the Ipopt application instance.
diff --git a/src/Makefile.am b/src/Makefile.am
index 7e227fa..9d4c8a8 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -10,7 +10,10 @@ AM_CPPFLAGS += $(ROBOPTIMCORE_CFLAGS)
# Add available warnings flags.
AM_CXXFLAGS += $(WARNING_CXXFLAGS)
-lib_LTLIBRARIES = roboptim-core-ipopt-plugin.la
+# Define plug-in directory.
+plugindir = $(libdir)/roboptim-core
+
+plugin_LTLIBRARIES = roboptim-core-ipopt-plugin.la
roboptim_core_ipopt_plugin_la_SOURCES = doc.hh roboptim-core-ipopt-plugin.cc
diff --git a/src/roboptim-core-ipopt-plugin.cc
b/src/roboptim-core-ipopt-plugin.cc
index 663b334..b413de1 100644
--- a/src/roboptim-core-ipopt-plugin.cc
+++ b/src/roboptim-core-ipopt-plugin.cc
@@ -18,6 +18,9 @@
#include <cassert>
#include <cstring>
+#include <boost/foreach.hpp>
+#include <boost/variant/apply_visitor.hpp>
+
#include <coin/IpIpoptApplication.hpp>
#include <coin/IpTNLP.hpp>
@@ -501,12 +504,110 @@ namespace roboptim
nlp_ (new MyTNLP (*this)),
app_ (new IpoptApplication (false, false))
{
- // Set default options.
- app_->Options ()->SetNumericValue ("tol", 1e-7);
- app_->Options ()->SetStringValue ("mu_strategy", "adaptive");
- app_->Options ()->SetStringValue ("output_file", "");
+ // Initialize parameters.
+ initializeParameters ();
+ }
+
+#define DEFINE_PARAMETER(KEY, DESCRIPTION, VALUE) \
+ do { \
+ parameters_[KEY].description = DESCRIPTION; \
+ parameters_[KEY].value = VALUE; \
+ } while (0)
+
+ void
+ IpoptSolver::initializeParameters () throw ()
+ {
+ parameters_.clear ();
+
+ // Shared parameters.
+ DEFINE_PARAMETER ("max-iterations", "number of iterations", 3000);
+
+ // IPOPT specific.
+ // Much more options are available for Ipopt, see ``Options reference'' of
+ // Ipopt documentation.
+
+ // Output
+ DEFINE_PARAMETER ("ipopt.print_level", "output verbosity level", 5);
+ DEFINE_PARAMETER ("ipopt.print_user_options",
+ "print all options set by the user", "no");
+ DEFINE_PARAMETER ("ipopt.print_options_documentation",
+ "switch to print all algorithmic options", "no");
+ DEFINE_PARAMETER
+ ("ipopt.output_file",
+ "file name of desired output file (leave unset for no file output)",
"");
+ DEFINE_PARAMETER ("ipopt.file_print_level",
+ "verbosity level for output file", 5);
+ DEFINE_PARAMETER ("ipopt.option_file_name",
+ "file name of options file (to overwrite default)", "");
+
+ // Termination
+ DEFINE_PARAMETER ("ipopt.tol",
+ "desired convergence tolerance (relative)", 1e-7);
+
+ // Barrier parameter
+ DEFINE_PARAMETER ("ipopt.mu_strategy",
+ "update strategy for barrier parameter", "adaptive");
- //app_->Options ()->SetStringValue ("nlp_scaling_method", "user-scaling");
+ }
+
+#undef DEFINE_PARAMETER
+
+
+ namespace
+ {
+ struct IpoptParametersUpdater
+ : public boost::static_visitor<>
+ {
+ explicit IpoptParametersUpdater
+ (const Ipopt::SmartPtr<Ipopt::IpoptApplication>& app,
+ const std::string& key)
+ : app (app),
+ key (key)
+
+ {}
+ void
+ operator () (const Function::value_type& val) const
+ {
+ app->Options ()->SetNumericValue (key, val);
+ }
+
+ void
+ operator () (const int& val) const
+ {
+ app->Options ()->SetNumericValue (key, val);
+ }
+
+ void
+ operator () (const std::string& val) const
+ {
+ app->Options ()->SetStringValue (key, val);
+ }
+
+ private:
+ const Ipopt::SmartPtr<Ipopt::IpoptApplication>& app;
+ const std::string& key;
+ };
+ } // end of anonymous namespace.
+
+ void
+ IpoptSolver::updateParameters () throw ()
+ {
+ const std::string prefix = "ipopt.";
+ typedef const std::pair<const std::string, Parameter> const_iterator_t;
+ BOOST_FOREACH (const_iterator_t& it, parameters_)
+ {
+ if (it.first.substr (0, prefix.size ()) == prefix)
+ {
+ boost::apply_visitor
+ (IpoptParametersUpdater
+ (app_, it.first.substr (prefix.size ())), it.second.value);
+ }
+ }
+
+ // Remap standardized parameters.
+ boost::apply_visitor
+ (IpoptParametersUpdater
+ (app_, "max_iter"), parameters_["max-iterations"].value);
}
IpoptSolver::~IpoptSolver () throw ()
@@ -571,6 +672,8 @@ namespace roboptim
void
IpoptSolver::solve () throw ()
{
+ // Read parameters and forward them to Ipopt.
+ updateParameters ();
ApplicationReturnStatus status = app_->Initialize ("");
switch (status)
@@ -603,15 +706,21 @@ extern "C"
using namespace roboptim;
typedef IpoptSolver::parent_t solver_t;
- solver_t* create (const IpoptSolver::problem_t& pb);
- void destroy (solver_t* p);
+ ROBOPTIM_DLLEXPORT unsigned getSizeOfProblem ();
+ ROBOPTIM_DLLEXPORT solver_t* create (const IpoptSolver::problem_t& pb);
+ ROBOPTIM_DLLEXPORT void destroy (solver_t* p);
+
+ ROBOPTIM_DLLEXPORT unsigned getSizeOfProblem ()
+ {
+ return sizeof (IpoptSolver::problem_t);
+ }
- solver_t* create (const IpoptSolver::problem_t& pb)
+ ROBOPTIM_DLLEXPORT solver_t* create (const IpoptSolver::problem_t& pb)
{
return new IpoptSolver (pb);
}
- void destroy (solver_t* p)
+ ROBOPTIM_DLLEXPORT void destroy (solver_t* p)
{
delete p;
}
diff --git a/tests/plugin.stdout b/tests/plugin.stdout
index ebcc32b..b285a32 100644
--- a/tests/plugin.stdout
+++ b/tests/plugin.stdout
@@ -1,23 +1,35 @@
-Problem:
- a * d * (a + b + c) + d (twice derivable function)
- Argument's bounds: (1, 5), (1, 5), (1, 5), (1, 5)
- Argument's scales: 1, 1, 1, 1
- Number of constraints: 2
- Constraint 0
- a * b * c * d (twice derivable function)
- Bounds: (25, inf)
- Scales: 1
- Initial value: [1](25)
-
- Constraint 1
- a * a + b * b + c * c + d * d (twice derivable function)
- Bounds: (40, 40)
- Scales: 1
- Initial value: [1](52)
-
- Starting point: [4](1,5,5,1)
- Starting value: [1](12)
- Infinity value (for all functions): inf
+Solver:
+ Problem:
+ a * d * (a + b + c) + d (twice derivable function)
+ Argument's bounds: (1, 5), (1, 5), (1, 5), (1, 5)
+ Argument's scales: 1, 1, 1, 1
+ Number of constraints: 2
+ Constraint 0
+ a * b * c * d (twice derivable function)
+ Bounds: (25, inf)
+ Scales: 1
+ Initial value: [1](25)
+
+ Constraint 1
+ a * a + b * b + c * c + d * d (twice derivable function)
+ Bounds: (40, 40)
+ Scales: 1
+ Initial value: [1](52) (constraint not satisfied)
+
+ Starting point: [4](1,5,5,1)
+ Starting value: [1](12)
+ Infinity value (for all functions): inf
+ Parameters:
+ ipopt.file_print_level (verbosity level for output file): 5
+ ipopt.mu_strategy (update strategy for barrier parameter): adaptive
+ ipopt.option_file_name (file name of options file (to overwrite default)):
+ ipopt.output_file (file name of desired output file (leave unset for no
file output)):
+ ipopt.print_level (output verbosity level): 5
+ ipopt.print_options_documentation (switch to print all algorithmic
options): no
+ ipopt.print_user_options (print all options set by the user): no
+ ipopt.tol (desired convergence tolerance (relative)): 1e-07
+ max-iterations (number of iterations): 3000
+
A solution has been found:
Result:
Size (input, output): 4, 1
diff --git a/tests/simple.stdout b/tests/simple.stdout
index ebcc32b..b285a32 100644
--- a/tests/simple.stdout
+++ b/tests/simple.stdout
@@ -1,23 +1,35 @@
-Problem:
- a * d * (a + b + c) + d (twice derivable function)
- Argument's bounds: (1, 5), (1, 5), (1, 5), (1, 5)
- Argument's scales: 1, 1, 1, 1
- Number of constraints: 2
- Constraint 0
- a * b * c * d (twice derivable function)
- Bounds: (25, inf)
- Scales: 1
- Initial value: [1](25)
-
- Constraint 1
- a * a + b * b + c * c + d * d (twice derivable function)
- Bounds: (40, 40)
- Scales: 1
- Initial value: [1](52)
-
- Starting point: [4](1,5,5,1)
- Starting value: [1](12)
- Infinity value (for all functions): inf
+Solver:
+ Problem:
+ a * d * (a + b + c) + d (twice derivable function)
+ Argument's bounds: (1, 5), (1, 5), (1, 5), (1, 5)
+ Argument's scales: 1, 1, 1, 1
+ Number of constraints: 2
+ Constraint 0
+ a * b * c * d (twice derivable function)
+ Bounds: (25, inf)
+ Scales: 1
+ Initial value: [1](25)
+
+ Constraint 1
+ a * a + b * b + c * c + d * d (twice derivable function)
+ Bounds: (40, 40)
+ Scales: 1
+ Initial value: [1](52) (constraint not satisfied)
+
+ Starting point: [4](1,5,5,1)
+ Starting value: [1](12)
+ Infinity value (for all functions): inf
+ Parameters:
+ ipopt.file_print_level (verbosity level for output file): 5
+ ipopt.mu_strategy (update strategy for barrier parameter): adaptive
+ ipopt.option_file_name (file name of options file (to overwrite default)):
+ ipopt.output_file (file name of desired output file (leave unset for no
file output)):
+ ipopt.print_level (output verbosity level): 5
+ ipopt.print_options_documentation (switch to print all algorithmic
options): no
+ ipopt.print_user_options (print all options set by the user): no
+ ipopt.tol (desired convergence tolerance (relative)): 1e-07
+ max-iterations (number of iterations): 3000
+
A solution has been found:
Result:
Size (input, output): 4, 1
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 16 ++++
configure.ac | 2 +-
include/roboptim/core/plugin/ipopt.hh | 21 +++++-
src/Makefile.am | 5 +-
src/roboptim-core-ipopt-plugin.cc | 127 ++++++++++++++++++++++++++++++---
tests/plugin.stdout | 52 ++++++++-----
tests/simple.stdout | 52 ++++++++-----
7 files changed, 222 insertions(+), 53 deletions(-)
hooks/post-receive
--
roboptim-core-plugin-ipopt
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
roboptim-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/roboptim-commit