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

ProgressListener that returns current population? #7

Open
sherzig opened this issue Feb 24, 2017 · 3 comments
Open

ProgressListener that returns current population? #7

sherzig opened this issue Feb 24, 2017 · 3 comments

Comments

@sherzig
Copy link
Contributor

sherzig commented Feb 24, 2017

Is there a way to return the current population using a progress listener? I've tried to do this by retrieving the approximation set through the executor and instrumenter accessible from the event. However, it's returned null / an empty list. Any clues?

Thanks

@martin-fleck-at
Copy link
Collaborator

Hi Sebastian,

Actually, my assumption would have been that it works with the progress listener. In fact, there is a class that already those that partially [1]. The problem seems to be that the Instrumenter.getLastAccumulator() [2] method from MOEA returns null. In the MOEA framework, an accumulator stores collected data from a single run of an algorithm. The instrumenter used in MOMoT collects these accumulators to gather the necessary data during the execution. Unfortunately, I do not have the time to debug into this right now. Maybe an update on a newer version of MOEA fixes this issue, but I did not check. Hopefully, I could point you in the right direction and sorry for not being able to provide a more positive answer.

[1] https://github.com/martin-fleck/momot/blob/master/plugins/at.ac.tuwien.big.moea/src/at/ac/tuwien/big/moea/experiment/executor/listener/CollectiveProgressListener.java
[2] http://moeaframework.org/javadoc/org/moeaframework/Instrumenter.html

@sherzig
Copy link
Contributor Author

sherzig commented Feb 27, 2017

No problem! Thanks for the pointers - I will have a closer look and submit a pull request if I find the solution.

@sherzig
Copy link
Contributor Author

sherzig commented Feb 27, 2017

OK, I think I found the solution. First off, I've migrated MOMoT (mostly) to MOEA 2.12. As for the approximation set:

  1. SearchExperiment.java defines a method setAllCollectors(boolean). However, this function is never called (anywhere, from what I can tell).
  2. Collectors can be defined in the .momot file under experiment - however, there seems to be a bug in the grammar that requires both a "built-in" collector (e.g., approximationSet as a key) and a custom collector class (e.g., "new SimpleBestSolutionCollector()"). With these settings, the generated code enables the approximationSet collector and adds a custom collector:
experiment = {
    ...
    collectors = [ approximationSet new SimpleBestSolutionCollector() ]
    // Must appear as last entry, otherwise compilation error is thrown
}

As mentioned in the comment, this must also appear as the last line in the experiment section.

With the above, I can access the approximation set from the accumulator. It seems that by default only the NFE is collected.

BTW, I found a couple of other smaller bugs along the way - e.g., AccumulatorUtil.getLatestAlgorithm returns an object of type Solution, which should probably be an Algorithm instead.

I'll send you a pull request once I've completed testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants