Opened 6 years ago

Last modified 19 months ago

#1489 new enhancement

Change interface between problem and algorithm

Reported by: abeham Owned by: swagner
Priority: medium Milestone: HeuristicLab 4.0
Component: General Version:
Keywords: Cc:

Description

The more problems and the more algorithms we add to HeuristicLab the larger the collection of operators becomes that is shared between them. Additionally the problem stores all these operators while they are actually only needed in the algorithm. So to say the Problem is an operator-provider and the algorithm is an operator-consumer.

Currently the main interface (apart from a few parameters) between these two entities is the Operators property that returns a list of operators.

I would suggest a different approach in that the provider creates and parameterizes the operators, but then forgets about them. To sync them it offers a method as a service for the algorithm and a notification of when a sync is necessary.

  1. Remove storing the operators in the problem and keep only the evaluator and solution creator.
  2. Change the Operators property to discover and wire the operators with each call to its get accessor.
  3. Create a RewireOperators event that the problem fires whenever it would need to rewire the operators collection
  4. Use the OperatorsChanged event such that the problem fires whenever there would be a change to the discovery of operators.
  5. Have the algorithm call the problem's new RewireOperators(IList<IOperator>) method upon receiving the event giving it the list of operators that the algorithm is currently holding.
  6. Have the algorithm call the problem's Operators property to get a fresh list of operators whenever the problem fires the OperatorsChanged event.

That way the operators need to be stored on the algorithm side and the algorithm can throw out anything it does not need and thus saves memory and disk space.

We could even go one step further and not discover the operators in the problem, but in the algorithm (since the algorithm knows which operators it needs: e.g. all ICrossover operators) and then hand them to the problem for wiring service. Only the analyzers would need to be obtained from the problem. On the other hand, the problem would need to indicate or weed out all operators that do not fit.

Change History (1)

comment:1 Changed 19 months ago by gkronber

  • Milestone changed from HeuristicLab 3.4.x Backlog to HeuristicLab 4.0.x Backlog
Note: See TracTickets for help on using tickets.