roboptim-commit Mailing List for RobOptim (Page 96)
Status: Beta
Brought to you by:
flamiraux
You can subscribe to this list here.
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(62) |
Jul
(62) |
Aug
(36) |
Sep
(24) |
Oct
(41) |
Nov
(182) |
Dec
(8) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2010 |
Jan
(12) |
Feb
(13) |
Mar
(104) |
Apr
(95) |
May
(90) |
Jun
(90) |
Jul
(93) |
Aug
(97) |
Sep
(91) |
Oct
(93) |
Nov
(90) |
Dec
(95) |
2011 |
Jan
(96) |
Feb
(84) |
Mar
(94) |
Apr
(91) |
May
(93) |
Jun
(91) |
Jul
(93) |
Aug
(93) |
Sep
(107) |
Oct
(93) |
Nov
(58) |
Dec
|
2012 |
Jan
(8) |
Feb
(4) |
Mar
|
Apr
(3) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
(6) |
Dec
(5) |
2013 |
Jan
(16) |
Feb
(22) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Thomas M. <tho...@us...> - 2009-06-26 10:07:02
|
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". The branch, core has been updated via 0793bf10a57fc949e0d614daf985db2bf18ba7bd (commit) from 36cee3b8d16c882203774e6333a6b6fed53b3ba8 (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 0793bf10a57fc949e0d614daf985db2bf18ba7bd Author: Thomas Moulard <tho...@gm...> Date: Fri Jun 26 19:01:31 2009 +0900 Add method to allow safe iteration on a discrete interval. * include/roboptim/core/function.hh: Implement foreach. * tests/simple.cc: Test foreach. * tests/simple.stdout: Regenerate. Signed-off-by: Thomas Moulard <tho...@gm...> diff --git a/ChangeLog b/ChangeLog index 896aaa1..f560217 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2009-06-26 Thomas Moulard <tho...@gm...> + Add method to allow safe iteration on a discrete interval. + * include/roboptim/core/function.hh: Implement foreach. + * tests/simple.cc: Test foreach. + * tests/simple.stdout: Regenerate. + +2009-06-26 Thomas Moulard <tho...@gm...> + Add optional function name. * include/roboptim/core/derivable-function.hh, * include/roboptim/core/function.hh, diff --git a/include/roboptim/core/function.hh b/include/roboptim/core/function.hh index 7f3ef7e..5075c13 100644 --- a/include/roboptim/core/function.hh +++ b/include/roboptim/core/function.hh @@ -208,6 +208,35 @@ namespace roboptim return boost::get<2> (interval); } + /// \brief Iterate on an interval + /// + /// Call the functor to each discretization point of the discrete + /// interval. + /// \param interval iterval on which the method iterates + /// \param functor unary function that will be applied + /// \tparam F functor type (has to satisfy the STL unary function concept) + template <typename F> + static void foreach (const discreteInterval_t interval, + F functor) + { + const value_type delta = + getUpperBound (interval) - getLowerBound (interval); + assert (delta >= 0.); + + value_type n = floor (delta / getStep (interval)); + + for (size_type i = 0; i <= n; ++i) + { + const value_type t = + getLowerBound (interval) + i * getStep (interval); + std::cout << i << std::endl; + std::cout << t << std::endl; + assert (getLowerBound (interval) <= t + && t <= getUpperBound (interval)); + functor (t); + } + } + /// \} /// \brief Check the given result size is valid. diff --git a/tests/simple.cc b/tests/simple.cc index f5b785e..aa1e313 100644 --- a/tests/simple.cc +++ b/tests/simple.cc @@ -41,6 +41,27 @@ struct F : public Function // No gradient, hessian. }; + +struct CountUnaryFunction +{ + typedef void Result; + + CountUnaryFunction (int& cnt) + : cnt_ (cnt) + {} + + void operator () (double x) + { + std::cout << "Discrete point: " << x + << " (cnt: " << ++cnt_ << ")" + << std::endl; + } + +private: + int& cnt_; +}; + + int run_test () { // Instantiate the function and the problem. @@ -98,6 +119,36 @@ int run_test () std::cout << gs->getMinimum<SolverError> ().what () << std::endl; + + // Check iteration in discrete intervals. + { + int cnt = 0; + CountUnaryFunction count (cnt); + + { + Function::discreteInterval_t interval (2.3, 3., 0.5); + Function::foreach (interval, count); + assert (cnt == 2); + std::cout << std::endl; + } + + { + cnt = 0; + Function::discreteInterval_t interval (2., 3., 0.1); + Function::foreach (interval, count); + assert (cnt == 11); + std::cout << std::endl; + } + + { + cnt = 0; + Function::discreteInterval_t interval (0.8, 10.8, 1.); + Function::foreach (interval, count); + assert (cnt == 11); + std::cout << std::endl; + } + } + return 0; } diff --git a/tests/simple.stdout b/tests/simple.stdout index 8366691..a881daf 100644 --- a/tests/simple.stdout +++ b/tests/simple.stdout @@ -28,3 +28,78 @@ Problem: Starting value: [1](0) Infinity value (for all functions): inf The dummy solver always fail. +0 +2.3 +Discrete point: 2.3 (cnt: 1) +1 +2.8 +Discrete point: 2.8 (cnt: 2) + +0 +2 +Discrete point: 2 (cnt: 1) +1 +2.1 +Discrete point: 2.1 (cnt: 2) +2 +2.2 +Discrete point: 2.2 (cnt: 3) +3 +2.3 +Discrete point: 2.3 (cnt: 4) +4 +2.4 +Discrete point: 2.4 (cnt: 5) +5 +2.5 +Discrete point: 2.5 (cnt: 6) +6 +2.6 +Discrete point: 2.6 (cnt: 7) +7 +2.7 +Discrete point: 2.7 (cnt: 8) +8 +2.8 +Discrete point: 2.8 (cnt: 9) +9 +2.9 +Discrete point: 2.9 (cnt: 10) +10 +3 +Discrete point: 3 (cnt: 11) + +0 +0.8 +Discrete point: 0.8 (cnt: 1) +1 +1.8 +Discrete point: 1.8 (cnt: 2) +2 +2.8 +Discrete point: 2.8 (cnt: 3) +3 +3.8 +Discrete point: 3.8 (cnt: 4) +4 +4.8 +Discrete point: 4.8 (cnt: 5) +5 +5.8 +Discrete point: 5.8 (cnt: 6) +6 +6.8 +Discrete point: 6.8 (cnt: 7) +7 +7.8 +Discrete point: 7.8 (cnt: 8) +8 +8.8 +Discrete point: 8.8 (cnt: 9) +9 +9.8 +Discrete point: 9.8 (cnt: 10) +10 +10.8 +Discrete point: 10.8 (cnt: 11) + ----------------------------------------------------------------------- Summary of changes: ChangeLog | 7 +++ include/roboptim/core/function.hh | 29 ++++++++++++++ tests/simple.cc | 51 +++++++++++++++++++++++++ tests/simple.stdout | 75 +++++++++++++++++++++++++++++++++++++ 4 files changed, 162 insertions(+), 0 deletions(-) hooks/post-receive -- roboptim |
From: Thomas M. <tho...@us...> - 2009-06-26 08:22:44
|
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". The branch, share has been updated via dd1eada2f026638571d2dc3b7f1fd7036259e645 (commit) from 96e3dd303b7e293b4ece4bf13c88848185b2be7b (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 dd1eada2f026638571d2dc3b7f1fd7036259e645 Author: Thomas Moulard <tho...@gm...> Date: Fri Jun 26 17:17:16 2009 +0900 Add titles to function. * optimization-tests/hs071.hh: Here. Signed-off-by: Thomas Moulard <tho...@gm...> diff --git a/ChangeLog b/ChangeLog index e65aa35..a14ed04 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-06-26 Thomas Moulard <tho...@gm...> + + Add titles to function. + * optimization-tests/hs071.hh: Here. + 2009-06-16 Thomas Moulard <tho...@gm...> Make initializeProblem generic. diff --git a/optimization-tests/hs071.hh b/optimization-tests/hs071.hh index 811dc27..ca40f0e 100644 --- a/optimization-tests/hs071.hh +++ b/optimization-tests/hs071.hh @@ -25,7 +25,7 @@ using namespace roboptim; struct F : public TwiceDerivableFunction { - F () : TwiceDerivableFunction (4, 1) + F () : TwiceDerivableFunction (4, 1, "a * d * (a + b + c) + d") { } @@ -75,7 +75,7 @@ struct F : public TwiceDerivableFunction struct G0 : public TwiceDerivableFunction { G0 () - : TwiceDerivableFunction (4, 1) + : TwiceDerivableFunction (4, 1, "a * b * c * d") { } @@ -125,7 +125,7 @@ struct G0 : public TwiceDerivableFunction struct G1 : public TwiceDerivableFunction { G1 () - : TwiceDerivableFunction (4, 1) + : TwiceDerivableFunction (4, 1, "a * a + b * b + c * c + d * d") { } ----------------------------------------------------------------------- Summary of changes: ChangeLog | 5 +++++ optimization-tests/hs071.hh | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) hooks/post-receive -- roboptim |
From: Thomas M. <tho...@us...> - 2009-06-26 08:22:07
|
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". The branch, core-ipopt-plugin has been updated via 89e2c2937cdf00fe888edd773666b1ced84ca225 (commit) from 0967cad9535871a901ea9b4c7644e9d5fac8bd37 (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 89e2c2937cdf00fe888edd773666b1ced84ca225 Author: Thomas Moulard <tho...@gm...> Date: Fri Jun 26 17:16:40 2009 +0900 Add titles to functions. * tests/hs071.hh: Add titles. * tests/plugin.stdout, * tests/simple.stdout: Regenerate. Signed-off-by: Thomas Moulard <tho...@gm...> diff --git a/ChangeLog b/ChangeLog index 017c725..a6621e9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2009-06-26 Thomas Moulard <tho...@gm...> + + Add titles to functions. + * tests/hs071.hh: Add titles. + * tests/plugin.stdout, + * tests/simple.stdout: Regenerate. + 2009-06-25 Thomas Moulard <tho...@gm...> Copy constraints final values in result object. diff --git a/tests/hs071.hh b/tests/hs071.hh index 811dc27..ca40f0e 100644 --- a/tests/hs071.hh +++ b/tests/hs071.hh @@ -25,7 +25,7 @@ using namespace roboptim; struct F : public TwiceDerivableFunction { - F () : TwiceDerivableFunction (4, 1) + F () : TwiceDerivableFunction (4, 1, "a * d * (a + b + c) + d") { } @@ -75,7 +75,7 @@ struct F : public TwiceDerivableFunction struct G0 : public TwiceDerivableFunction { G0 () - : TwiceDerivableFunction (4, 1) + : TwiceDerivableFunction (4, 1, "a * b * c * d") { } @@ -125,7 +125,7 @@ struct G0 : public TwiceDerivableFunction struct G1 : public TwiceDerivableFunction { G1 () - : TwiceDerivableFunction (4, 1) + : TwiceDerivableFunction (4, 1, "a * a + b * b + c * c + d * d") { } diff --git a/tests/plugin.stdout b/tests/plugin.stdout index 25aae4a..ebcc32b 100644 --- a/tests/plugin.stdout +++ b/tests/plugin.stdout @@ -1,14 +1,16 @@ Problem: - Twice derivable function + 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) diff --git a/tests/simple.stdout b/tests/simple.stdout index 25aae4a..ebcc32b 100644 --- a/tests/simple.stdout +++ b/tests/simple.stdout @@ -1,14 +1,16 @@ Problem: - Twice derivable function + 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) ----------------------------------------------------------------------- Summary of changes: ChangeLog | 7 +++++++ tests/hs071.hh | 6 +++--- tests/plugin.stdout | 4 +++- tests/simple.stdout | 4 +++- 4 files changed, 16 insertions(+), 5 deletions(-) hooks/post-receive -- roboptim |
From: Thomas M. <tho...@us...> - 2009-06-26 07:46:00
|
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". The branch, core has been updated via 36cee3b8d16c882203774e6333a6b6fed53b3ba8 (commit) via 93c26b9e37fa94f056d843913eb502f3c5bf49b1 (commit) from 6e6a3adf5d5b9358736e7c9dd01f5b6688bd2614 (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 36cee3b8d16c882203774e6333a6b6fed53b3ba8 Author: Thomas Moulard <tho...@gm...> Date: Fri Jun 26 16:40:29 2009 +0900 Add optional function name. * include/roboptim/core/derivable-function.hh, * include/roboptim/core/function.hh, * include/roboptim/core/linear-function.hh, * include/roboptim/core/n-times-derivable-function.hh, * include/roboptim/core/quadratic-function.hh, * include/roboptim/core/twice-derivable-function.hh: Add optional function name. * include/roboptim/core/problem.hxx: Display function name. * src/constant-function.cc, * src/derivable-function.cc, * src/function.cc, * src/identity-function.cc, * src/linear-function.cc, * src/numeric-linear-function.cc, * src/numeric-quadratic-function.cc, * src/quadratic-function.cc, * src/twice-derivable-function.cc, * tests/finite-difference-gradient.cc, * tests/n-times-derivable-function.cc, Add function name. * tests/plugin.cc, * tests/visualization-gnuplot-function.cc, * tests/simple.cc: Add titles to function. * tests/plugin.stdout, * tests/simple.stdout: Regenerate. Signed-off-by: Thomas Moulard <tho...@gm...> diff --git a/ChangeLog b/ChangeLog index 374250e..896aaa1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,34 @@ 2009-06-26 Thomas Moulard <tho...@gm...> + Add optional function name. + * include/roboptim/core/derivable-function.hh, + * include/roboptim/core/function.hh, + * include/roboptim/core/linear-function.hh, + * include/roboptim/core/n-times-derivable-function.hh, + * include/roboptim/core/quadratic-function.hh, + * include/roboptim/core/twice-derivable-function.hh: + Add optional function name. + * include/roboptim/core/problem.hxx: Display function name. + * src/constant-function.cc, + * src/derivable-function.cc, + * src/function.cc, + * src/identity-function.cc, + * src/linear-function.cc, + * src/numeric-linear-function.cc, + * src/numeric-quadratic-function.cc, + * src/quadratic-function.cc, + * src/twice-derivable-function.cc, + * tests/finite-difference-gradient.cc, + * tests/n-times-derivable-function.cc, + Add function name. + * tests/plugin.cc, + * tests/visualization-gnuplot-function.cc, + * tests/simple.cc: Add titles to function. + * tests/plugin.stdout, + * tests/simple.stdout: Regenerate. + +2009-06-26 Thomas Moulard <tho...@gm...> + Remove Boost.Variant display function. * include/roboptim/core/util.hh, * include/roboptim/core/util.hxx: diff --git a/include/roboptim/core/derivable-function.hh b/include/roboptim/core/derivable-function.hh index c981816..6ee422c 100644 --- a/include/roboptim/core/derivable-function.hh +++ b/include/roboptim/core/derivable-function.hh @@ -173,7 +173,10 @@ namespace roboptim /// /// \param inputSize input size (argument size) /// \param outputSize output size (result size) - DerivableFunction (size_type inputSize, size_type outputSize = 1) throw (); + /// \param function's name + DerivableFunction (size_type inputSize, + size_type outputSize = 1, + std::string name = std::string ()) throw (); /// \brief Jacobian evaluation. /// diff --git a/include/roboptim/core/function.hh b/include/roboptim/core/function.hh index e20da6a..7f3ef7e 100644 --- a/include/roboptim/core/function.hh +++ b/include/roboptim/core/function.hh @@ -19,6 +19,7 @@ # define ROBOPTIM_CORE_FUNCTION_HH # include <iostream> # include <limits> +# include <string> # include <utility> # include <boost/numeric/ublas/matrix.hpp> @@ -266,6 +267,14 @@ namespace roboptim assert (isValidResult (result)); } + /// \brief Get function name. + /// + /// \return Function's name. + const std::string& getName () const throw () + { + return name_; + } + /// \brief Display the function on the specified output stream. /// /// \param o output stream used for display @@ -277,7 +286,10 @@ namespace roboptim /// /// \param inputSize function arity /// \param outputSize result size - Function (size_type inputSize, size_type outputSize = 1) throw (); + /// \param name function's name + Function (size_type inputSize, + size_type outputSize = 1, + std::string name = std::string ()) throw (); /// \brief Function evaluation. @@ -290,11 +302,14 @@ namespace roboptim const throw () = 0; private: - /// Problem dimension. + /// \brief Problem dimension. const size_type inputSize_; - /// Result dimension. + /// \brief Result dimension. const size_type outputSize_; + + /// \brief Function name (for user-friendliness). + std::string name_; }; /// @} diff --git a/include/roboptim/core/linear-function.hh b/include/roboptim/core/linear-function.hh index f678b2b..3ec5fb6 100644 --- a/include/roboptim/core/linear-function.hh +++ b/include/roboptim/core/linear-function.hh @@ -35,7 +35,10 @@ namespace roboptim /// /// \param inputSize function arity /// \param outputSize result size - LinearFunction (size_type inputSize, size_type outputSize = 1) throw (); + /// \param name function's name + LinearFunction (size_type inputSize, + size_type outputSize = 1, + std::string name = std::string ()) throw (); /// \brief Display the function on the specified output stream. /// diff --git a/include/roboptim/core/n-times-derivable-function.hh b/include/roboptim/core/n-times-derivable-function.hh index 730b784..adeb5c5 100644 --- a/include/roboptim/core/n-times-derivable-function.hh +++ b/include/roboptim/core/n-times-derivable-function.hh @@ -138,8 +138,10 @@ namespace roboptim /// \brief Concrete class constructor should call this constructor. /// /// \param outputSize output size (result size) - NTimesDerivableFunction (size_type outputSize = 1) throw () - : TwiceDerivableFunction (1, outputSize) + /// \param name function's name + NTimesDerivableFunction (size_type outputSize = 1, + std::string name = std::string ()) throw () + : TwiceDerivableFunction (1, outputSize, name) {} /// \brief Function evaluation. @@ -248,8 +250,9 @@ namespace roboptim /// \brief Concrete class constructor should call this constructor. /// /// \param outputSize output size (result size) - NTimesDerivableFunction (size_type outputSize = 1) throw () - : NTimesDerivableFunction<DerivabilityOrder - 1> (outputSize) + NTimesDerivableFunction (size_type outputSize = 1, + std::string name = std::string ()) throw () + : NTimesDerivableFunction<DerivabilityOrder - 1> (outputSize, name) {} }; diff --git a/include/roboptim/core/problem.hxx b/include/roboptim/core/problem.hxx index b6cf676..0e2864a 100644 --- a/include/roboptim/core/problem.hxx +++ b/include/roboptim/core/problem.hxx @@ -209,12 +209,13 @@ namespace roboptim {} template <typename U> - void operator () (const U&) + void operator () (const U& constraint) { assert (problem_.constraints ().size () - i_ > 0); using namespace boost; o_ << iendl << incindent << "Constraint " << i_ << incindent << iendl + << *constraint << iendl << "Bounds: " << problem_.bounds ()[i_] << iendl << "Scales: " << problem_.scales ()[i_] << iendl; diff --git a/include/roboptim/core/quadratic-function.hh b/include/roboptim/core/quadratic-function.hh index b5cef84..c7bd4df 100644 --- a/include/roboptim/core/quadratic-function.hh +++ b/include/roboptim/core/quadratic-function.hh @@ -36,7 +36,10 @@ namespace roboptim /// /// \param inputSize function arity /// \param outputSize result size - QuadraticFunction (size_type inputSize, size_type outputSize = 1) throw (); + /// \param name function's name + QuadraticFunction (size_type inputSize, + size_type outputSize = 1, + std::string name = std::string ()) throw (); /// \brief Display the function on the specified output stream. /// diff --git a/include/roboptim/core/twice-derivable-function.hh b/include/roboptim/core/twice-derivable-function.hh index a115e26..30e4bae 100644 --- a/include/roboptim/core/twice-derivable-function.hh +++ b/include/roboptim/core/twice-derivable-function.hh @@ -121,8 +121,10 @@ namespace roboptim /// /// \param inputSize input size (argument size) /// \param outputSize output size (result size) + /// \param name function's name TwiceDerivableFunction (size_type inputSize, - size_type outputSize = 1) throw (); + size_type outputSize = 1, + std::string name = std::string ()) throw (); /// \brief Hessian evaluation. /// diff --git a/src/constant-function.cc b/src/constant-function.cc index 488c1d5..4f42cdf 100644 --- a/src/constant-function.cc +++ b/src/constant-function.cc @@ -26,7 +26,7 @@ namespace roboptim { ConstantFunction::ConstantFunction (const vector_t& offset) throw () - : LinearFunction (offset.size (), offset.size ()), + : LinearFunction (offset.size (), offset.size (), "constant function"), offset_ (offset) { } diff --git a/src/derivable-function.cc b/src/derivable-function.cc index c1009e0..823273d 100644 --- a/src/derivable-function.cc +++ b/src/derivable-function.cc @@ -22,9 +22,11 @@ namespace roboptim { - DerivableFunction::DerivableFunction (size_type n, size_type m) + DerivableFunction::DerivableFunction (size_type inputSize, + size_type outputSize, + std::string name) throw () - : Function (n, m) + : Function (inputSize, outputSize, name) { } @@ -44,7 +46,10 @@ namespace roboptim std::ostream& DerivableFunction::print (std::ostream& o) const throw () { - return o << "Derivable function"; + if (getName ().empty ()) + return o << "Derivable function"; + else + return o << getName () << " (derivable function)"; } } // end of namespace roboptim diff --git a/src/function.cc b/src/function.cc index 83f09ca..9846260 100644 --- a/src/function.cc +++ b/src/function.cc @@ -21,9 +21,12 @@ namespace roboptim { - Function::Function (size_type inputSize, size_type outputSize) throw () + Function::Function (size_type inputSize, + size_type outputSize, + std::string name) throw () : inputSize_ (inputSize), - outputSize_ (outputSize) + outputSize_ (outputSize), + name_ (name) { // Positive size is required. assert (inputSize > 0 && outputSize > 0); @@ -36,7 +39,10 @@ namespace roboptim std::ostream& Function::print (std::ostream& o) const throw () { - return o << "Function"; + if (getName ().empty ()) + return o << "Function"; + else + return o << getName () << " (not derivable)"; } std::ostream& diff --git a/src/identity-function.cc b/src/identity-function.cc index 6be5724..c87056f 100644 --- a/src/identity-function.cc +++ b/src/identity-function.cc @@ -26,7 +26,7 @@ namespace roboptim { IdentityFunction::IdentityFunction (const vector_t& offset) throw () - : LinearFunction (offset.size (), offset.size ()), + : LinearFunction (offset.size (), offset.size (), "identity function"), offset_ (offset) { } diff --git a/src/linear-function.cc b/src/linear-function.cc index 0e19d05..0af6f3c 100644 --- a/src/linear-function.cc +++ b/src/linear-function.cc @@ -21,8 +21,10 @@ namespace roboptim { - LinearFunction::LinearFunction (size_type n, size_type m) throw () - : QuadraticFunction (n, m) + LinearFunction::LinearFunction (size_type inputSize, + size_type outputSize, + std::string name) throw () + : QuadraticFunction (inputSize, outputSize, name) { } @@ -37,6 +39,9 @@ namespace roboptim std::ostream& LinearFunction::print (std::ostream& o) const throw () { - return o << "Linear function"; + if (getName ().empty ()) + return o << "Linear function"; + else + return o << getName () << " (linear function)"; } } // end of namespace roboptim diff --git a/src/numeric-linear-function.cc b/src/numeric-linear-function.cc index 0c32438..ffa9e7f 100644 --- a/src/numeric-linear-function.cc +++ b/src/numeric-linear-function.cc @@ -27,7 +27,7 @@ namespace roboptim NumericLinearFunction::NumericLinearFunction (const matrix_t& a, const vector_t& b) throw () - : LinearFunction (a.size2 (), a.size1 ()), + : LinearFunction (a.size2 (), a.size1 (), "numeric linear function"), a_ (a), b_ (b) { diff --git a/src/numeric-quadratic-function.cc b/src/numeric-quadratic-function.cc index c2b429f..fcc5d88 100644 --- a/src/numeric-quadratic-function.cc +++ b/src/numeric-quadratic-function.cc @@ -28,7 +28,7 @@ namespace roboptim NumericQuadraticFunction::NumericQuadraticFunction (const symmetric_t& a, const vector_t& b) throw () - : QuadraticFunction (a.size1 (), 1), + : QuadraticFunction (a.size1 (), 1, "numeric quadratic function"), a_ (a), b_ (b) { diff --git a/src/quadratic-function.cc b/src/quadratic-function.cc index 89da76c..6839012 100644 --- a/src/quadratic-function.cc +++ b/src/quadratic-function.cc @@ -21,15 +21,20 @@ namespace roboptim { - QuadraticFunction::QuadraticFunction (size_type n, size_type m) + QuadraticFunction::QuadraticFunction (size_type inputSize, + size_type outputSize, + std::string name) throw () - : TwiceDerivableFunction (n, m) + : TwiceDerivableFunction (inputSize, outputSize, name) { } std::ostream& QuadraticFunction::print (std::ostream& o) const throw () { - return o << "Quadratic function"; + if (getName ().empty ()) + return o << "Quadratic function"; + else + return o << getName () << " (quadratic function)"; } } // end of namespace roboptim diff --git a/src/twice-derivable-function.cc b/src/twice-derivable-function.cc index d834c9e..2909023 100644 --- a/src/twice-derivable-function.cc +++ b/src/twice-derivable-function.cc @@ -21,15 +21,20 @@ namespace roboptim { - TwiceDerivableFunction::TwiceDerivableFunction (size_type n, size_type m) - throw () - : DerivableFunction (n, m) + TwiceDerivableFunction::TwiceDerivableFunction + (size_type inputSize, + size_type outputSize, + std::string name) throw () + : DerivableFunction (inputSize, outputSize, name) { } std::ostream& TwiceDerivableFunction::print (std::ostream& o) const throw () { - return o << "Twice derivable function"; + if (getName ().empty ()) + return o << "Twice derivable function"; + else + return o << getName () << " (twice derivable function)"; } } // end of namespace roboptim diff --git a/tests/finite-difference-gradient.cc b/tests/finite-difference-gradient.cc index dcaccd7..7979f5a 100644 --- a/tests/finite-difference-gradient.cc +++ b/tests/finite-difference-gradient.cc @@ -33,7 +33,7 @@ using namespace roboptim::visualization::gnuplot; // Define a function with a correct gradient. struct FGood : public DerivableFunction { - FGood () : DerivableFunction (1, 1) + FGood () : DerivableFunction (1, 1, "x * x") {} void impl_compute (result_t& result, @@ -52,7 +52,7 @@ struct FGood : public DerivableFunction // Define a function with a bad gradient. struct FBad : public DerivableFunction { - FBad () : DerivableFunction (1, 1) + FBad () : DerivableFunction (1, 1, "x * x") {} void impl_compute (result_t& result, diff --git a/tests/n-times-derivable-function.cc b/tests/n-times-derivable-function.cc index 324afad..b14433c 100644 --- a/tests/n-times-derivable-function.cc +++ b/tests/n-times-derivable-function.cc @@ -23,7 +23,7 @@ using namespace roboptim; // Define a 10 times derivable null function. struct F : public NTimesDerivableFunction<10> { - F () : NTimesDerivableFunction<10> (4) + F () : NTimesDerivableFunction<10> (4, "0") {} virtual void impl_compute (result_t& result, double) const throw () diff --git a/tests/plugin.cc b/tests/plugin.cc index a43ee9b..8bcfeab 100644 --- a/tests/plugin.cc +++ b/tests/plugin.cc @@ -30,7 +30,7 @@ typedef Solver<Function, boost::mpl::vector<Function> > solver_t; // Define a simple function. struct F : public Function { - F () : Function (4, 1) + F () : Function (4, 1, "a * d * (a + b + c) + d") {} void impl_compute (result_t& result, const argument_t& argument) const throw () diff --git a/tests/plugin.stdout b/tests/plugin.stdout index fa2f775..dc67f65 100644 --- a/tests/plugin.stdout +++ b/tests/plugin.stdout @@ -1,5 +1,5 @@ Problem: - Function + a * d * (a + b + c) + d (not derivable) Argument's bounds: (-inf, inf), (-inf, inf), (-inf, inf), (-inf, inf) Argument's scales: 1, 1, 1, 1 No constraints. @@ -7,7 +7,7 @@ Problem: Infinity value (for all functions): inf --- Problem: - Function + a * d * (a + b + c) + d (not derivable) Argument's bounds: (-inf, inf), (-inf, inf), (-inf, inf), (-inf, inf) Argument's scales: 1, 1, 1, 1 No constraints. diff --git a/tests/simple.cc b/tests/simple.cc index 64296c3..f5b785e 100644 --- a/tests/simple.cc +++ b/tests/simple.cc @@ -28,7 +28,7 @@ typedef DummySolver solver_t; // Define a simple function. struct F : public Function { - F () : Function (4, 1) + F () : Function (4, 1, "a * d * (a + b + c) + d") {} void impl_compute (result_t& result, diff --git a/tests/simple.stdout b/tests/simple.stdout index 3a00df8..8366691 100644 --- a/tests/simple.stdout +++ b/tests/simple.stdout @@ -1,9 +1,10 @@ Problem: - Function + a * d * (a + b + c) + d (not derivable) Argument's bounds: (-inf, inf), (-inf, inf), (-inf, inf), (-inf, inf) Argument's scales: 1, 1, 1, 1 Number of constraints: 1 Constraint 0 + a * d * (a + b + c) + d (not derivable) Bounds: (0, 5) Scales: 3.5 Initial value: [1](0) @@ -13,11 +14,12 @@ Problem: Infinity value (for all functions): inf --- Problem: - Function + a * d * (a + b + c) + d (not derivable) Argument's bounds: (-inf, inf), (-inf, inf), (-inf, inf), (-inf, inf) Argument's scales: 1, 1, 1, 1 Number of constraints: 1 Constraint 0 + a * d * (a + b + c) + d (not derivable) Bounds: (0, 5) Scales: 3.5 Initial value: [1](0) diff --git a/tests/visualization-gnuplot-function.cc b/tests/visualization-gnuplot-function.cc index 28ffe37..4257341 100644 --- a/tests/visualization-gnuplot-function.cc +++ b/tests/visualization-gnuplot-function.cc @@ -31,7 +31,7 @@ using namespace roboptim::visualization; struct Square : public Function { explicit Square () - : Function (1, 1) + : Function (1, 1, "x * x") { } @@ -46,7 +46,7 @@ struct Square : public Function struct Circle : public Function { explicit Circle (double r = 1.) - : Function (1, 2), + : Function (1, 2, "{sin (x) * r; cos (x) * r}"), r_ (r) { } commit 93c26b9e37fa94f056d843913eb502f3c5bf49b1 Author: Thomas Moulard <tho...@gm...> Date: Fri Jun 26 15:18:17 2009 +0900 Remove Boost.Variant display function. * include/roboptim/core/util.hh, * include/roboptim/core/util.hxx: Remove code as this feature is already available in Boost. Signed-off-by: Thomas Moulard <tho...@gm...> diff --git a/ChangeLog b/ChangeLog index d3ceab0..374250e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2009-06-26 Thomas Moulard <tho...@gm...> + + Remove Boost.Variant display function. + * include/roboptim/core/util.hh, + * include/roboptim/core/util.hxx: + Remove code as this feature is already available + in Boost. + 2009-06-25 Thomas Moulard <tho...@gm...> Display constraints final state. diff --git a/include/roboptim/core/util.hh b/include/roboptim/core/util.hh index 9483a94..dca8312 100644 --- a/include/roboptim/core/util.hh +++ b/include/roboptim/core/util.hh @@ -17,7 +17,6 @@ #ifndef ROBOPTIM_CORE_UTIL_HH # define ROBOPTIM_CORE_UTIL_HH -# include <boost/variant.hpp> # include <roboptim/core/derivable-function.hh> namespace roboptim @@ -42,14 +41,6 @@ namespace roboptim const DerivableFunction::vector_t& x); } // end of namespace detail. - /// \brief Display a two types boost variant. - /// This command will fail if T1 or T2 is not displayable - /// (i.e. the operator<< is not overloaded for these types). - /// \tparam T1 first boost variant type - /// \tparam T2 second boost variant type - template <typename T1, typename T2> - std::ostream& operator<< (std::ostream&, const boost::variant<T1, T2>&); - /// \brief Display a vector. template <typename T> std::ostream& operator<< (std::ostream&, const std::vector<T>&); diff --git a/include/roboptim/core/util.hxx b/include/roboptim/core/util.hxx index 6814d37..1f87bd5 100644 --- a/include/roboptim/core/util.hxx +++ b/include/roboptim/core/util.hxx @@ -17,8 +17,6 @@ #ifndef ROBOPTIM_CORE_UTIL_HXX # define ROBOPTIM_CORE_UTIL_HXX -# include <boost/variant/apply_visitor.hpp> - # include <roboptim/core/function.hh> namespace roboptim @@ -38,42 +36,7 @@ namespace roboptim jac (i, j) = grad(0, j); } } - - - struct GenVariantPrintVisitor : public boost::static_visitor<void> - { - GenVariantPrintVisitor (std::ostream& o) - : o_ (o) - {} - - template <typename T> - void operator () (const T& value) - { - o_ << value; - } - - template <typename T> - void operator () (const T* value) - { - if (!value) - o_ << "Null pointer"; - else - o_ << *value; - } - - private: - std::ostream& o_; - }; - - }; // end of namespace detail. - - template <typename T1, typename T2> - std::ostream& operator<< (std::ostream& o, const boost::variant<T1, T2>& var) - { - detail::GenVariantPrintVisitor pv (o); - boost::apply_visitor (pv, var); - return o; - } + } // end of namespace detail. template <typename T> std::ostream& operator<< (std::ostream& o, const std::vector<T>& vect) ----------------------------------------------------------------------- Summary of changes: ChangeLog | 37 +++++++++++++++++++ include/roboptim/core/derivable-function.hh | 5 ++- include/roboptim/core/function.hh | 21 +++++++++-- include/roboptim/core/linear-function.hh | 5 ++- .../roboptim/core/n-times-derivable-function.hh | 11 ++++-- include/roboptim/core/problem.hxx | 3 +- include/roboptim/core/quadratic-function.hh | 5 ++- include/roboptim/core/twice-derivable-function.hh | 4 ++- include/roboptim/core/util.hh | 9 ----- include/roboptim/core/util.hxx | 39 +------------------- src/constant-function.cc | 2 +- src/derivable-function.cc | 11 ++++-- src/function.cc | 12 +++++-- src/identity-function.cc | 2 +- src/linear-function.cc | 11 ++++-- src/numeric-linear-function.cc | 2 +- src/numeric-quadratic-function.cc | 2 +- src/quadratic-function.cc | 11 ++++-- src/twice-derivable-function.cc | 13 +++++-- tests/finite-difference-gradient.cc | 4 +- tests/n-times-derivable-function.cc | 2 +- tests/plugin.cc | 2 +- tests/plugin.stdout | 4 +- tests/simple.cc | 2 +- tests/simple.stdout | 6 ++- tests/visualization-gnuplot-function.cc | 4 +- 26 files changed, 139 insertions(+), 90 deletions(-) hooks/post-receive -- roboptim |
From: Thomas M. <tho...@us...> - 2009-06-25 12:06:00
|
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". The branch, core-ipopt-plugin has been updated via 0967cad9535871a901ea9b4c7644e9d5fac8bd37 (commit) from f8f3b4cf37a483ad81357328298d50b5134d76c1 (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 0967cad9535871a901ea9b4c7644e9d5fac8bd37 Author: Thomas Moulard <tho...@gm...> Date: Thu Jun 25 21:01:03 2009 +0900 Copy constraints final values in result object. * src/roboptim-core-ipopt-plugin.cc: Copy constraints final value in result. * tests/plugin.stdout, * tests/simple.stdout: Regenerate. Signed-off-by: Thomas Moulard <tho...@gm...> diff --git a/ChangeLog b/ChangeLog index 48a037d..017c725 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2009-06-25 Thomas Moulard <tho...@gm...> + + Copy constraints final values in result object. + * src/roboptim-core-ipopt-plugin.cc: Copy constraints final + value in result. + * tests/plugin.stdout, + * tests/simple.stdout: Regenerate. + 2009-06-18 Thomas Moulard <tho...@gm...> Use symmetric matrices in Hessian computation. diff --git a/src/roboptim-core-ipopt-plugin.cc b/src/roboptim-core-ipopt-plugin.cc index f383161..663b334 100644 --- a/src/roboptim-core-ipopt-plugin.cc +++ b/src/roboptim-core-ipopt-plugin.cc @@ -408,6 +408,8 @@ namespace roboptim #define FILL_RESULT() \ array_to_vector (res.x, x); \ + res.constraints.resize (m); \ + array_to_vector (res.constraints, g); \ res.lambda.resize (m); \ array_to_vector (res.lambda, lambda); \ res.value (0) = obj_value diff --git a/tests/plugin.stdout b/tests/plugin.stdout index 338908c..25aae4a 100644 --- a/tests/plugin.stdout +++ b/tests/plugin.stdout @@ -21,4 +21,5 @@ Result: Size (input, output): 4, 1 X: [4](1,4.743,3.82115,1.37941) Value: [1](14.5723) + Constraints values: [2](25,40) Lambda: [2](-0.552294,0.161469) diff --git a/tests/simple.stdout b/tests/simple.stdout index 338908c..25aae4a 100644 --- a/tests/simple.stdout +++ b/tests/simple.stdout @@ -21,4 +21,5 @@ Result: Size (input, output): 4, 1 X: [4](1,4.743,3.82115,1.37941) Value: [1](14.5723) + Constraints values: [2](25,40) Lambda: [2](-0.552294,0.161469) ----------------------------------------------------------------------- Summary of changes: ChangeLog | 8 ++++++++ src/roboptim-core-ipopt-plugin.cc | 2 ++ tests/plugin.stdout | 1 + tests/simple.stdout | 1 + 4 files changed, 12 insertions(+), 0 deletions(-) hooks/post-receive -- roboptim |
From: Thomas M. <tho...@us...> - 2009-06-25 10:29:43
|
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". The branch, core has been updated via 6e6a3adf5d5b9358736e7c9dd01f5b6688bd2614 (commit) from 2c3756a856b0c48031857ad2f76c0e8c76b471ed (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 6e6a3adf5d5b9358736e7c9dd01f5b6688bd2614 Author: Thomas Moulard <tho...@gm...> Date: Thu Jun 25 19:24:42 2009 +0900 Display constraints final state. * include/roboptim/core/result.hh: Add constraints vector to store constraints final values. * src/result.cc: Display constraints vector. * tests/result.stdout: Regenerate. Signed-off-by: Thomas Moulard <tho...@gm...> diff --git a/ChangeLog b/ChangeLog index b90a266..d3ceab0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2009-06-25 Thomas Moulard <tho...@gm...> + + Display constraints final state. + * include/roboptim/core/result.hh: Add constraints vector + to store constraints final values. + * src/result.cc: Display constraints vector. + * tests/result.stdout: Regenerate. + 2009-06-23 Thomas Moulard <tho...@gm...> Add support for mixed derivative. diff --git a/include/roboptim/core/result.hh b/include/roboptim/core/result.hh index 8bd97e9..b900b89 100644 --- a/include/roboptim/core/result.hh +++ b/include/roboptim/core/result.hh @@ -62,9 +62,11 @@ namespace roboptim size_type outputSize; /// \brief Point found by the solver. vector_t x; - /// /brief Function value at the solver found point. + /// \brief Function value at the solver found point. vector_t value; - /// /brief Lagrange multipliers. + /// \brief Constraints final values. + vector_t constraints; + /// \brief Lagrange multipliers. vector_t lambda; }; diff --git a/src/result.cc b/src/result.cc index 5d46a3a..1526e56 100644 --- a/src/result.cc +++ b/src/result.cc @@ -33,10 +33,12 @@ namespace roboptim outputSize (outputSize_), x (inputSize), value (outputSize), + constraints (), lambda () { x.clear (); value.clear (); + constraints.clear (); lambda.clear (); } @@ -51,6 +53,7 @@ namespace roboptim << "Size (input, output): " << inputSize << ", " << outputSize << iendl << "X: " << x << iendl << "Value: " << value << iendl + << "Constraints values: " << constraints << iendl << "Lambda: " << lambda; return o << decindent; diff --git a/tests/result.stdout b/tests/result.stdout index 728ffc3..98adffe 100644 --- a/tests/result.stdout +++ b/tests/result.stdout @@ -2,4 +2,5 @@ Result: Size (input, output): 3, 8 X: [3](0,0,0) Value: [8](0,0,0,0,0,0,0,0) + Constraints values: [0]() Lambda: [0]() ----------------------------------------------------------------------- Summary of changes: ChangeLog | 8 ++++++++ include/roboptim/core/result.hh | 6 ++++-- src/result.cc | 3 +++ tests/result.stdout | 1 + 4 files changed, 16 insertions(+), 2 deletions(-) hooks/post-receive -- roboptim |
From: Thomas M. <tho...@us...> - 2009-06-23 10:50:57
|
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". The branch, core has been updated via 2c3756a856b0c48031857ad2f76c0e8c76b471ed (commit) from 8e7baffdaebaa1ef4dab489e0caa5a52b11525f6 (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 2c3756a856b0c48031857ad2f76c0e8c76b471ed Author: Thomas Moulard <tho...@gm...> Date: Tue Jun 23 18:53:15 2009 +0900 Add support for mixed derivative. * include/roboptim/core/derivable-parametrized-function.hh: Add support for mixed derivative. * tests/derivable-parametrized-function.cc: Update test. Signed-off-by: Thomas Moulard <tho...@gm...> diff --git a/ChangeLog b/ChangeLog index da9f812..b90a266 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2009-06-23 Thomas Moulard <tho...@gm...> + Add support for mixed derivative. + * include/roboptim/core/derivable-parametrized-function.hh: + Add support for mixed derivative. + * tests/derivable-parametrized-function.cc: Update test. + +2009-06-23 Thomas Moulard <tho...@gm...> + Fix distribution. * include/Makefile.am: Distribute missing header. * tests/Makefile.am: Fix typo. diff --git a/include/roboptim/core/derivable-parametrized-function.hh b/include/roboptim/core/derivable-parametrized-function.hh index 7932874..2eff4f2 100644 --- a/include/roboptim/core/derivable-parametrized-function.hh +++ b/include/roboptim/core/derivable-parametrized-function.hh @@ -97,11 +97,12 @@ namespace roboptim /// /// \param argument point at which the jacobian will be computed /// \return jacobian matrix - jacobian_t jacobian (const argument_t& argument) const throw () + jacobian_t jacobian (const argument_t& argument, size_type order = 0) + const throw () { jacobian_t jacobian (jacobianSize ().first, jacobianSize ().second); jacobian.clear (); - this->jacobian (jacobian, argument); + this->jacobian (jacobian, argument, order); return jacobian; } @@ -111,11 +112,12 @@ namespace roboptim /// or after the jacobian computation. /// \param jacobian jacobian will be stored in this argument /// \param argument inner function point argument value - void jacobian (jacobian_t& jacobian, const argument_t& argument) const throw () + void jacobian (jacobian_t& jacobian, const argument_t& argument, + size_type order = 0) const throw () { assert (argument.size () == this->inputSize ()); assert (this->isValidJacobian (jacobian)); - this->impl_jacobian (jacobian, argument); + this->impl_jacobian (jacobian, argument, order); assert (this->isValidJacobian (jacobian)); } @@ -125,11 +127,12 @@ namespace roboptim /// \param functionId function id in split representation /// \return gradient vector gradient_t gradient (const argument_t& argument, - size_type functionId = 0) const throw () + size_type functionId = 0, + size_type order = 0) const throw () { gradient_t gradient (gradientSize ()); gradient.clear (); - this->gradient (gradient, argument, functionId); + this->gradient (gradient, argument, functionId, order); return gradient; } @@ -143,11 +146,12 @@ namespace roboptim /// \return gradient vector void gradient (gradient_t& gradient, const argument_t& argument, - size_type functionId = 0) const throw () + size_type functionId = 0, + size_type order = 0) const throw () { assert (argument.size () == this->inputSize ()); assert (this->isValidGradient (gradient)); - this->impl_gradient (gradient, argument, functionId); + this->impl_gradient (gradient, argument, functionId, order); assert (this->isValidGradient (gradient)); } @@ -204,7 +208,8 @@ namespace roboptim /// \param functionId evaluated function id in the split representation virtual void impl_gradient (gradient_t& gradient, const argument_t& argument, - size_type functionId = 0) + size_type functionId = 0, + size_type order = 0) const throw () = 0; }; diff --git a/tests/derivable-parametrized-function.cc b/tests/derivable-parametrized-function.cc index 17f5f5a..a27b96e 100644 --- a/tests/derivable-parametrized-function.cc +++ b/tests/derivable-parametrized-function.cc @@ -37,10 +37,19 @@ struct ParametrizedDF : public DerivableParametrizedFunction<IdentityFunction> void impl_gradient (gradient_t& gradient, const argument_t& argument, - size_type functionId = 0) const throw () + size_type functionId = 0, + size_type order = 0) const throw () { gradient.clear (); - gradient[0] = 1.; + switch (order) + { + case 0: + gradient[0] = 1.; + break; + case 1: + gradient[0] = 0.; + break; + } } }; ----------------------------------------------------------------------- Summary of changes: ChangeLog | 7 ++++++ .../core/derivable-parametrized-function.hh | 23 ++++++++++++------- tests/derivable-parametrized-function.cc | 13 +++++++++- 3 files changed, 32 insertions(+), 11 deletions(-) hooks/post-receive -- roboptim |
From: Thomas M. <tho...@us...> - 2009-06-23 07:23:41
|
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". The branch, core has been updated via 8e7baffdaebaa1ef4dab489e0caa5a52b11525f6 (commit) from f947e2fffc801f7795e24edd81d1d326215d2efd (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 8e7baffdaebaa1ef4dab489e0caa5a52b11525f6 Author: Thomas Moulard <tho...@gm...> Date: Tue Jun 23 16:19:14 2009 +0900 Fix distribution. * include/Makefile.am: Distribute missing header. * tests/Makefile.am: Fix typo. Signed-off-by: Thomas Moulard <tho...@gm...> diff --git a/ChangeLog b/ChangeLog index ed35609..da9f812 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2009-06-23 Thomas Moulard <tho...@gm...> + Fix distribution. + * include/Makefile.am: Distribute missing header. + * tests/Makefile.am: Fix typo. + +2009-06-23 Thomas Moulard <tho...@gm...> + Implement DerivableParametrizedFunction. * include/roboptim/core/derivable-parametrized-function.hh: New. * include/roboptim/core/parametrized-function.hh, diff --git a/include/Makefile.am b/include/Makefile.am index 0d8b06f..2b65386 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -4,6 +4,7 @@ include $(top_srcdir)/build-aux/init.mk nobase_include_HEADERS = \ roboptim/core/constant-function.hh \ roboptim/core/derivable-function.hh \ + roboptim/core/derivable-parametrized-function.hh\ roboptim/core/function.hh \ roboptim/core/fwd.hh \ roboptim/core/finite-difference-gradient.hh \ diff --git a/tests/Makefile.am b/tests/Makefile.am index 430d04b..59d5639 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -121,7 +121,7 @@ EXTRA_DIST += \ numeric-linear-function.stdout \ numeric-quadratic-function.stdout \ parametrized-function.stdout \ - parametrized-derivable-function.stdout \ + derivable-parametrized-function.stdout \ plugin.stdout \ problem-cc.stdout \ result.stdout \ ----------------------------------------------------------------------- Summary of changes: ChangeLog | 6 ++++++ include/Makefile.am | 1 + tests/Makefile.am | 2 +- 3 files changed, 8 insertions(+), 1 deletions(-) hooks/post-receive -- roboptim |
From: Thomas M. <tho...@us...> - 2009-06-23 07:18:47
|
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". The branch, core has been updated via f947e2fffc801f7795e24edd81d1d326215d2efd (commit) from 9d9aedfda449d8ea282337c68d37d4c736adc1d8 (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 f947e2fffc801f7795e24edd81d1d326215d2efd Author: Thomas Moulard <tho...@gm...> Date: Tue Jun 23 16:15:17 2009 +0900 Implement DerivableParametrizedFunction. * include/roboptim/core/derivable-parametrized-function.hh: New. * include/roboptim/core/parametrized-function.hh, * include/roboptim/core/parametrized-function.hxx: Specify input/output sizes of inner function in constructor. * tests/Makefile.am: Run new test. * tests/derivable-parametrized-function.cc: Copy from tests/parametrized-function.cc. * tests/derivable-parametrized-function.stdout: New. * tests/parametrized-function.cc: Add input/output inner function size in constructor. * tests/testsuite.at: Run tests. Signed-off-by: Thomas Moulard <tho...@gm...> diff --git a/ChangeLog b/ChangeLog index 32be828..ed35609 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2009-06-23 Thomas Moulard <tho...@gm...> + + Implement DerivableParametrizedFunction. + * include/roboptim/core/derivable-parametrized-function.hh: New. + * include/roboptim/core/parametrized-function.hh, + * include/roboptim/core/parametrized-function.hxx: + Specify input/output sizes of inner function in constructor. + * tests/Makefile.am: Run new test. + * tests/derivable-parametrized-function.cc: + Copy from tests/parametrized-function.cc. + * tests/derivable-parametrized-function.stdout: New. + * tests/parametrized-function.cc: Add input/output inner + function size in constructor. + * tests/testsuite.at: Run tests. + 2009-06-19 Thomas Moulard <tho...@gm...> Add parametrized function class. diff --git a/include/roboptim/core/derivable-parametrized-function.hh b/include/roboptim/core/derivable-parametrized-function.hh new file mode 100644 index 0000000..7932874 --- /dev/null +++ b/include/roboptim/core/derivable-parametrized-function.hh @@ -0,0 +1,215 @@ +// Copyright (C) 2009 by Thomas Moulard, AIST, CNRS, INRIA. +// +// This file is part of the roboptim. +// +// roboptim is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// roboptim is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with roboptim. If not, see <http://www.gnu.org/licenses/>. + +#ifndef ROBOPTIM_TRAJECTORY_DERIVABLE_PARAMETRIZABLE_HH +# define ROBOPTIM_TRAJECTORY_DERIVABLE_PARAMETRIZABLE_HH +# include <utility> + +# include <roboptim/core/fwd.hh> +# include <roboptim/core/parametrized-function.hh> + +namespace roboptim +{ + /// \addtogroup roboptim_meta_function + /// @{ + + /// \brief Parametrized function with parameter derivative available. + /// + /// Depending on inner function type, this class allows computation + /// of parameter derivative or combined parameter/function derivative. + /// + /// \tparam F inner function type. + template <typename F> + class DerivableParametrizedFunction : public ParametrizedFunction<F> + { + public: + /// \brief Import value type. + typedef typename F::value_type value_type; + /// \brief Import size type. + typedef typename F::size_type size_type; + /// \brief Import vector type. + typedef typename F::vector_t vector_t; + /// \brief Import matrix type. + typedef typename F::matrix_t matrix_t; + /// \brief Import result type. + typedef F result_t; + /// \brief Import argument type. + typedef typename F::argument_t argument_t; + /// \brief Import gradient type. + typedef typename F::vector_t gradient_t; + /// \brief Import jacobian type. + typedef typename F::matrix_t jacobian_t; + + /// \brief Import jacobian size type (pair of values). + typedef typename F::jacobianSize_t jacobianSize_t; + + + /// \brief Return the gradient size. + /// + /// Gradient size is equals to the input size. + size_t gradientSize () const throw () + { + return this->inputSize (); + } + + /// \brief Return the jacobian size as a pair. + /// + /// Gradient size is equals to (output size, input size). + jacobianSize_t jacobianSize () const throw () + { + return std::make_pair (this->inputSize (), + this->functionOutputSize ()); + } + + /// \brief Check if the gradient is valid (check size). + /// \param gradient checked gradient + /// \return true if valid, false if not + bool isValidGradient (const gradient_t& gradient) const throw () + { + return gradient.size () == this->gradientSize (); + } + + /// \brief Check if the jacobian is valid (check sizes). + /// + /// \param jacobian checked jacobian + /// \return true if valid, false if not + bool isValidJacobian (const jacobian_t& jacobian) const throw () + { + return jacobian.size1 () == this->jacobianSize ().first + && jacobian.size2 () == this->jacobianSize ().second; + } + + /// \brief Computes the jacobian. + /// + /// \param argument point at which the jacobian will be computed + /// \return jacobian matrix + jacobian_t jacobian (const argument_t& argument) const throw () + { + jacobian_t jacobian (jacobianSize ().first, jacobianSize ().second); + jacobian.clear (); + this->jacobian (jacobian, argument); + return jacobian; + } + + /// \brief Computes the jacobian. + /// + /// Program will abort if the jacobian size is wrong before + /// or after the jacobian computation. + /// \param jacobian jacobian will be stored in this argument + /// \param argument inner function point argument value + void jacobian (jacobian_t& jacobian, const argument_t& argument) const throw () + { + assert (argument.size () == this->inputSize ()); + assert (this->isValidJacobian (jacobian)); + this->impl_jacobian (jacobian, argument); + assert (this->isValidJacobian (jacobian)); + } + + /// \brief Computes the gradient. + /// + /// \param argument inner function argument value + /// \param functionId function id in split representation + /// \return gradient vector + gradient_t gradient (const argument_t& argument, + size_type functionId = 0) const throw () + { + gradient_t gradient (gradientSize ()); + gradient.clear (); + this->gradient (gradient, argument, functionId); + return gradient; + } + + /// \brief Computes the gradient. + /// + /// Program will abort if the gradient size is wrong before + /// or after the gradient computation. + /// \param gradient gradient will be stored in this argument + /// \param argument inner function point argument value + /// \param functionId function id in split representation + /// \return gradient vector + void gradient (gradient_t& gradient, + const argument_t& argument, + size_type functionId = 0) const throw () + { + assert (argument.size () == this->inputSize ()); + assert (this->isValidGradient (gradient)); + this->impl_gradient (gradient, argument, functionId); + assert (this->isValidGradient (gradient)); + } + + /// \brief Display the function on the specified output stream. + /// + /// \param o output stream used for display + /// \return output stream + virtual std::ostream& print (std::ostream& o) const throw () + { + return o << "Derivable parametrized function"; + } + + protected: + /// \brief Concrete class constructor should call this constructor. + /// + /// \param inputSize parameter size + /// \param functionInputSize inner function argument size + /// \param functionOutputSize inner function result size + DerivableParametrizedFunction (size_type inputSize, + size_type functionInputSize, + size_type functionOutputSize) throw () + : ParametrizedFunction<F> (inputSize, + functionInputSize, + functionOutputSize) + { + } + + /// \brief Jacobian evaluation. + /// + /// Computes the jacobian, can be overridden by concrete classes. + /// The default behavior is to compute the jacobian from the gradient. + /// \warning Do not call this function directly, call #jacobian instead. + /// \param jacobian jacobian will be store in this argument + /// \param arg point where the jacobian will be computed + virtual void impl_jacobian (jacobian_t& jacobian, const argument_t& arg) + const throw () + { + for (unsigned i = 0; i < this->functionOutputSize (); ++i) + { + gradient_t grad = this->gradient (arg, i); + for (unsigned j = 0; j < this->inputSize (); ++j) + jacobian (i, j) = grad[j]; + } + } + + /// \brief Gradient evaluation. + /// + /// Compute the gradient, has to be implemented in concrete classes. + /// The gradient is computed for a specific sub-function which id + /// is passed through the functionId argument. + /// \warning Do not call this function directly, call #gradient instead. + /// \param gradient gradient will be store in this argument + /// \param argument inner function point argument value + /// \param functionId evaluated function id in the split representation + virtual void impl_gradient (gradient_t& gradient, + const argument_t& argument, + size_type functionId = 0) + const throw () = 0; + }; + + /// @} + +} // end of namespace roboptim. + +#endif //! ROBOPTIM_TRAJECTORY_N_TIMES_DERIVABLE_HH diff --git a/include/roboptim/core/parametrized-function.hh b/include/roboptim/core/parametrized-function.hh index f9bff93..4f8ac02 100644 --- a/include/roboptim/core/parametrized-function.hh +++ b/include/roboptim/core/parametrized-function.hh @@ -23,7 +23,8 @@ # include <boost/numeric/ublas/matrix.hpp> # include <boost/numeric/ublas/vector.hpp> -# include <boost/tuple/tuple.hpp> +# include <boost/static_assert.hpp> +# include <boost/type_traits/is_base_of.hpp> # include <roboptim/core/fwd.hh> @@ -46,9 +47,12 @@ namespace roboptim /// /// Functions are pure immutable objects: evaluating a function /// twice at a given point <b>must</b> give the same result. + /// + /// \tparam F inner function type. template <typename F> class ParametrizedFunction { + BOOST_STATIC_ASSERT((boost::is_base_of<Function, F>::value)); public: /// \brief Import value type. typedef typename F::value_type value_type; @@ -76,6 +80,16 @@ namespace roboptim /// \return input size size_type inputSize () const throw (); + /// \brief Return the function's input size (i.e. argument's vector size). + /// + /// \return input size + size_type functionInputSize () const throw (); + + /// \brief Return the function's output size (i.e. result's vector size). + /// + /// \return output size + size_type functionOutputSize () const throw (); + /// \brief Display the function on the specified output stream. /// /// \param o output stream used for display @@ -85,8 +99,12 @@ namespace roboptim protected: /// \brief Concrete class constructor should call this constructor. /// - /// \param inputSize function arity - ParametrizedFunction (size_type inputSize) throw (); + /// \param inputSize parameter size + /// \param functionInputSize inner function argument size + /// \param functionOutputSize inner function result size + ParametrizedFunction (size_type inputSize, + size_type functionInputSize, + size_type functionOutputSize) throw (); /// \brief Function evaluation. /// @@ -97,8 +115,12 @@ namespace roboptim const throw () = 0; private: - /// Problem dimension. + /// Parameter size. const size_type inputSize_; + /// Inner function argument vector size. + const size_type functionInputSize_; + /// Inner function result vector size. + const size_type functionOutputSize_; }; /// @} diff --git a/include/roboptim/core/parametrized-function.hxx b/include/roboptim/core/parametrized-function.hxx index 6db59fb..649be76 100644 --- a/include/roboptim/core/parametrized-function.hxx +++ b/include/roboptim/core/parametrized-function.hxx @@ -21,8 +21,13 @@ namespace roboptim { template <typename F> - ParametrizedFunction<F>::ParametrizedFunction (size_type inputSize) throw () - : inputSize_ (inputSize) + ParametrizedFunction<F>::ParametrizedFunction (size_type inputSize, + size_type functionInputSize, + size_type functionOutputSize) + throw () + : inputSize_ (inputSize), + functionInputSize_ (functionInputSize), + functionOutputSize_ (functionOutputSize) { } @@ -34,7 +39,6 @@ namespace roboptim return impl_compute (argument); } - template <typename F> typename ParametrizedFunction<F>::size_type ParametrizedFunction<F>::inputSize () const throw () @@ -42,6 +46,20 @@ namespace roboptim return inputSize_; } + template <typename F> + typename ParametrizedFunction<F>::size_type + ParametrizedFunction<F>::functionInputSize () const throw () + { + return functionInputSize_; + } + + + template <typename F> + typename ParametrizedFunction<F>::size_type + ParametrizedFunction<F>::functionOutputSize () const throw () + { + return functionOutputSize_; + } template <typename F> std::ostream& diff --git a/tests/Makefile.am b/tests/Makefile.am index c7aa9df..430d04b 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -53,6 +53,12 @@ parametrized_function_SOURCES = parametrized-function.cc \ $(COMMON_SOURCES) parametrized_function_LDADD = $(top_builddir)/src/libroboptim-core.la +# derivable-parametrized-function +check_PROGRAMS += derivable-parametrized-function +derivable_parametrized_function_SOURCES = derivable-parametrized-function.cc \ + $(COMMON_SOURCES) +derivable_parametrized_function_LDADD = $(top_builddir)/src/libroboptim-core.la + # plugin check_PROGRAMS += plugin plugin_SOURCES = plugin.cc $(COMMON_SOURCES) @@ -107,17 +113,18 @@ generate-reference: # ------------ # # Distribute reference files. -EXTRA_DIST += \ - constant-function.stdout \ - finite-difference-gradient.stdout \ - identity-function.stdout \ - n-times-derivable-function.stdout \ - numeric-linear-function.stdout \ - numeric-quadratic-function.stdout \ - parametrized-function.stdout \ - plugin.stdout \ - problem-cc.stdout \ - result.stdout \ - simple.stdout \ - visualization-gnuplot-function.stdout \ +EXTRA_DIST += \ + constant-function.stdout \ + finite-difference-gradient.stdout \ + identity-function.stdout \ + n-times-derivable-function.stdout \ + numeric-linear-function.stdout \ + numeric-quadratic-function.stdout \ + parametrized-function.stdout \ + parametrized-derivable-function.stdout \ + plugin.stdout \ + problem-cc.stdout \ + result.stdout \ + simple.stdout \ + visualization-gnuplot-function.stdout \ visualization-gnuplot-simple.stdout diff --git a/tests/parametrized-function.cc b/tests/derivable-parametrized-function.cc similarity index 67% copy from tests/parametrized-function.cc copy to tests/derivable-parametrized-function.cc index 55e201e..17f5f5a 100644 --- a/tests/parametrized-function.cc +++ b/tests/derivable-parametrized-function.cc @@ -19,30 +19,38 @@ #include <boost/numeric/ublas/io.hpp> #include "common.hh" -#include <roboptim/core/constant-function.hh> -#include <roboptim/core/parametrized-function.hh> +#include <roboptim/core/identity-function.hh> +#include <roboptim/core/derivable-parametrized-function.hh> using namespace roboptim; // Define a simple function. -struct ParametrizedF : public ParametrizedFunction<ConstantFunction> +struct ParametrizedDF : public DerivableParametrizedFunction<IdentityFunction> { - ParametrizedF () : ParametrizedFunction<ConstantFunction> (1) + ParametrizedDF () : DerivableParametrizedFunction<IdentityFunction> (1, 1, 1) {} result_t impl_compute (const argument_t& argument) const throw () { return result_t (argument); } + + void impl_gradient (gradient_t& gradient, + const argument_t& argument, + size_type functionId = 0) const throw () + { + gradient.clear (); + gradient[0] = 1.; + } }; #define CHECKME(PVALUE) \ { \ std::cout << "Parameter is " << PVALUE << std::endl; \ parameter[0] = (PVALUE); \ - ConstantFunction cst = pf (parameter); \ + IdentityFunction cst = pf (parameter); \ \ - ConstantFunction::vector_t x (1); \ + IdentityFunction::vector_t x (1); \ x[0] = 31.; \ std::cout \ << cst << std::endl \ @@ -52,14 +60,16 @@ struct ParametrizedF : public ParametrizedFunction<ConstantFunction> << cst.gradient (x) << std::endl \ << "Jacobian: " << std::endl \ << cst.jacobian (x) << std::endl \ + << "Derivative w.r.t params: " << std::endl \ + << cst.jacobian (x) << std::endl \ << std::endl; \ } \ int run_test () { - ParametrizedF pf; + ParametrizedDF pf; - ParametrizedF::argument_t parameter (1); + ParametrizedDF::argument_t parameter (1); parameter.clear (); CHECKME (0.); @@ -68,13 +78,13 @@ int run_test () { parameter[0] = 128.; - ConstantFunction::vector_t x (1); + IdentityFunction::vector_t x (1); x[0] = 256.; // Natural evaluation in one line. - ConstantFunction::result_t res = pf (parameter) (x); + IdentityFunction::result_t res = pf (parameter) (x); - assert (res[0] == 128.); + assert (res[0] == 128. + 256.); } return 0; diff --git a/tests/derivable-parametrized-function.stdout b/tests/derivable-parametrized-function.stdout new file mode 100644 index 0000000..6992dfa --- /dev/null +++ b/tests/derivable-parametrized-function.stdout @@ -0,0 +1,39 @@ +Parameter is 0 +Identity function + offset = [1](0) + +Evaluate: +[1](31) +Gradient: +[1](1) +Jacobian: +[1,1]((1)) +Derivative w.r.t params: +[1,1]((1)) + +Parameter is 3.14 +Identity function + offset = [1](3.14) + +Evaluate: +[1](34.14) +Gradient: +[1](1) +Jacobian: +[1,1]((1)) +Derivative w.r.t params: +[1,1]((1)) + +Parameter is 42 +Identity function + offset = [1](42) + +Evaluate: +[1](73) +Gradient: +[1](1) +Jacobian: +[1,1]((1)) +Derivative w.r.t params: +[1,1]((1)) + diff --git a/tests/parametrized-function.cc b/tests/parametrized-function.cc index 55e201e..56e2bde 100644 --- a/tests/parametrized-function.cc +++ b/tests/parametrized-function.cc @@ -27,7 +27,7 @@ using namespace roboptim; // Define a simple function. struct ParametrizedF : public ParametrizedFunction<ConstantFunction> { - ParametrizedF () : ParametrizedFunction<ConstantFunction> (1) + ParametrizedF () : ParametrizedFunction<ConstantFunction> (1, 1, 1) {} result_t impl_compute (const argument_t& argument) const throw () diff --git a/tests/testsuite.at b/tests/testsuite.at index bdc439c..63c98d1 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -39,6 +39,8 @@ CHECK_STDOUT([result], [Check Result class.]) CHECK_STDOUT([identity-function], [Check identity function class.]) CHECK_STDOUT([constant-function], [Check constant function class.]) CHECK_STDOUT([parametrized-function], [Check parametrized function class.]) +CHECK_STDOUT([derivable-parametrized-function], + [Check derivable parametrized function class.]) AT_BANNER([Plug-in mechanism]) CHECK_STDOUT([plugin], [Load dummy plug-in dynamically.]) ----------------------------------------------------------------------- Summary of changes: ChangeLog | 15 ++ ...ction.hh => derivable-parametrized-function.hh} | 135 +++++++++++--------- include/roboptim/core/parametrized-function.hh | 30 ++++- include/roboptim/core/parametrized-function.hxx | 24 +++- tests/Makefile.am | 33 +++-- ...ction.cc => derivable-parametrized-function.cc} | 32 +++-- tests/derivable-parametrized-function.stdout | 39 ++++++ tests/parametrized-function.cc | 2 +- tests/testsuite.at | 2 + 9 files changed, 217 insertions(+), 95 deletions(-) copy include/roboptim/core/{derivable-function.hh => derivable-parametrized-function.hh} (61%) copy tests/{parametrized-function.cc => derivable-parametrized-function.cc} (67%) create mode 100644 tests/derivable-parametrized-function.stdout hooks/post-receive -- roboptim |
From: Thomas M. <tho...@us...> - 2009-06-19 07:12:30
|
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". The branch, core has been updated via 9d9aedfda449d8ea282337c68d37d4c736adc1d8 (commit) from 297bdb32bdd3e09ac77f449b94c6f4d428cc7e63 (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 9d9aedfda449d8ea282337c68d37d4c736adc1d8 Author: Thomas Moulard <tho...@gm...> Date: Fri Jun 19 16:11:33 2009 +0900 Add parametrized function class. * include/Makefile.am: Distribute new header. * include/roboptim/core/parametrized-function.hh: New. * include/roboptim/core/parametrized-function.hxx: New. * tests/Makefile.am: Compile new test. * tests/parametrized-function.cc: New. * tests/parametrized-function.stdout: New. * tests/testsuite.at: Run new test. Signed-off-by: Thomas Moulard <tho...@gm...> diff --git a/ChangeLog b/ChangeLog index a7a609a..32be828 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2009-06-19 Thomas Moulard <tho...@gm...> + + Add parametrized function class. + * include/Makefile.am: Distribute new header. + * include/roboptim/core/parametrized-function.hh: New. + * include/roboptim/core/parametrized-function.hxx: New. + * tests/Makefile.am: Compile new test. + * tests/parametrized-function.cc: New. + * tests/parametrized-function.stdout: New. + * tests/testsuite.at: Run new test. + 2009-06-18 Thomas Moulard <tho...@gm...> Make SolverFactory exception-safe. diff --git a/include/Makefile.am b/include/Makefile.am index 8f546e5..0d8b06f 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -15,6 +15,8 @@ nobase_include_HEADERS = \ roboptim/core/n-times-derivable-function.hxx \ roboptim/core/numeric-quadratic-function.hh \ roboptim/core/numeric-linear-function.hh \ + roboptim/core/parametrized-function.hh \ + roboptim/core/parametrized-function.hxx \ roboptim/core/problem.hh \ roboptim/core/problem.hxx \ roboptim/core/quadratic-function.hh \ diff --git a/include/roboptim/core/parametrized-function.hh b/include/roboptim/core/parametrized-function.hh new file mode 100644 index 0000000..f9bff93 --- /dev/null +++ b/include/roboptim/core/parametrized-function.hh @@ -0,0 +1,118 @@ +// Copyright (C) 2009 by Thomas Moulard, AIST, CNRS, INRIA. +// +// This file is part of the roboptim. +// +// roboptim is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// roboptim is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with roboptim. If not, see <http://www.gnu.org/licenses/>. + +#ifndef ROBOPTIM_CORE_PARAMETRIZED_FUNCTION_HH +# define ROBOPTIM_CORE_PARAMETRIZED_FUNCTION_HH +# include <iostream> +# include <limits> +# include <utility> + +# include <boost/numeric/ublas/matrix.hpp> +# include <boost/numeric/ublas/vector.hpp> +# include <boost/tuple/tuple.hpp> + +# include <roboptim/core/fwd.hh> + +namespace roboptim +{ + namespace ublas = boost::numeric::ublas; + + /// \addtogroup roboptim_meta_function + /// @{ + + /// \brief Define an abstract parametrized mathematical function (\f$C^0\f$). + /// + /// A function is an object that can be evaluated for a given + /// point. + /// + /// \f[ f : p \rightarrow g \f] + /// \f$p \in \mathbb{R}^p\f$, \f$g \in G\f$ where + /// \f$p\f$ is the input size and \f$G = \mathbb{R}^n \in \mathbb{R}^m\f$ + /// (\f$n, m \in \mathbb{R}^2\f$). + /// + /// Functions are pure immutable objects: evaluating a function + /// twice at a given point <b>must</b> give the same result. + template <typename F> + class ParametrizedFunction + { + public: + /// \brief Import value type. + typedef typename F::value_type value_type; + /// \brief Import size type. + typedef typename F::size_type size_type; + /// \brief Import vector type. + typedef typename F::vector_t vector_t; + /// \brief Import matrix type. + typedef typename F::matrix_t matrix_t; + /// \brief Import result type. + typedef F result_t; + /// \brief Import argument type. + typedef typename F::argument_t argument_t; + + /// \brief Evaluate the function at a specified point. + /// + /// The program will abort if the argument does not have the + /// expected size. + /// \param argument point at which the function will be evaluated + /// \return computed result + result_t operator () (const argument_t& argument) const throw (); + + /// \brief Return the input size (i.e. argument's vector size). + /// + /// \return input size + size_type inputSize () const throw (); + + /// \brief Display the function on the specified output stream. + /// + /// \param o output stream used for display + /// \return output stream + virtual std::ostream& print (std::ostream&) const throw (); + + protected: + /// \brief Concrete class constructor should call this constructor. + /// + /// \param inputSize function arity + ParametrizedFunction (size_type inputSize) throw (); + + /// \brief Function evaluation. + /// + /// Evaluate the function, has to be implemented in concrete classes. + /// \warning Do not call this function directly, call #operator() instead. + /// \param argument point at which the function will be evaluated + virtual result_t impl_compute (const argument_t& argument) + const throw () = 0; + + private: + /// Problem dimension. + const size_type inputSize_; + }; + /// @} + + + /// \brief Override operator<< to handle function display. + /// + /// \param o output stream used for display + /// \param f function to be displayed + /// \return output stream + template <typename F> + std::ostream& operator<< (std::ostream& o, const ParametrizedFunction<F>& f); + + +} // end of namespace roboptim + +# include <roboptim/core/parametrized-function.hxx> +#endif //! ROBOPTIM_CORE_PARAMETRIZED_FUNCTION_HH diff --git a/include/roboptim/core/parametrized-function.hxx b/include/roboptim/core/parametrized-function.hxx new file mode 100644 index 0000000..6db59fb --- /dev/null +++ b/include/roboptim/core/parametrized-function.hxx @@ -0,0 +1,63 @@ +// Copyright (C) 2009 by Thomas Moulard, AIST, CNRS, INRIA. +// +// This file is part of the roboptim. +// +// roboptim is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// roboptim is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with roboptim. If not, see <http://www.gnu.org/licenses/>. + +#ifndef ROBOPTIM_CORE_PARAMETRIZED_FUNCTION_HXX +# define ROBOPTIM_CORE_PARAMETRIZED_FUNCTION_HXX + +namespace roboptim +{ + template <typename F> + ParametrizedFunction<F>::ParametrizedFunction (size_type inputSize) throw () + : inputSize_ (inputSize) + { + } + + template <typename F> + typename ParametrizedFunction<F>::result_t + ParametrizedFunction<F>::operator () (const argument_t& argument) const throw () + { + assert (argument.size () == inputSize ()); + return impl_compute (argument); + } + + + template <typename F> + typename ParametrizedFunction<F>::size_type + ParametrizedFunction<F>::inputSize () const throw () + { + return inputSize_; + } + + + template <typename F> + std::ostream& + ParametrizedFunction<F>::print (std::ostream& o) const throw () + { + o << "Parametrized function"; + return o; + } + + + template <typename F> + std::ostream& operator<< (std::ostream& o, const ParametrizedFunction<F>& f) + { + return f.print (o); + } + +} // end of namespace roboptim + +#endif //! ROBOPTIM_CORE_PARAMETRIZED_FUNCTION_HXX diff --git a/tests/Makefile.am b/tests/Makefile.am index ebb566e..c7aa9df 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -47,6 +47,12 @@ n_times_derivable_function_SOURCES = n-times-derivable-function.cc \ $(COMMON_SOURCES) n_times_derivable_function_LDADD = $(top_builddir)/src/libroboptim-core.la +# parametrized-function +check_PROGRAMS += parametrized-function +parametrized_function_SOURCES = parametrized-function.cc \ + $(COMMON_SOURCES) +parametrized_function_LDADD = $(top_builddir)/src/libroboptim-core.la + # plugin check_PROGRAMS += plugin plugin_SOURCES = plugin.cc $(COMMON_SOURCES) @@ -108,6 +114,7 @@ EXTRA_DIST += \ n-times-derivable-function.stdout \ numeric-linear-function.stdout \ numeric-quadratic-function.stdout \ + parametrized-function.stdout \ plugin.stdout \ problem-cc.stdout \ result.stdout \ diff --git a/tests/parametrized-function.cc b/tests/parametrized-function.cc new file mode 100644 index 0000000..55e201e --- /dev/null +++ b/tests/parametrized-function.cc @@ -0,0 +1,83 @@ +// Copyright (C) 2009 by Thomas Moulard, AIST, CNRS, INRIA. +// +// This file is part of the roboptim. +// +// roboptim is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// roboptim is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with roboptim. If not, see <http://www.gnu.org/licenses/>. + +#include <iostream> +#include <boost/numeric/ublas/io.hpp> + +#include "common.hh" +#include <roboptim/core/constant-function.hh> +#include <roboptim/core/parametrized-function.hh> + +using namespace roboptim; + +// Define a simple function. +struct ParametrizedF : public ParametrizedFunction<ConstantFunction> +{ + ParametrizedF () : ParametrizedFunction<ConstantFunction> (1) + {} + + result_t impl_compute (const argument_t& argument) const throw () + { + return result_t (argument); + } +}; + +#define CHECKME(PVALUE) \ + { \ + std::cout << "Parameter is " << PVALUE << std::endl; \ + parameter[0] = (PVALUE); \ + ConstantFunction cst = pf (parameter); \ + \ + ConstantFunction::vector_t x (1); \ + x[0] = 31.; \ + std::cout \ + << cst << std::endl \ + << "Evaluate: " << std::endl \ + << cst (x) << std::endl \ + << "Gradient: " << std::endl \ + << cst.gradient (x) << std::endl \ + << "Jacobian: " << std::endl \ + << cst.jacobian (x) << std::endl \ + << std::endl; \ + } \ + +int run_test () +{ + ParametrizedF pf; + + ParametrizedF::argument_t parameter (1); + parameter.clear (); + + CHECKME (0.); + CHECKME (3.14); + CHECKME (42.); + + { + parameter[0] = 128.; + ConstantFunction::vector_t x (1); + x[0] = 256.; + + // Natural evaluation in one line. + ConstantFunction::result_t res = pf (parameter) (x); + + assert (res[0] == 128.); + } + + return 0; +} + +GENERATE_TEST () diff --git a/tests/parametrized-function.stdout b/tests/parametrized-function.stdout new file mode 100644 index 0000000..68c5545 --- /dev/null +++ b/tests/parametrized-function.stdout @@ -0,0 +1,33 @@ +Parameter is 0 +Constant function + offset = [1](0) + +Evaluate: +[1](0) +Gradient: +[1](0) +Jacobian: +[1,1]((0)) + +Parameter is 3.14 +Constant function + offset = [1](3.14) + +Evaluate: +[1](3.14) +Gradient: +[1](0) +Jacobian: +[1,1]((0)) + +Parameter is 42 +Constant function + offset = [1](42) + +Evaluate: +[1](42) +Gradient: +[1](0) +Jacobian: +[1,1]((0)) + diff --git a/tests/testsuite.at b/tests/testsuite.at index a07656b..bdc439c 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -38,6 +38,7 @@ CHECK_STDOUT([finite-difference-gradient], [Check finite difference gradient.]) CHECK_STDOUT([result], [Check Result class.]) CHECK_STDOUT([identity-function], [Check identity function class.]) CHECK_STDOUT([constant-function], [Check constant function class.]) +CHECK_STDOUT([parametrized-function], [Check parametrized function class.]) AT_BANNER([Plug-in mechanism]) CHECK_STDOUT([plugin], [Load dummy plug-in dynamically.]) ----------------------------------------------------------------------- Summary of changes: ChangeLog | 11 ++ include/Makefile.am | 2 + include/roboptim/core/parametrized-function.hh | 118 +++++++++++++++++++++++ include/roboptim/core/parametrized-function.hxx | 63 ++++++++++++ tests/Makefile.am | 7 ++ tests/parametrized-function.cc | 83 ++++++++++++++++ tests/parametrized-function.stdout | 33 +++++++ tests/testsuite.at | 1 + 8 files changed, 318 insertions(+), 0 deletions(-) create mode 100644 include/roboptim/core/parametrized-function.hh create mode 100644 include/roboptim/core/parametrized-function.hxx create mode 100644 tests/parametrized-function.cc create mode 100644 tests/parametrized-function.stdout hooks/post-receive -- roboptim |
From: Thomas M. <tho...@us...> - 2009-06-18 07:30:10
|
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". The branch, core-ipopt-plugin has been updated via f8f3b4cf37a483ad81357328298d50b5134d76c1 (commit) via 0cd45106f9996bcbbd0e16a00b7e3f4ad9205b6d (commit) from 436f46b1a66dbf92a98599a0ee5014cb6374e83c (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 f8f3b4cf37a483ad81357328298d50b5134d76c1 Author: Thomas Moulard <tho...@gm...> Date: Thu Jun 18 16:25:45 2009 +0900 Use symmetric matrices in Hessian computation. * src/roboptim-core-ipopt-plugin.cc: Replace generic matrices by symmetric matrices in Hessian computation. Signed-off-by: Thomas Moulard <tho...@gm...> diff --git a/ChangeLog b/ChangeLog index 13359f2..48a037d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2009-06-18 Thomas Moulard <tho...@gm...> + Use symmetric matrices in Hessian computation. + * src/roboptim-core-ipopt-plugin.cc: Replace generic matrices + by symmetric matrices in Hessian computation. + +2009-06-18 Thomas Moulard <tho...@gm...> + Remove useless copy. * src/roboptim-core-ipopt-plugin.cc: Remove useless lambda copy. diff --git a/src/roboptim-core-ipopt-plugin.cc b/src/roboptim-core-ipopt-plugin.cc index 6f0f9bf..f383161 100644 --- a/src/roboptim-core-ipopt-plugin.cc +++ b/src/roboptim-core-ipopt-plugin.cc @@ -306,7 +306,7 @@ namespace roboptim } /// Compute Ipopt hessian from several hessians. - void compute_hessian (Function::matrix_t& h, + void compute_hessian (TwiceDerivableFunction::hessian_t& h, const IpoptSolver::vector_t& x, Number obj_factor, const Number* lambda) @@ -357,8 +357,9 @@ namespace roboptim IpoptSolver::vector_t x_ (n); array_to_vector (x_, x); - Function::matrix_t h (solver_.problem ().function ().inputSize (), - solver_.problem ().function ().inputSize ()); + TwiceDerivableFunction::hessian_t h + (solver_.problem ().function ().inputSize (), + solver_.problem ().function ().inputSize ()); compute_hessian (h, x_, obj_factor, lambda); int idx = 0; commit 0cd45106f9996bcbbd0e16a00b7e3f4ad9205b6d Author: Thomas Moulard <tho...@gm...> Date: Thu Jun 18 16:24:02 2009 +0900 Remove useless copy. * src/roboptim-core-ipopt-plugin.cc: Remove useless lambda copy. Signed-off-by: Thomas Moulard <tho...@gm...> diff --git a/ChangeLog b/ChangeLog index 5fd3e11..13359f2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-06-18 Thomas Moulard <tho...@gm...> + + Remove useless copy. + * src/roboptim-core-ipopt-plugin.cc: Remove useless lambda copy. + 2009-06-17 Thomas Moulard <tho...@gm...> Make compilation more robust. diff --git a/src/roboptim-core-ipopt-plugin.cc b/src/roboptim-core-ipopt-plugin.cc index 07bf63d..6f0f9bf 100644 --- a/src/roboptim-core-ipopt-plugin.cc +++ b/src/roboptim-core-ipopt-plugin.cc @@ -350,16 +350,13 @@ namespace roboptim iRow[idx] = i, jCol[idx] = j; ++idx; } - assert(idx == nele_hess); + assert (idx == nele_hess); } else { IpoptSolver::vector_t x_ (n); array_to_vector (x_, x); - IpoptSolver::vector_t lambda_ (m); - array_to_vector (lambda_, lambda); - Function::matrix_t h (solver_.problem ().function ().inputSize (), solver_.problem ().function ().inputSize ()); compute_hessian (h, x_, obj_factor, lambda); @@ -368,6 +365,7 @@ namespace roboptim for (int i = 0; i < n; ++i) for (int j = 0; j < n; ++j) values[idx++] = h (i, j); + assert (idx == nele_hess); } return true; ----------------------------------------------------------------------- Summary of changes: ChangeLog | 11 +++++++++++ src/roboptim-core-ipopt-plugin.cc | 13 ++++++------- 2 files changed, 17 insertions(+), 7 deletions(-) hooks/post-receive -- roboptim |
From: Thomas M. <tho...@us...> - 2009-06-18 02:34:55
|
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". The branch, core has been updated via 297bdb32bdd3e09ac77f449b94c6f4d428cc7e63 (commit) via f7a7110855a14b14973989b83b87cebbfad99879 (commit) from 79b21c369d8f5a788b5bbf18bda340a749d0b7af (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 297bdb32bdd3e09ac77f449b94c6f4d428cc7e63 Author: Thomas Moulard <tho...@gm...> Date: Thu Jun 18 11:32:31 2009 +0900 Make SolverFactory exception-safe. * include/roboptim/core/solver-factory.hxx: Make factory exception-safe. * src/Makefile.am: Restyle. Signed-off-by: Thomas Moulard <tho...@gm...> diff --git a/ChangeLog b/ChangeLog index fcddbea..a7a609a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2009-06-18 Thomas Moulard <tho...@gm...> + + Make SolverFactory exception-safe. + * include/roboptim/core/solver-factory.hxx: Make factory + exception-safe. + * src/Makefile.am: Restyle. + 2009-06-17 Thomas Moulard <tho...@gm...> Fix error in finite difference gradient. diff --git a/include/roboptim/core/solver-factory.hxx b/include/roboptim/core/solver-factory.hxx index 26d00cc..705b4b3 100644 --- a/include/roboptim/core/solver-factory.hxx +++ b/include/roboptim/core/solver-factory.hxx @@ -40,6 +40,7 @@ namespace roboptim std::stringstream sserror; sserror << "libltdl failed to load plug-in ``" << ss.str () << "'': " << lt_dlerror (); + lt_dlexit (); throw std::runtime_error (sserror.str ().c_str ()); } @@ -50,6 +51,9 @@ namespace roboptim std::stringstream sserror; sserror << "libltdl failed to find symbol ``create'': " << lt_dlerror (); + + lt_dlclose (handle_); + lt_dlexit (); throw std::runtime_error (sserror.str ().c_str ()); } solver_ = c (pb); @@ -59,6 +63,9 @@ namespace roboptim std::stringstream sserror; sserror << "libltdl failed to call ``create'': " << lt_dlerror (); + + lt_dlclose (handle_); + lt_dlexit (); throw std::runtime_error (sserror.str ().c_str ()); } } @@ -67,6 +74,7 @@ namespace roboptim SolverFactory<T>::~SolverFactory () throw () { typedef void destroy_t (solver_t*); + destroy_t* destructor = reinterpret_cast<destroy_t*> (lt_dlsym (handle_, "destroy")); if (destructor) diff --git a/src/Makefile.am b/src/Makefile.am index 61a4aad..86c13dd 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -3,8 +3,7 @@ include $(top_srcdir)/build-aux/init.mk # Add available warnings flags. AM_CXXFLAGS += $(WARNING_CXXFLAGS) -lib_LTLIBRARIES = libroboptim-core.la \ - roboptim-core-dummy-plugin.la +lib_LTLIBRARIES = libroboptim-core.la libroboptim_core_la_SOURCES = \ constant-function.cc \ @@ -32,5 +31,6 @@ libroboptim_core_la_SOURCES += \ libroboptim_core_la_LDFLAGS = -version-info 1:1:0 +lib_LTLIBRARIES += roboptim-core-dummy-plugin.la roboptim_core_dummy_plugin_la_SOURCES = roboptim-core-dummy-plugin.cc roboptim_core_dummy_plugin_la_LDFLAGS = -module -version-info 1:1:0 commit f7a7110855a14b14973989b83b87cebbfad99879 Author: Moulard <tho...@gm...> Date: Wed Jun 17 10:15:54 2009 +0900 Fix error in finite difference gradient. * src/finite-difference-gradient.cc: Avoid returning NaN if the computed difference is almost null. Signed-off-by: Moulard <tho...@gm...> diff --git a/ChangeLog b/ChangeLog index 5693632..fcddbea 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-06-17 Thomas Moulard <tho...@gm...> + + Fix error in finite difference gradient. + * src/finite-difference-gradient.cc: Avoid returning NaN + if the computed difference is almost null. + 2009-06-16 Thomas Moulard <tho...@gm...> Handle NaN in copy assertions. diff --git a/src/finite-difference-gradient.cc b/src/finite-difference-gradient.cc index ff208ed..e53b545 100644 --- a/src/finite-difference-gradient.cc +++ b/src/finite-difference-gradient.cc @@ -57,6 +57,10 @@ namespace roboptim result_t resEps = adaptee_ (xEps); gradient (j) = (resEps[idFunction] - res[idFunction]) / epsilon_; + + // Avoid returning NaN if gradient is almost null. + if (gradient (j) != gradient (j)) + gradient (j) = 0.; } } ----------------------------------------------------------------------- Summary of changes: ChangeLog | 13 +++++++++++++ include/roboptim/core/solver-factory.hxx | 8 ++++++++ src/Makefile.am | 4 ++-- src/finite-difference-gradient.cc | 4 ++++ 4 files changed, 27 insertions(+), 2 deletions(-) hooks/post-receive -- roboptim |
From: Thomas M. <tho...@us...> - 2009-06-17 02:51:00
|
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". The branch, core-ipopt-plugin has been updated via 436f46b1a66dbf92a98599a0ee5014cb6374e83c (commit) from abd0bf38007ef7a0f4bb3341eb11e72655e7f23b (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 436f46b1a66dbf92a98599a0ee5014cb6374e83c Author: Thomas Moulard <tho...@gm...> Date: Wed Jun 17 11:48:48 2009 +0900 Make compilation more robust. * ipopt.mk: Here. Signed-off-by: Thomas Moulard <tho...@gm...> diff --git a/ChangeLog b/ChangeLog index cbabf7a..5fd3e11 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2009-06-17 Thomas Moulard <tho...@gm...> + Make compilation more robust. + * ipopt.mk: Here. + +2009-06-17 Thomas Moulard <tho...@gm...> + Fix Libtool warning. * ipopt.mk: New. * src/Makefile.am, diff --git a/ipopt.mk b/ipopt.mk index 675b70f..97dc0b9 100644 --- a/ipopt.mk +++ b/ipopt.mk @@ -3,6 +3,10 @@ # Link against Ipopt. IPOPT_LIBS = -lipopt +# Add pthread CFLAGS as GCC needs -pthread /both/ at compile +# and link time. +IPOPT_LIBS += $(PTHREAD_CFLAGS) + # Fix yet another Ipopt problem... # Ipopt may use libraries like pthreads and lapack # but does not link against them even if they are needed. ----------------------------------------------------------------------- Summary of changes: ChangeLog | 5 +++++ ipopt.mk | 4 ++++ 2 files changed, 9 insertions(+), 0 deletions(-) hooks/post-receive -- roboptim |
From: Thomas M. <tho...@us...> - 2009-06-17 02:45:45
|
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". The branch, core-ipopt-plugin has been updated via abd0bf38007ef7a0f4bb3341eb11e72655e7f23b (commit) from cf05e5cc04c0b9520ca43c169f94712b61a457f3 (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 abd0bf38007ef7a0f4bb3341eb11e72655e7f23b Author: Thomas Moulard <tho...@gm...> Date: Wed Jun 17 11:43:32 2009 +0900 Fix Libtool warning. * ipopt.mk: New. * src/Makefile.am, * tests/Makefile.am: Do not link directly against a module but against sources. Signed-off-by: Thomas Moulard <tho...@gm...> diff --git a/ChangeLog b/ChangeLog index 8ccf792..cbabf7a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2009-06-17 Thomas Moulard <tho...@gm...> + Fix Libtool warning. + * ipopt.mk: New. + * src/Makefile.am, + * tests/Makefile.am: Do not link directly against a module + but against sources. + +2009-06-17 Thomas Moulard <tho...@gm...> + Make compilation more robust. * tests/Makefile.am: Here. diff --git a/ipopt.mk b/ipopt.mk new file mode 100644 index 0000000..675b70f --- /dev/null +++ b/ipopt.mk @@ -0,0 +1,16 @@ +# -*- Automake -*- + +# Link against Ipopt. +IPOPT_LIBS = -lipopt + +# Fix yet another Ipopt problem... +# Ipopt may use libraries like pthreads and lapack +# but does not link against them even if they are needed. +# The plug-in have to do it to avoid installing libraries with +# undefined symbols. +# The work around is to link against lapack here, hopefully it will +# be solved upstream and this useless dependency will be removed. +IPOPT_LIBS += \ + $(PTHREAD_LIBS) \ + -llapack -lblas -lm -ldl \ + -lgfortranbegin -lgfortran diff --git a/src/Makefile.am b/src/Makefile.am index e3c7280..9742e0d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,4 +1,5 @@ include $(top_srcdir)/build-aux/init.mk +include $(top_srcdir)/ipopt.mk # Add pthread CFLAGS. AM_CPPFLAGS += $(PTHREAD_CFLAGS) @@ -18,19 +19,6 @@ roboptim_core_ipopt_plugin_la_SOURCES = doc.hh roboptim-core-ipopt-plugin.cc roboptim_core_ipopt_plugin_la_LIBADD = $(ROBOPTIMCORE_LIBS) # Link against Ipopt. -roboptim_core_ipopt_plugin_la_LIBADD += -lipopt - -# Fix yet another Ipopt problem... -# Ipopt may use libraries like pthreads and lapack -# but does not link against them even if they are needed. -# The plug-in have to do it to avoid installing libraries with -# undefined symbols. -# The work around is to link against lapack here, hopefully it will -# be solved upstream and this useless dependency will be removed. -roboptim_core_ipopt_plugin_la_LIBADD += \ - $(PTHREAD_LIBS) \ - -llapack -lblas -lm -ldl \ - -lgfortranbegin -lgfortran - +roboptim_core_ipopt_plugin_la_LIBADD += $(IPOPT_LIBS) roboptim_core_ipopt_plugin_la_LDFLAGS = -module -version-info 1:1:0 diff --git a/tests/Makefile.am b/tests/Makefile.am index 1a4a5cc..b9559e1 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,5 +1,6 @@ include $(top_srcdir)/build-aux/init.mk include $(top_srcdir)/build-aux/autotest.mk +include $(top_srcdir)/ipopt.mk # Add pthread CFLAGS. AM_CPPFLAGS += $(PTHREAD_CFLAGS) @@ -23,9 +24,9 @@ COMMON_SOURCES = common.hh hs071.hh # Simple check_PROGRAMS = simple -simple_SOURCES = simple.cc $(COMMON_SOURCES) -simple_LDADD = $(ROBOPTIMCORE_LIBS) \ - $(top_builddir)/src/roboptim-core-ipopt-plugin.la +simple_SOURCES = simple.cc $(COMMON_SOURCES) \ + $(top_builddir)/src/roboptim-core-ipopt-plugin.cc +simple_LDADD = $(ROBOPTIMCORE_LIBS) $(IPOPT_LIBS) # Plug-in check_PROGRAMS += plugin ----------------------------------------------------------------------- Summary of changes: ChangeLog | 8 ++++++++ ipopt.mk | 16 ++++++++++++++++ src/Makefile.am | 16 ++-------------- tests/Makefile.am | 7 ++++--- 4 files changed, 30 insertions(+), 17 deletions(-) create mode 100644 ipopt.mk hooks/post-receive -- roboptim |
From: Thomas M. <tho...@us...> - 2009-06-17 02:35:43
|
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". The branch, core-ipopt-plugin has been updated via cf05e5cc04c0b9520ca43c169f94712b61a457f3 (commit) from 70c90b3b81163577042f015fcebc1136bdd9dc97 (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 cf05e5cc04c0b9520ca43c169f94712b61a457f3 Author: Thomas Moulard <tho...@gm...> Date: Wed Jun 17 11:33:28 2009 +0900 Make compilation more robust. * tests/Makefile.am: Here. Signed-off-by: Thomas Moulard <tho...@gm...> diff --git a/ChangeLog b/ChangeLog index 83f03eb..8ccf792 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2009-06-17 Thomas Moulard <tho...@gm...> + Make compilation more robust. + * tests/Makefile.am: Here. + +2009-06-17 Thomas Moulard <tho...@gm...> + Use new documentation rules. * configure.ac: Here. diff --git a/tests/Makefile.am b/tests/Makefile.am index 7747953..1a4a5cc 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,6 +1,9 @@ include $(top_srcdir)/build-aux/init.mk include $(top_srcdir)/build-aux/autotest.mk +# Add pthread CFLAGS. +AM_CPPFLAGS += $(PTHREAD_CFLAGS) + # Add RobOptim flags. AM_CPPFLAGS += $(ROBOPTIMCORE_CFLAGS) ----------------------------------------------------------------------- Summary of changes: ChangeLog | 5 +++++ tests/Makefile.am | 3 +++ 2 files changed, 8 insertions(+), 0 deletions(-) hooks/post-receive -- roboptim |
From: Thomas M. <tho...@us...> - 2009-06-17 02:34:18
|
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". The branch, core-ipopt-plugin has been updated via 70c90b3b81163577042f015fcebc1136bdd9dc97 (commit) from 2cb97ff08bc18c4bbacd6d8a9d008c38f9ff4ca7 (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 70c90b3b81163577042f015fcebc1136bdd9dc97 Author: Thomas Moulard <tho...@gm...> Date: Wed Jun 17 11:32:04 2009 +0900 Use new documentation rules. * configure.ac: Here. Signed-off-by: Thomas Moulard <tho...@gm...> diff --git a/ChangeLog b/ChangeLog index 75e656a..83f03eb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2009-06-17 Thomas Moulard <tho...@gm...> + Use new documentation rules. + * configure.ac: Here. + +2009-06-17 Thomas Moulard <tho...@gm...> + Make compilation more robust. * src/Makefile.am: Use PTHREAD_CFLAGS. diff --git a/configure.ac b/configure.ac index 80ed450..b935d04 100644 --- a/configure.ac +++ b/configure.ac @@ -91,9 +91,5 @@ AC_CONFIG_FILES([ tests/package.m4 ]) -AC_CONFIG_FILES([doc/Doxyfile]) - -AC_CONFIG_FILES([doc/sf-upload.sh], [chmod +x doc/sf-upload.sh]) - # Write files. AC_OUTPUT ----------------------------------------------------------------------- Summary of changes: ChangeLog | 5 +++++ configure.ac | 4 ---- 2 files changed, 5 insertions(+), 4 deletions(-) hooks/post-receive -- roboptim |
From: Thomas M. <tho...@us...> - 2009-06-17 02:30:56
|
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". The branch, core-ipopt-plugin has been updated via 2cb97ff08bc18c4bbacd6d8a9d008c38f9ff4ca7 (commit) from 20eb2b3f6ef626a64037bf3212f76e660486dd00 (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 2cb97ff08bc18c4bbacd6d8a9d008c38f9ff4ca7 Author: Thomas Moulard <tho...@gm...> Date: Wed Jun 17 11:28:39 2009 +0900 Make compilation more robust. * src/Makefile.am: Use PTHREAD_CFLAGS. Signed-off-by: Thomas Moulard <tho...@gm...> diff --git a/ChangeLog b/ChangeLog index 184de9c..75e656a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-06-17 Thomas Moulard <tho...@gm...> + + Make compilation more robust. + * src/Makefile.am: Use PTHREAD_CFLAGS. + 2009-06-16 Thomas Moulard <tho...@gm...> Fix test suite. diff --git a/src/Makefile.am b/src/Makefile.am index 1a6c29b..e3c7280 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,5 +1,8 @@ include $(top_srcdir)/build-aux/init.mk +# Add pthread CFLAGS. +AM_CPPFLAGS += $(PTHREAD_CFLAGS) + # Add RobOptim flags. AM_CPPFLAGS += $(ROBOPTIMCORE_CFLAGS) ----------------------------------------------------------------------- Summary of changes: ChangeLog | 5 +++++ src/Makefile.am | 3 +++ 2 files changed, 8 insertions(+), 0 deletions(-) hooks/post-receive -- roboptim |
From: Thomas M. <tho...@us...> - 2009-06-16 09:54:57
|
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". The branch, share has been updated via 96e3dd303b7e293b4ece4bf13c88848185b2be7b (commit) from c74cec84ccfa048a86f06791500339575c6771cf (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 96e3dd303b7e293b4ece4bf13c88848185b2be7b Author: Thomas Moulard <tho...@gm...> Date: Tue Jun 16 18:51:41 2009 +0900 Make initializeProblem generic. * optimization-tests/hs071.hh: Here. Signed-off-by: Thomas Moulard <tho...@gm...> diff --git a/ChangeLog b/ChangeLog index 69eb95c..e65aa35 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2009-06-16 Thomas Moulard <tho...@gm...> + Make initializeProblem generic. + * optimization-tests/hs071.hh: Here. + +2009-06-16 Thomas Moulard <tho...@gm...> + Do not use boost::make_shared. * optimization-tests/hs071.hh: Here. diff --git a/optimization-tests/hs071.hh b/optimization-tests/hs071.hh index 5a5c770..811dc27 100644 --- a/optimization-tests/hs071.hh +++ b/optimization-tests/hs071.hh @@ -173,7 +173,7 @@ struct G1 : public TwiceDerivableFunction }; -template <typename T> +template <typename T, typename NLF> void initialize_problem (T& pb) { // Set bound for all variables. @@ -185,8 +185,10 @@ void initialize_problem (T& pb) boost::shared_ptr<G0> g0 (new G0 ()); boost::shared_ptr<G1> g1 (new G1 ()); - pb.addConstraint (g0, Function::makeLowerInterval (25.)); - pb.addConstraint (g1, Function::makeInterval (40., 40.)); + pb.addConstraint (boost::static_pointer_cast<NLF> (g0), + Function::makeLowerInterval (25.)); + pb.addConstraint (boost::static_pointer_cast<NLF> (g1), + Function::makeInterval (40., 40.)); // Set the starting point. Function::vector_t start (pb.function ().inputSize ()); ----------------------------------------------------------------------- Summary of changes: ChangeLog | 5 +++++ optimization-tests/hs071.hh | 8 +++++--- 2 files changed, 10 insertions(+), 3 deletions(-) hooks/post-receive -- roboptim |
From: Thomas M. <tho...@us...> - 2009-06-16 09:51:23
|
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". The branch, core-ipopt-plugin has been updated via 20eb2b3f6ef626a64037bf3212f76e660486dd00 (commit) from c34830985169406decf0560f59ab6ab7f0c764b5 (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 20eb2b3f6ef626a64037bf3212f76e660486dd00 Author: Thomas Moulard <tho...@gm...> Date: Tue Jun 16 18:48:03 2009 +0900 Fix test suite. * tests/hs071.hh, * tests/plugin.cc, * tests/simple.cc: Here. Signed-off-by: Thomas Moulard <tho...@gm...> diff --git a/ChangeLog b/ChangeLog index bfeb461..184de9c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2009-06-16 Thomas Moulard <tho...@gm...> + Fix test suite. + * tests/hs071.hh, + * tests/plugin.cc, + * tests/simple.cc: Here. + +2009-06-16 Thomas Moulard <tho...@gm...> + Synchronize with share. * tests/hs071.hh: Here. diff --git a/tests/hs071.hh b/tests/hs071.hh index 5a5c770..811dc27 100644 --- a/tests/hs071.hh +++ b/tests/hs071.hh @@ -173,7 +173,7 @@ struct G1 : public TwiceDerivableFunction }; -template <typename T> +template <typename T, typename NLF> void initialize_problem (T& pb) { // Set bound for all variables. @@ -185,8 +185,10 @@ void initialize_problem (T& pb) boost::shared_ptr<G0> g0 (new G0 ()); boost::shared_ptr<G1> g1 (new G1 ()); - pb.addConstraint (g0, Function::makeLowerInterval (25.)); - pb.addConstraint (g1, Function::makeInterval (40., 40.)); + pb.addConstraint (boost::static_pointer_cast<NLF> (g0), + Function::makeLowerInterval (25.)); + pb.addConstraint (boost::static_pointer_cast<NLF> (g1), + Function::makeInterval (40., 40.)); // Set the starting point. Function::vector_t start (pb.function ().inputSize ()); diff --git a/tests/plugin.cc b/tests/plugin.cc index df08662..b311b27 100644 --- a/tests/plugin.cc +++ b/tests/plugin.cc @@ -34,7 +34,8 @@ int run_test () F f; solver_t::problem_t pb (f); - initialize_problem (pb); + initialize_problem<solver_t::problem_t, + roboptim::TwiceDerivableFunction> (pb); // Initialize solver SolverFactory<solver_t> factory ("ipopt", pb); diff --git a/tests/simple.cc b/tests/simple.cc index aae774d..d0af27e 100644 --- a/tests/simple.cc +++ b/tests/simple.cc @@ -31,7 +31,8 @@ int run_test () F f; IpoptSolver::problem_t pb (f); - initialize_problem (pb); + initialize_problem<IpoptSolver::problem_t, + roboptim::TwiceDerivableFunction> (pb); // Initialize solver IpoptSolver solver (pb); ----------------------------------------------------------------------- Summary of changes: ChangeLog | 7 +++++++ tests/hs071.hh | 8 +++++--- tests/plugin.cc | 3 ++- tests/simple.cc | 3 ++- 4 files changed, 16 insertions(+), 5 deletions(-) hooks/post-receive -- roboptim |
From: Thomas M. <tho...@us...> - 2009-06-16 07:49:00
|
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". The branch, core has been updated via 79b21c369d8f5a788b5bbf18bda340a749d0b7af (commit) from d87c457e32f0ff701a2516c43b1544c720107da9 (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 79b21c369d8f5a788b5bbf18bda340a749d0b7af Author: Thomas Moulard <tho...@gm...> Date: Tue Jun 16 16:46:50 2009 +0900 Handle NaN in copy assertions. * src/util.cc: Here. Signed-off-by: Thomas Moulard <tho...@gm...> diff --git a/ChangeLog b/ChangeLog index e2f7f2b..5693632 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2009-06-16 Thomas Moulard <tho...@gm...> + Handle NaN in copy assertions. + * src/util.cc: Here. + +2009-06-16 Thomas Moulard <tho...@gm...> + Do not use boost::make_shared. * tests/simple.cc: Here. diff --git a/src/util.cc b/src/util.cc index c08d13e..827a43d 100644 --- a/src/util.cc +++ b/src/util.cc @@ -31,8 +31,12 @@ namespace roboptim { memcpy (dst, &src[0], src.size () * sizeof (Function::value_type)); + // NaN != NaN, handle this case. for (std::size_t i = 0; i < src.size (); ++i) - assert (dst[i] == src[i]); + if (src[i] != src[i]) + assert (dst[i] != dst[i]); + else + assert (dst[i] == src[i]); } void @@ -40,8 +44,12 @@ namespace roboptim { memcpy (&dst[0], src, dst.size () * sizeof (Function::value_type)); + // NaN != NaN, handle this case. for (std::size_t i = 0; i < dst.size (); ++i) - assert (dst[i] == src[i]); + if (src[i] != src[i]) + assert (dst[i] != dst[i]); + else + assert (dst[i] == src[i]); } } // end of namespace detail. } // end of namespace roboptim. ----------------------------------------------------------------------- Summary of changes: ChangeLog | 5 +++++ src/util.cc | 12 ++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) hooks/post-receive -- roboptim |
From: Thomas M. <tho...@us...> - 2009-06-16 06:59:07
|
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". The branch, core-ipopt-plugin has been updated via c34830985169406decf0560f59ab6ab7f0c764b5 (commit) from 469c4a6d874ab37a2f21719ec73745bc6cc491a0 (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 c34830985169406decf0560f59ab6ab7f0c764b5 Author: Thomas Moulard <tho...@gm...> Date: Tue Jun 16 15:56:49 2009 +0900 Synchronize with share. * tests/hs071.hh: Here. Signed-off-by: Thomas Moulard <tho...@gm...> diff --git a/ChangeLog b/ChangeLog index 215e8a6..bfeb461 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-06-16 Thomas Moulard <tho...@gm...> + + Synchronize with share. + * tests/hs071.hh: Here. + 2009-06-15 Thomas Moulard <tho...@gm...> Regenerate reference. diff --git a/tests/hs071.hh b/tests/hs071.hh index aa3e421..5a5c770 100644 --- a/tests/hs071.hh +++ b/tests/hs071.hh @@ -19,7 +19,6 @@ #ifndef OPTIMIZATION_TESTS_HS071_HH # define OPTIMIZATION_TESTS_HS071_HH # include <utility> -# include <boost/make_shared.hpp> # include <roboptim/core/twice-derivable-function.hh> using namespace roboptim; @@ -183,11 +182,11 @@ void initialize_problem (T& pb) pb.argumentBounds ()[i] = Function::makeInterval (1., 5.); // Add constraints. - pb.addConstraint (boost::make_shared<G0> (), - Function::makeLowerInterval (25.)); + boost::shared_ptr<G0> g0 (new G0 ()); + boost::shared_ptr<G1> g1 (new G1 ()); - pb.addConstraint (boost::make_shared<G1> (), - Function::makeInterval (40., 40.)); + pb.addConstraint (g0, Function::makeLowerInterval (25.)); + pb.addConstraint (g1, Function::makeInterval (40., 40.)); // Set the starting point. Function::vector_t start (pb.function ().inputSize ()); ----------------------------------------------------------------------- Summary of changes: ChangeLog | 5 +++++ tests/hs071.hh | 9 ++++----- 2 files changed, 9 insertions(+), 5 deletions(-) hooks/post-receive -- roboptim |
From: Thomas M. <tho...@us...> - 2009-06-16 06:56:24
|
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". The branch, share has been updated via c74cec84ccfa048a86f06791500339575c6771cf (commit) from a53adc1a84735ceaf8071556387af2aec305d2e2 (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 c74cec84ccfa048a86f06791500339575c6771cf Author: Thomas Moulard <tho...@gm...> Date: Tue Jun 16 15:54:09 2009 +0900 Do not use boost::make_shared. * optimization-tests/hs071.hh: Here. Signed-off-by: Thomas Moulard <tho...@gm...> diff --git a/ChangeLog b/ChangeLog index cdbb6dc..69eb95c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2009-06-16 Thomas Moulard <tho...@gm...> + Do not use boost::make_shared. + * optimization-tests/hs071.hh: Here. + +2009-06-16 Thomas Moulard <tho...@gm...> + Fix broken pkg-config.mk file. * .gitignore: New. * build-aux/pkg-config.mk: Fix variable names. diff --git a/optimization-tests/hs071.hh b/optimization-tests/hs071.hh index aa3e421..5a5c770 100644 --- a/optimization-tests/hs071.hh +++ b/optimization-tests/hs071.hh @@ -19,7 +19,6 @@ #ifndef OPTIMIZATION_TESTS_HS071_HH # define OPTIMIZATION_TESTS_HS071_HH # include <utility> -# include <boost/make_shared.hpp> # include <roboptim/core/twice-derivable-function.hh> using namespace roboptim; @@ -183,11 +182,11 @@ void initialize_problem (T& pb) pb.argumentBounds ()[i] = Function::makeInterval (1., 5.); // Add constraints. - pb.addConstraint (boost::make_shared<G0> (), - Function::makeLowerInterval (25.)); + boost::shared_ptr<G0> g0 (new G0 ()); + boost::shared_ptr<G1> g1 (new G1 ()); - pb.addConstraint (boost::make_shared<G1> (), - Function::makeInterval (40., 40.)); + pb.addConstraint (g0, Function::makeLowerInterval (25.)); + pb.addConstraint (g1, Function::makeInterval (40., 40.)); // Set the starting point. Function::vector_t start (pb.function ().inputSize ()); ----------------------------------------------------------------------- Summary of changes: ChangeLog | 5 +++++ optimization-tests/hs071.hh | 9 ++++----- 2 files changed, 9 insertions(+), 5 deletions(-) hooks/post-receive -- roboptim |
From: Thomas M. <tho...@us...> - 2009-06-16 06:51:54
|
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". The branch, trajectory has been updated via 75d55fdc3f4fc630c29161857a729342fd6a5382 (commit) from 0353ccbd345bbd6f636079031a16c541fe200604 (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 75d55fdc3f4fc630c29161857a729342fd6a5382 Author: Thomas Moulard <tho...@gm...> Date: Tue Jun 16 15:49:40 2009 +0900 Do not use boost::make_shared. * include/roboptim/trajectory/freeze.hxx: Here. Signed-off-by: Thomas Moulard <tho...@gm...> diff --git a/ChangeLog b/ChangeLog index f6726f6..7fede25 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2009-06-16 Thomas Moulard <tho...@gm...> + Do not use boost::make_shared. + * include/roboptim/trajectory/freeze.hxx: Here. + +2009-06-16 Thomas Moulard <tho...@gm...> + Synchonize with share. * build-aux/pkg-config.mk: Here. diff --git a/include/roboptim/trajectory/freeze.hxx b/include/roboptim/trajectory/freeze.hxx index 1070257..e2137a5 100644 --- a/include/roboptim/trajectory/freeze.hxx +++ b/include/roboptim/trajectory/freeze.hxx @@ -17,8 +17,6 @@ #ifndef ROBOPTIM_TRAJECTORY_FREEZE_HXX # define ROBOPTIM_TRAJECTORY_FREEZE_HXX -# include <boost/make_shared.hpp> - # include <roboptim/core/numeric-linear-function.hh> namespace roboptim @@ -57,9 +55,10 @@ namespace roboptim b[0] = -it->second; - shared_ptr<C> ptr = static_pointer_cast<C> - (make_shared<NumericLinearFunction> (a, b)); - this->problem_.addConstraint (ptr, + NumericLinearFunction* ptr = new NumericLinearFunction (a, b); + shared_ptr<C> constraint = + static_pointer_cast<C> (shared_ptr<NumericLinearFunction> (ptr)); + this->problem_.addConstraint (constraint, Function::makeInterval (0., 0.)); } } ----------------------------------------------------------------------- Summary of changes: ChangeLog | 5 +++++ include/roboptim/trajectory/freeze.hxx | 9 ++++----- 2 files changed, 9 insertions(+), 5 deletions(-) hooks/post-receive -- roboptim |
From: Thomas M. <tho...@us...> - 2009-06-16 06:50:30
|
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". The branch, core has been updated via d87c457e32f0ff701a2516c43b1544c720107da9 (commit) from 177a162259588869663c984da9dccd8f11584bca (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 d87c457e32f0ff701a2516c43b1544c720107da9 Author: Thomas Moulard <tho...@gm...> Date: Tue Jun 16 15:48:18 2009 +0900 Do not use boost::make_shared. * tests/simple.cc: Here. Signed-off-by: Thomas Moulard <tho...@gm...> diff --git a/ChangeLog b/ChangeLog index 2acd575..e2f7f2b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2009-06-16 Thomas Moulard <tho...@gm...> + Do not use boost::make_shared. + * tests/simple.cc: Here. + +2009-06-16 Thomas Moulard <tho...@gm...> + Require Boost 1.34. Revert to Boost 1.34 to keep Ubuntu Hardy compatibility. * configure.ac: Here. diff --git a/tests/simple.cc b/tests/simple.cc index 153dcfa..64296c3 100644 --- a/tests/simple.cc +++ b/tests/simple.cc @@ -16,7 +16,6 @@ // along with roboptim. If not, see <http://www.gnu.org/licenses/>. #include <iostream> -#include <boost/make_shared.hpp> #include "common.hh" #include <roboptim/core/plugin/dummy.hh> @@ -74,7 +73,8 @@ int run_test () && pb.argumentScales ()[2] == 1. && pb.argumentScales ()[3] == 1.); - pb.addConstraint (boost::make_shared<F> (), + F* g = new F (); + pb.addConstraint (boost::shared_ptr<F> (g), Function::makeInterval (0., 5.), 3.5); assert (pb.constraints ().size () == 1); assert (&pb.constraints ()[0] != 0); ----------------------------------------------------------------------- Summary of changes: ChangeLog | 5 +++++ tests/simple.cc | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) hooks/post-receive -- roboptim |
From: Thomas M. <tho...@us...> - 2009-06-16 06:47:32
|
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". The branch, core has been updated via 177a162259588869663c984da9dccd8f11584bca (commit) from 84b9add6b020a9543e7762303026943178e798c5 (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 177a162259588869663c984da9dccd8f11584bca Author: Thomas Moulard <tho...@gm...> Date: Tue Jun 16 15:45:18 2009 +0900 Require Boost 1.34. Revert to Boost 1.34 to keep Ubuntu Hardy compatibility. * configure.ac: Here. Signed-off-by: Thomas Moulard <tho...@gm...> diff --git a/ChangeLog b/ChangeLog index b120b3c..2acd575 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2009-06-16 Thomas Moulard <tho...@gm...> + Require Boost 1.34. + Revert to Boost 1.34 to keep Ubuntu Hardy compatibility. + * configure.ac: Here. + +2009-06-16 Thomas Moulard <tho...@gm...> + Synchronize with share. * build-aux/pkg-config.mk: Here. diff --git a/configure.ac b/configure.ac index ce1e6b0..f1df389 100644 --- a/configure.ac +++ b/configure.ac @@ -63,9 +63,7 @@ AC_CHECK_LIB([ltdl], [lt_dlopen], [], # Search for Boost - -# Need 1.37 for boost::make_shared. -BOOST_REQUIRE(1.37) +BOOST_REQUIRE(1.34) BOOST_FORMAT BOOST_MPL BOOST_OPTIONAL ----------------------------------------------------------------------- Summary of changes: ChangeLog | 6 ++++++ configure.ac | 4 +--- 2 files changed, 7 insertions(+), 3 deletions(-) hooks/post-receive -- roboptim |