From: Gary P. <gpa...@cs...> - 2008-05-19 10:45:09
|
Hi, There are several reasons why we decided to add the getClone(). Incidentally the Clonable interface in CIlib extends java.util.Cloneable. I need to check my notes why we didn't directly use the clone() withing Java, but one of the reasons that come to mind is that an base Object is returned. This caused some issues with a few classes, lemme get the exact reason and get back to you. If I remember correctly we had problems with some of the Java generics. Edwin is correct, the manner in which the Types work is fully extensible and provides a variety of ways to get the required search space initialised. Currently there is a big drive to get some decent documentation out. I'm writing where and what I can at the moment. Should have some decent documentation out by version 0.7. It's more viable now that the framework has become more stable. David, based on the code you sent in the last email, are you compiling the code in C#? I'm not sure if that's possible as I don't know much about .net. Also, Java 1.5+ uses covariant return types so we can "overload" the return of the getClone() to make the code cleaner. Hope this helps, Gary > On Monday 19 May 2008 11:17:01 David Rooke wrote: > >> Regarding the searchspace, does CILib support irregularly shaped search >> spaces? That is, non-cuboid? This is why I have each dimension of my >> search >> domain held in a collection, so that each dimension can be of any >> length. > > Yes, this is supported. For example, the DomainParser accepts domain > descriptions of the form "T(min_1, max_1), T(min_2, max_2), ..., R(min_n, > max_n)", where T is the type and the arguments min_x and max_x correspond > to > minimum and maximums for the xth dimension of the search space > respectively. > >> Also, what is the default granularity of the search space? Is it >> configurable, if so how? > > If by granularity you are referring to the type, then yes. Z for integer, > R > for real, B for boolean, etc. The Type hierarchy is also extensible, so > you > can implement your own types if you so require. Note that there are also > types implemented for trees and graphs to represent genetic programs, etc. > >> And on inheritance, I've built the shell of my optimization problem and >> C# >> is complaining to me in a way that tells me it expects me to build 3 >> instances of the getClone method (Cloneable, Problem and >> OptimizationProblem). I'm not a coding veteran so I suspect I'm >> misinterpreting what the compiler's trying to tell me: > > Out of curiosity, what are you using to provide the glue between C# and > Java? > > I gather the getClone() method is supposed to make a deep copy of your > problem, but I have no idea why it's been done this way - that's something > new since I last looked at that particular code... > > Gary, what makes use of the getClone() method? Is there any reason why we > don't rely on > http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Cloneable.html instead? > >> public OptimisationProblem getClone() >> { >> return this.getClone; >> } > > Looks like getClone() is recursively calling itself, which is probably not > what you want to be doing... Can you post your complete code? > >> Once again, thanks for your help. The documentation is a little light so >> I >> do appreciate your assistance as I attempt to move from crawling to >> walking;) > > We'll do our best. :) Gary, we really do need to get some up to date > documentation fleshed out. In our defence though, the framework has been > somewhat of a moving target with respect to getting documentation nailed > down. > > Regards, > Edwin Peer > > -- > #include http://www.peer.co.za/~espeer/disclaimer.html > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Cilib-users mailing list > Cil...@li... > https://lists.sourceforge.net/lists/listinfo/cilib-users > |