|
11 | 11 | from MLC.Population.Creation.CreationFactory import CreationFactory |
12 | 12 | from MLC.Population.Evaluation.EvaluatorFactory import EvaluatorFactory |
13 | 13 | from MLC.Population.Population import Population |
14 | | -from MLC.Scripts.Evaluation import toy_problem |
15 | | -from MLC.Scripts.Evaluation import toy_problem_python_ev |
16 | | -from MLC.Scripts.Evaluation import arduino |
17 | | -from MLC.Scripts.Evaluation import simulink_ev |
18 | | -from MLC.Scripts.Preevaluation import default |
19 | | -from MLC.Scripts.Preevaluation import simulink_preev |
20 | 14 | from MLC.Simulation import Simulation |
21 | 15 |
|
22 | 16 |
|
23 | 17 | class Application(object): |
24 | 18 |
|
25 | 19 | def __init__(self, simulation, log_mode='console'): |
26 | 20 | self._config = Config.get_instance() |
27 | | - self._set_ev_callbacks() |
28 | | - self._set_preev_callbacks() |
29 | 21 |
|
30 | 22 | # Set logger mode of the App |
31 | 23 | set_logger(log_mode) |
| 24 | + self._project_validations() |
32 | 25 | self._simulation = simulation |
33 | 26 |
|
34 | 27 | # Gen creator |
@@ -170,16 +163,10 @@ def show_best(self, population): |
170 | 163 | stop_no_graph = self._config.getboolean('BEHAVIOUR', 'stopongraph') |
171 | 164 | EvaluatorFactory.get_ev_callback().show_best(best_index, best_indiv, stop_no_graph) |
172 | 165 |
|
173 | | - def _set_ev_callbacks(self): |
174 | | - # Set the callbacks to be called at the moment of the evaluation |
175 | | - # FIXME: Dinamically get instances from "MLC.Scripts import *" |
176 | | - EvaluatorFactory.set_ev_callback('toy_problem', toy_problem) |
177 | | - EvaluatorFactory.set_ev_callback('toy_problem_python_ev', toy_problem_python_ev) |
178 | | - EvaluatorFactory.set_ev_callback('arduino', arduino) |
179 | | - EvaluatorFactory.set_ev_callback('simulink_ev', simulink_ev) |
180 | | - |
181 | | - def _set_preev_callbacks(self): |
182 | | - # Set the callbacks to be called at the moment of the preevaluation |
183 | | - # FIXME: To this dynamically searching .pys in the directory |
184 | | - PreevaluationManager.set_callback('default', default) |
185 | | - PreevaluationManager.set_callback('simulink_preev', simulink_preev) |
| 166 | + |
| 167 | + def _project_validations(self): |
| 168 | + # Check that the evaluation and preevaluation modules can be loaded |
| 169 | + EvaluatorFactory.get_ev_callback() |
| 170 | + PreevaluationManager.get_callback() |
| 171 | + |
| 172 | + # TODO: Add another validations |
0 commit comments