From: Gary P. <gpa...@gm...> - 2009-01-08 05:11:48
|
The other option is of course to convert to a matrix first and then do the multiplication? Many ways to skin a cat :P Just let us know how we can help. Regards, Gary lab...@gm... wrote: > yes, that's true. I was just trying with an existing function. It might > be better to just do the translation from a simple vector when I need it > and leave the rest as is. I was concerned with matrix multiplication but > there is only scalar multiplication in the update equations for PSO so > the matrix representation does not matter after all. I'm trying to do a > task assignment problem and that's nice to do with matrices. > > > On Jan 7, 2009 12:15am, Gary Pampara <gpa...@gm...> wrote: >> Hi, >> >> >> >> I would actually consider writing a two new classes (one for the >> >> velocity and another for the position). >> >> >> >> The only remaining question is how the problem is defined. In the >> >> example you provided, you are using a spherical function. The function >> >> naturally does not understand matrix representations, as per the >> >> definition of the problem. >> >> >> >> Let me know if we can help in any way. >> >> >> >> Regards, >> >> Gary >> >> >> >> >> >> lab...@gm... wrote: >> >> > Yes, thanks. I think I can modify the velocityupdatestrategy program to >> >> > handle a matrix representation. It's a tradeoff between doing it like >> >> > that or translating back and forth in other places. >> >> > >> >> > On Jan 6, 2009 12:13am, Gary Pampara gpa...@gm...> wrote: >> >> >> Hi, >> >> >> >> >> >> >> >> >> >> >> >> There is absolutely nothing wrong with the XML specification. The >> >> >> >> >> >> problem is in fact with the representation and the current standard >> >> >> >> >> >> classes in CIlib. >> >> >> >> >> >> >> >> >> >> >> >> By default, the larger majority of Swarm Intelligence problems have >> >> >> >> >> >> candidate solutions that are represented by a single vector. In your >> >> >> >> >> >> XML, you have defined that the domain in which the you want the >> >> >> >> >> >> algorithm to operate in, is a space that can effectively be represented >> >> >> >> >> >> as a matrix (or multi-dimensional array). >> >> >> >> >> >> >> >> >> >> >> >> During the algorithm setup and construction, the particles that are >> >> >> >> >> >> generated do in fact have matrices as their internal representations. >> >> >> >> >> >> The problem comes in that the default Velocity and Position update >> >> >> >> >> >> equations expect Vectors and not a Vector of Vectors (which is the >> >> >> >> >> >> current manner a Matrix is built using the domain strings - this may >> >> >> >> >> >> change in the near future). >> >> >> >> >> >> >> >> >> >> >> >> There should be 3 things that need to change. >> >> >> >> >> >> - The particles need to be told that their velocity and position update >> >> >> >> >> >> equations need to be altered so that they can handle Matrix instances. >> >> >> >> >> >> - The problem needs to be aware that the candidate solution that it >> >> >> >> >> >> needs to evaluate is in fact a matrix and not a simple Vector class. >> >> >> >> >> >> >> >> >> >> >> >> Does this all make sense? >> >> >> >> >> >> >> >> >> >> >> >> Regards, >> >> >> >> >> >> Gary >> >> >> >> >> >> >> >> >> >> >> >> lab...@gm... wrote: >> >> >> >> >> >> > Sorry, I was on vacation. Happy New Year to all, BTW :-) >> >> >> >> >> >> > >> >> >> >> >> >> > Here's an xml file. Maybe I'm doing something wrong? TIA. >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > ]> >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> > maximumIterations="1000" /> >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> > domain="[R(-5.0,5.0)^5]^5"/> >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> > resolution="10" samples="1"> >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> > file="data/spherical3.gbest.p20w1.0c1_2c2_2NoVmax.txt"/> >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> >> >> >> >> > On Dec 23, 2008 6:54am, Gary Pampara gpa...@gm...> wrote: >> >> >> >> >> >> >> Continuing this discussion on the developer list. >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> Gary Pampara wrote: >> >> >> >> >> >> >> >> >> >> >> >> >> >> > Hi, >> >> >> >> >> >> >> >> >> >> >> >> >> >> > >> >> >> >> >> >> >> >> >> >> >> >> >> >> > I'll have a look at this. >> >> >> >> >> >> >> >> >> >> >> >> >> >> > >> >> >> >> >> >> >> >> >> >> >> >> >> >> > Regards, >> >> >> >> >> >> >> >> >> >> >> >> >> >> > Gary >> >> >> >> >> >> >> >> >> >> >> >> >> >> > >> >> >> >> >> >> >> >> >> >> >> >> >> >> > lab...@gm... wrote: >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> registry.setDomainString("[R(-5.0, 5.0)^10]^10"); >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> yeah, that does not work too well. I get the following error: >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> Exception in thread "main" > java.lang.UnsupportedOperationException: >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> Attempted to perform a numeric operation on non-numeric type >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> at >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> > >> >> > > net.sourceforge.cilib.type.types.container.Vector.getNumeric(Vector.java:414) >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> at >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> > >> >> > > net.sourceforge.cilib.type.types.container.Vector.getReal(Vector.java:466) >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> at >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> > >> >> > > net.sourceforge.cilib.pso.velocityupdatestrategies.StandardVelocityUpdate.updateVelocity(StandardVelocityUpdate.java:89) >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> at >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> > >> >> > > net.sourceforge.cilib.pso.particle.StandardParticle.updateVelocity(StandardParticle.java:186) >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> at >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> > >> >> > > net.sourceforge.cilib.pso.iterationstrategies.SynchronousIterationStrategy.performIteration(SynchronousIterationStrategy.java:69) >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> at >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> > >> >> > > net.sourceforge.cilib.pso.iterationstrategies.SynchronousIterationStrategy.performIteration(SynchronousIterationStrategy.java:36) >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> at net.sourceforge.cilib.pso.PSO.algorithmIteration(PSO.java:125) >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> at >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> > >> >> > > net.sourceforge.cilib.algorithm.Algorithm.performIteration(Algorithm.java:140) >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> at > net.sourceforge.cilib.algorithm.Algorithm.run(Algorithm.java:182) >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> > > ------------------------------------------------------------------------ >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> > >> >> > > ------------------------------------------------------------------------------ >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> > > ------------------------------------------------------------------------ >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> _______________________________________________ >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> Cilib-users mailing list >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> Cil...@li... >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> https://lists.sourceforge.net/lists/listinfo/cilib-users >> >> >> >> >> >> >> >> >> >> >> >> >> >> > >> >> >> >> >> >> >> >> >> >> >> >> >> >> > >> >> >> >> >> >> > >> >> > > ------------------------------------------------------------------------------ >> >> >> >> >> >> >> >> >> >> >> >> >> >> > _______________________________________________ >> >> >> >> >> >> >> >> >> >> >> >> >> >> > Cilib-users mailing list >> >> >> >> >> >> >> >> >> >> >> >> >> >> > Cil...@li... >> >> >> >> >> >> >> >> >> >> >> >> >> >> > https://lists.sourceforge.net/lists/listinfo/cilib-users >> >> >> >> >> >> >> >> >> >> >> >> > >> >> > >> >> > ------------------------------------------------------------------------ >> >> > >> >> > > ------------------------------------------------------------------------------ >> >> > Check out the new SourceForge.net Marketplace. >> >> > It is the best place to buy or sell services for >> >> > just about anything Open Source. >> >> > http://p.sf.net/sfu/Xq1LFB >> >> > >> >> > >> >> > ------------------------------------------------------------------------ >> >> > >> >> > _______________________________________________ >> >> > Cilib-users mailing list >> >> > Cil...@li... >> >> > https://lists.sourceforge.net/lists/listinfo/cilib-users >> > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------------ > Check out the new SourceForge.net Marketplace. > It is the best place to buy or sell services for > just about anything Open Source. > http://p.sf.net/sfu/Xq1LFB > > > ------------------------------------------------------------------------ > > _______________________________________________ > Cilib-users mailing list > Cil...@li... > https://lists.sourceforge.net/lists/listinfo/cilib-users |