From: Edwin P. <ed...@pe...> - 2008-05-19 07:19:51
|
On Sunday 18 May 2008 15:59:30 David Rooke wrote: > Also, will CILib bark if, in my custom OptimizationProblem, I leave the > dataset empty? As I plan to implement this, my fitness function will > understand the data domain and feedback to the algorithm based on it's > search of the parameter space. The way CILib seems to be written it expects > the user to pass the test data into it. Hi David, You do not need to pass your test data to CILib. The framework will pass candidate solutions to net.sourceforge.cilib.problem.OptimisationProblem.getFitness(), wherein you are responsible for calculating the Fitness in whatever way is most appropriate for your problem. Thus, only your OptimisationProblem specialisation need have access to your dataset and know how to measure the candidate solution against your data. As far as the search space is concerned, the framework will determine the domain by calling the OptimisationProblem.getDomain() method, wherein you must construct an appropriate DomainRegistry that describes your problem space. The DomainParser can be used to convert a string description of your search space (as described by Gary in a previous email) into an appropriate built repsentation (ie. a net.sourcefoge.cilib.type.types.Type representation). Refer to net.sourceforge.cilib.functions.Function for an example of this. Of course, there is nothing preventing you building your own Type representation either, if it's easier to map that onto your internal representation instead. Hope that helps... Gary, just thinking aloud here... I don't think the setDomain() method in Function is the most appropriate place to parse domain strings. Shouldn't this logic rather be pushed down into a specialisation of DomainRegistry, say StringBasedDomainRegistry which accepts the domain string in its constructor? Then, the domain registry interface need only expose the getBuiltRepresentation() method which is used by the framework, and Funtion can return a new StringBasedDomainRegistry instead. This would encapsulate domain building from strings more cleanly in its own class and enable people like David to define his own mapping from problems to an appropriate "built representation" more intuitively as another subclass of DomainRegistry. Regards, Edwin Peer -- #include http://www.peer.co.za/~espeer/disclaimer.html |