-
Notifications
You must be signed in to change notification settings - Fork 32
Description
Optimization opportunity in relation to scoreTree.
Detailed Description
For boolean program generation, candidate trees are scored in two occasions using the scoreTree procedure which is an expensive one. It is called in the optimization algorithm, via the transform function and in merge demes via demeToTrees. And since in both occasions, we are dealing with the same constants, i.e., the tree and the table against which it is scored, there is unnecessary duplication of effort.
Context
Gives us an opportunity to optimize our code for performance.
Possible Implementation
The BehavioralScore typed value that is returned by scoreTree could be maintained in the representation data structure which includes scored instances or same caching mechanism used in getCscore can be used. Judging by the amount of change that would be required for this, the second approach sounds more compact.
Note
Make sure to send PR to the ref/PeTTa branch