From: Gary P. <gpa...@gm...> - 2008-11-12 15:41:39
|
Ah, ok :) Well, all PopulationBasedAlgorithms (like the PSO) are initialized with a PopulationInitialisationStrategy. I would suggest extending this class and then implement the initialise() method to achieve the desired effect. I unfortunately am not near my development machine, but from memory the implementation should look similar to: public void initialise(Topology<? extends Entity> topology, OptimisationProblem problem) { if (problem == null) throw new InitialisationException("No problem specified!"); for (int i = 0; i < getEntityNumber(); i++) { Entity particle = new StandardParicle(); particle.initialise(problem); // Do the needed modifications to the particle position // _and_ to it's personal best. The fitness value will be calculated // during algorithm iteration. // Add the particle to the topology topology.add(particle); } } You will need to add the required code to initialize the particle positions to near that point you mentioned. The XML file defining the PSO then (if you are using the XML file) needs to include something like: <initialistaionStrategy class="algorithm.initialistaion.YourNewClass" /> in the Algorithm definition. Regards, Gary lab...@gm... wrote: > Sorry, I forgot to mention I want to use the PSO algorithm and > initialize the swarm myself around some solution. I was looking at > DataSetBuilder but I am not sure what its purpose is. > If there was an example, that would be great. Thanks, > > > On Nov 12, 2008 10:16am, Gary Pampara <gpa...@gm...> wrote: > > Hi, > > > > > > > > I'm not exactly sure what you mean by initialize a set of solutions. > > > > > > > > CIlib is divided into 3 main parts: (1) Algorithm, (2) Problem and > (3) measurements. The other frameworks are not import > > > > > > > > The Algorithm is responsible for initialization and solution > refinement, whereas the Problem itself does nothing more than provide > the needed information about what the algorithm should be optimizing. > Naturally the measurements are performed on the algorithm. > > > > > > > > Could you perhaps explain what algorithm you wish to use to solve > this route planning problem? > > > > > > > > As for the problem itself, you may need to implement a problem and > extend either the OptimisationProblem interface or inherit directly from > the OptimisationProblemAdapter class. The Problem defines the domain in > which the algorithm will operate. > > > > > > > > Based on your code snippet, your problem will have a domain > associated with it (the problem search space) which is > "dimensions"-dimensional, which is pre-populated with Real instances > with bounds of (0, 6.28). This is mostly correct. During algorithm > initialization the domain information of the problem will be used and, > in the case of PopulationBasedAlgorithms, the entities will be > initialized in that range. The data structure defined in the domain is > not the data structure that is eventually used, it is merely the > prototype that gets copied. > > > > > > > > I hope this helps. Please let me know which algorithm etc so that I > might be able to steer you in the right direction to get a solution :) > > > > > > > > Regards, > > > > Gary > > > > > > > > lab...@gm... wrote: > > > > > > Hello, > > > > > > > > What is the best way to initialize a problem with a set of solutions? > > > > It's a route planning problem to optimize the waypoints. I > implemented my problem using the OptimizationProblem interface and the I > have set the domain as such (see below) but I want to initialize the > swarm to a set of solutions. Any hints and ideas? Code will be wonderful > too. TIA > > > > > > > > public DomainRegistry getDomain() { > > > > DomainRegistry registry = new DomainRegistry(); > > > > registry.setBuiltRepresenation(new > net.sourceforge.cilib.type.types.container.Vector(dimensions, new Real > (0, 6.28))); > > > > return registry; > > > > } > > > > > > > > Sorry, I'm working against a deadline. > > > > myriam > > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > > > ------------------------------------------------------------------------- > > > > This SF.Net email is sponsored by the Moblin Your Move Developer's > challenge > > > > Build the coolest Linux based applications with Moblin SDK & win > great prizes > > > > Grand prize is a trip for two to an Open Source event anywhere in the > world > > > > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > > > _______________________________________________ > > > > Cilib-users mailing list > > > > Cil...@li... > > > > https://lists.sourceforge.net/lists/listinfo/cilib-users > > > > > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > > > ------------------------------------------------------------------------ > > _______________________________________________ > Cilib-users mailing list > Cil...@li... > https://lists.sourceforge.net/lists/listinfo/cilib-users |