Closed PanPalitta closed 8 years ago
Could you pinpoint where this normalization condition is defined?
The codes are currently in problem.h as Problem::modulo() and Problem::normalize(). We are only currently using modulo(). I think we should change it to one virtual function that points to the operation needed to bound the search space in the derived class.
I did a quick static code analysis and I support the idea of declaring these two functions as virtual. They are not performance critical.
I have made this change and make the two function a virtual function called boundary in problem.h (which also eliminate the need for a problem.cpp). This change is currently in the pan-edit branch with the unit tested phase_loss_opt.since the class is tested but not refactored.
It might not be a good idea to declare the avg_fitness and fitness functions as virtual. I am concerned that declaring them as such will have an impact on the performance. Could you run some quick performance benchmarks to see if there is any difference? The boundary function is perfectly fine as virtual.
This problems arises because the first version of the code assume that the values we are optimizing over only have to fall within certain boundaries. There are cases such as the optimization of input state state that the values must also comply to the normalization condition. The current code does not allow us to use both condition without active rewriting some lines.