Skip to content
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

Framework for Multi-Objective Optimizations #120

Closed
wants to merge 21 commits into from

Conversation

favre49
Copy link
Member

@favre49 favre49 commented Jul 26, 2019

This PR will add a framework for multi-objective optimization. This will include the DTLZ problems, the NSGA-III optimizer and some indicators (hypervolume, generational distance, epsilon).

class DTLZ1
{
public:
//! Initialize the DTLZ1 function.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Indentation is off, but I think you already mentioned this in IRC.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you folks considered using .clang-format for autoformatting and adding an .editorconfig to enforce the project style proactively?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For mlpack we did setup a Jenkins Job that checks the style, I think we should do the same for ensmallen. About autoformatting, haven't tested it yet, maybe this is an option saves us some time.

@zoq zoq removed the s: unanswered label Jul 26, 2019

arma::vec mins(max.n_rows);
for (size_t i = 0; i < mins.n_elem; i++)
mins[i] = max.row(i).index_max();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can bump the armadillo version as done here: https://github.com/mlpack/ensmallen/pull/119/files#diff-354f30a63fb0907d4ad57269548329e3 to fix the build issue.


#ifndef ENSMALLEN_INDICATORS_IGD_HPP
#define ENSMALLEN_INDICATORS_IGD_HPP

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be a good idea to cite: "Scalable Multi-Objective Optimization Test Problems". And add a simple class description for each function, similar to: https://github.com/mlpack/ensmallen/blob/master/include/ensmallen_bits/problems/himmelblau_function.hpp

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, I'll do the documentation once I finish the code for reference points


class IGD
{
double Indicate(arma::cube& front,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you comment on each parameter.

double Indicate(arma::cube& front,
arma::cube& referenceFront)
{
double igd = 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like the indentation (2 spaces) is off.

R = arma::join_slices(population, Q);

// Evaluate R.
arma::mat fitnessValues(function.NumObjectives(), R.n_slices);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we could put this outside the for loop and reuse the parameter for each iteration.

arma::mat asf(function.NumObjectives(), function.NumObjectives(),
arma::fill::eye);

for (size_t i = 0; i < asf.n_rows; i++)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could use asf.diag().fill(1e6) instead of the two for loops.

arma::mat max(asf.n_rows, fronts[0].size());
for (size_t i = 0; i < asf.n_rows; i++)
{
arma::mat f_asf = f.t() * asf.row(i);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use camel casing for all names.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, I'll fix it once testing is done. I just did it this way so it's easier to compare to the python numpy implementation

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, sounds good.

size_t minIdx = 0;
for (size_t i = 0; i < fronts[l].size(); i++)
{
arma::mat s = nextPop.slice(i);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could avoid another copy if we directly use nextPop.slice(i) and referenceSet.slice(randIdx).

@zoq
Copy link
Member

zoq commented Aug 21, 2019

First commits from the new laptop?

@favre49
Copy link
Member Author

favre49 commented Aug 21, 2019

Yup, I guess I have some fixing to do

@mlpack-bot
Copy link

mlpack-bot bot commented Sep 20, 2019

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions! 👍

@mlpack-bot mlpack-bot bot added the s: stale label Sep 20, 2019
@favre49 favre49 mentioned this pull request Aug 5, 2020
3 tasks
@favre49
Copy link
Member Author

favre49 commented Aug 16, 2020

Closing because of #149

@favre49 favre49 closed this Aug 16, 2020
@jonpsy
Copy link
Member

jonpsy commented Apr 10, 2021

@favre49 I think this a great PR. We can definitely port the indicators module and DLTZ module from here. Allow me to steal your work :). In fact, we can dismantle this PR piece-by-piece; first port the Indicators (easy), then the DLTZ suite and then if we're feeling adventurous, NSGA-III as well; all in separate PR.

@jonpsy jonpsy mentioned this pull request Apr 11, 2021
8 tasks
@jonpsy
Copy link
Member

jonpsy commented May 2, 2021

Some resources for NSGA-III and DLTZ

What I like about Prof. Tsung's implementation is that he has provided us with Pareto Front of the DLTZ. For demonstrations purposes, we can take the txt file of the Front, load it in a IPython Notebook and plot it there. We could then visually compare with the DLTZ front from the paper. Perfect, no?

@jonpsy jonpsy mentioned this pull request Jun 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants