-
Notifications
You must be signed in to change notification settings - Fork 287
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add multi-objective optimization API with Pagmo support #1106
Conversation
Codecov Report
@@ Coverage Diff @@
## release-6.7 #1106 +/- ##
==============================================
Coverage ? 55.89%
==============================================
Files ? 340
Lines ? 25117
Branches ? 0
==============================================
Hits ? 14040
Misses ? 11077
Partials ? 0
|
} // namespace common | ||
|
||
template <class T> | ||
auto operator<<(std::ostream& os, const T& t) -> decltype(t.print(os), os) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just for my own edification, how is decltype(t.print(os), os)
different from decltype(os)
?
As I understand it, the return value of the comma operator is a reference to the result of whatever expression is on the right-hand side of the comma, in this case os
. Since decltype(~)
returns the type information of the evaluation of whatever expression it's given, wouldn't it just be returning std::ostream&
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I think I understand now! This is a SFINAE trick to make sure that T
satisfies the constraint of having a member function with the signature print(std::ostream&)
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly!
dart/math/Helpers.hpp
Outdated
@@ -286,6 +287,57 @@ inline Eigen::VectorXd randomVectorXd(std::size_t size, double limit) | |||
return randomVectorXd(size, -std::abs(limit), std::abs(limit)); | |||
} | |||
|
|||
template <typename T> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: missing
//==============================================================================
above this line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
dart/math/Helpers.hpp
Outdated
|
||
//============================================================================== | ||
template <typename Derived> | ||
void push_right(Derived& m, Eigen::Vector3d&& values) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me know if I'm wrong, but I assume this function is meant to expand dynamically-sized matrices similar to Eigen::MatrixXd
. If so, is there a reason that values
must be an Eigen::Vector3d
instead of Eigen::Matrix<double, N, 1>
where N
is a template parameter?
Also, I can't find any Eigen
member function of the matrix class named right(int)
, so maybe I'm completely misunderstanding the role of this function (same for push_bottom()
).
Furthermore, I can't find where in the code these functions are being used. If they aren't being used yet, I would recommend removing them from this PR, because otherwise I'm not sure if these functions can even compile.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All your points are correct. This function was used during the implementation but it turned out not for the final version. Let me remove this and reintroduce with some corrections later if necessary.
|
||
static Population convertPopulation( | ||
const ::pagmo::population& pagmoPop, | ||
std::shared_ptr<MultiObjectiveProblem> problem); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: use a const std::shared_ptr<T>&
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I intentionally left this as passing by value in order to indicate that this function sharing the ownership because the caller can notice that the reference counting would be increase by the copy. Note that the reference counting would happen only one time because we move the copied shared_ptr
in the function.
As a note, we would be good to have a documentation on this convention like this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, okay. That's a subtle but reasonable signal to the user 👍
The provided pagmo-config.cmake doesn't work on macOS
- remove functions end with vector/matrix - remove functions that take limit argument - improve documentation - add more unit tests
…mo_multi_objective # Conflicts: # dart/math/CMakeLists.txt # dart/math/Random.cpp # dart/math/Random.hpp
…mo_multi_objective
…mo_multi_objective
…multi_objective # Conflicts: # CHANGELOG.md # dart/math/Helpers.hpp
This PR is an initial effort for having a pipeline for multi-objective optimization.
Summary of Main Changes
MultiObjectiveProblem
: Class to define a multi-objective problem. You can compose multiple objectives, equality constraints, and inequality constraints by addingFunction
s to this class.Population
: Container of populations and their fitness. Pagmo2 inspired the implementation.MultiObjectiveSolver
: Base class for concrete solvers.PagmoMultiObjectiveSolver
: The first concrete solver that depends on pagmo2, which is a population-based optimization library for single/multi-objective problems.The implementation is based on other project collaborated with Daqing Yi(@dqyi11).
Before creating a pull request
clang-format
Before merging a pull request
CHANGELOG.md