i want to extend the multiobjective evolutionary algorithm with special constraint handling. I'm in the beginning of the process, but if I get decent result, i can also share this with you.
For this reason, I might modify the NSGA2-Selector and I have a question: Where exactly is the Selector (NSGA2) chosen? I believe it's done by the "@ImplementedBy"-Annotation in "org.opt4j.optimizer.ea.Selector.java", but if you could nugde me into the right direction where to say "use MySelector!", I would really appreciate it!
Also could you have a look at "org.opt4j.optimizer.ea.Nsga2.java" line 104, I don't think the loop makes any sense (for (int t = 0; t < 0; t++){…}), but as the default tournament value is 0, I believe this doesn't influence the current algorithm.
Thanks.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
you're right: The "@ImplementedBy"-Annotation points to the default implementation of the Selector, if no explicit binding is made. If you now want to use your own "YourSelector implements Selector", you have to explicitly bind it. How this is done can be seen, e.g., in the org.opt4j.optimizer.ea.Spea2Module. I.e. additionally to YourSelector you must implement a "YourSelectorModule extends SelectorModule" and bind your selector there:
@Override
public void config() {
bindSelector(YourSelector.class);
}
If you then start the configuration GUI, you find the new module at modules->optimizer->selector from where you can choose it.
Thank you very much for the hint with the for loop in Nsga2. This was a bug. I fixed it in revision 508.
Cheers
Felix
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
FYI according to current plans, I'm going to integrate constraints using the concept of constraint-domination as described in , p.192.
But there is another thing that I forgot to post earlier:
If you could have a look at "org.opt4j.optimizer.ea.Nsga2.java" line 106 et seqq., the second part of the if-clause seems strange to me considering the body:
if (rank < rank || opponent == winner) {
winner = opponent;
}
I believe the niched comparison operator that also considers the crowding distance should be applied here…
Kalyanmoy D. Deb, Amrit Pratap, Sameer Agarwal, and T. Meyarivan. A fast and elitist multiobjective
genetic algorithm : Nsga-ii. Evolutionary Computation, IEEE Transactions on, 6(2):182-197,
August 2002.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
There is divergence between the NSGA2 paper and the implementation that you can find at the PISA website (http://www.tik.ee.ethz.ch/pisa/selectors/nsga2/?page=nsga2.php). I rather implemented the PISA version since I could use the PISA version as reference implementation.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
1)
Well, this actually proves my point. In the PISA implementation, the fitness value incorporates both, the pareto rank and the crowding distance, whereas in Opt4J only the pareto rank is considered.
PISAs fitness is a double value where a fitness=3,14 means, that the solution has a rank of 3 and a represented crowding distance of 0,14 (it is the inverse of the calculated C.D. to be exact). In PISAs evironmentalSelection(), the two aspects (P.R. & C.D.) of the NSGA2 are combined:
for (i = 0; i < size; i++) {
pp_all->ind_array_->fitness += 1.0 / dist;
}
I still don't know the sense of the second part of the above mentioned if-clause, maybe in C there are special optimizations by the compiler, but I still believe the crowding distance should be considered at this point (at least additionally).
2)
I found out today that the Objectives class of Opt4J is not meant to be changed. As I want to change the dominance criterion, I would like to know if you are even interested in such kind of constraint handling, because this could also affect the API (I'll maybe make a module for objectives and for domination strategies, as soon as I find out how :) meaning that existing implementations would require adjustments.
Otherwise I would just do it according to our needs._
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
1) This confuses me somehow, but I am sure youre right that this is not the 1-to-1 PISA implementation. You can send me an SVN patch and then I can "fix" the NSGA2 in the repository. Thanks.
2) Yeah, I needed this once and then I copied all the objectives to a new Objectives instances and called individual.setObjectives(..). However, adapting the code of the Objectives slightly might also allow changes, e.g., an invalidate() method that resets the double array to null. If you would share the constraint handling with us, we would appreciate it. Changing the API is always acceptable if things dont become more complicated.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
i want to extend the multiobjective evolutionary algorithm with special constraint handling. I'm in the beginning of the process, but if I get decent result, i can also share this with you.
For this reason, I might modify the NSGA2-Selector and I have a question: Where exactly is the Selector (NSGA2) chosen? I believe it's done by the "@ImplementedBy"-Annotation in "org.opt4j.optimizer.ea.Selector.java", but if you could nugde me into the right direction where to say "use MySelector!", I would really appreciate it!
Also could you have a look at "org.opt4j.optimizer.ea.Nsga2.java" line 104, I don't think the loop makes any sense (for (int t = 0; t < 0; t++){…}), but as the default tournament value is 0, I believe this doesn't influence the current algorithm.
Thanks.
Hi,
you're right: The "@ImplementedBy"-Annotation points to the default implementation of the Selector, if no explicit binding is made. If you now want to use your own "YourSelector implements Selector", you have to explicitly bind it. How this is done can be seen, e.g., in the org.opt4j.optimizer.ea.Spea2Module. I.e. additionally to YourSelector you must implement a "YourSelectorModule extends SelectorModule" and bind your selector there:
@Override
public void config() {
bindSelector(YourSelector.class);
}
If you then start the configuration GUI, you find the new module at modules->optimizer->selector from where you can choose it.
Thank you very much for the hint with the for loop in Nsga2. This was a bug. I fixed it in revision 508.
Cheers
Felix
Thank you for your answer! As I won't use the Gui, I will still have to find out some stuff, but this was actually helpful!
Thx
It's the same without GUI:
See http://opt4j.sourceforge.net/documentation/2.2/documentationse7.html#x8-220007.2 7.2 Start Optimization from Java. Instead of selecting YourSelectorModule in the GUI you have to add it to the Collection<Module> modules.
Cheers
Felix
Thanks again!
FYI according to current plans, I'm going to integrate constraints using the concept of constraint-domination as described in , p.192.
But there is another thing that I forgot to post earlier:
If you could have a look at "org.opt4j.optimizer.ea.Nsga2.java" line 106 et seqq., the second part of the if-clause seems strange to me considering the body:
if (rank < rank || opponent == winner) {
winner = opponent;
}
I believe the niched comparison operator that also considers the crowding distance should be applied here…
Kalyanmoy D. Deb, Amrit Pratap, Sameer Agarwal, and T. Meyarivan. A fast and elitist multiobjective
genetic algorithm : Nsga-ii. Evolutionary Computation, IEEE Transactions on, 6(2):182-197,
August 2002.
There is divergence between the NSGA2 paper and the implementation that you can find at the PISA website (http://www.tik.ee.ethz.ch/pisa/selectors/nsga2/?page=nsga2.php). I rather implemented the PISA version since I could use the PISA version as reference implementation.
1)
Well, this actually proves my point. In the PISA implementation, the fitness value incorporates both, the pareto rank and the crowding distance, whereas in Opt4J only the pareto rank is considered.
PISAs fitness is a double value where a fitness=3,14 means, that the solution has a rank of 3 and a represented crowding distance of 0,14 (it is the inverse of the calculated C.D. to be exact). In PISAs evironmentalSelection(), the two aspects (P.R. & C.D.) of the NSGA2 are combined:
for (i = 0; i < size; i++) {
pp_all->ind_array_->fitness += 1.0 / dist;
}
I still don't know the sense of the second part of the above mentioned if-clause, maybe in C there are special optimizations by the compiler, but I still believe the crowding distance should be considered at this point (at least additionally).
2)
I found out today that the Objectives class of Opt4J is not meant to be changed. As I want to change the dominance criterion, I would like to know if you are even interested in such kind of constraint handling, because this could also affect the API (I'll maybe make a module for objectives and for domination strategies, as soon as I find out how :) meaning that existing implementations would require adjustments.
Otherwise I would just do it according to our needs._
1) This confuses me somehow, but I am sure youre right that this is not the 1-to-1 PISA implementation. You can send me an SVN patch and then I can "fix" the NSGA2 in the repository. Thanks.
2) Yeah, I needed this once and then I copied all the objectives to a new Objectives instances and called individual.setObjectives(..). However, adapting the code of the Objectives slightly might also allow changes, e.g., an invalidate() method that resets the double array to null. If you would share the constraint handling with us, we would appreciate it. Changing the API is always acceptable if things dont become more complicated.
It could take a while till I get to the coding since I'm still designing the architecture, but I'll try my best…
Great! Take your time.