swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Anybody has experience with Normal distriubution of javaswarm? Tha


From: Hu, Jianjun
Subject: RE: Anybody has experience with Normal distriubution of javaswarm? Thank Paul.
Date: Mon, 17 Jun 2002 20:10:37 -0400

Thank Paul.
-------------------------------------
The following code indeed works following Paul's advice.
PMMLCG1genImpl()
 PMMLCG1genImpl(Zone aZone)
          Default constructor for Impl class
PMMLCG1genImpl(Zone aZone, int seed)

--------------------------------------
To help others, I explain my crash reason here.
My problem comes from the inappropriate usage of the constructor for the
NormDist

NormalDistImpl NormalDist1 = NormalDistImpl()           //    crash. wrong.

NormalDistImpl NormalDist1 =NormalDistImpl(Zone aZone)   //wrong again.
*** event raised for error: InvalidArgument
*** function: _i_Object_s__forward__(), file:
/src/Swarm/swarm/src/defobj/DefObject.m, line: 626
unable to find Java selector `setMean:setStdDev:' in objc:`JavaProxy'
0xa749d10 java: 0xa3bc950 hash: 21468


 PMMLCG1genImpl randomGen = new PMMLCG1genImpl(Globals.env.globalZone);
 //randomGen.setStateFromSeed(3242342);  //this function doesn't work. ,  so
wrong, seed not set
 NormalDistImpl normDist3 = new NormalDistImpl(Globals.env.globalZone,
randomGen,0,0.2);


 PMMLCG1genImpl randomGen = new
PMMLCG1genImpl(Globals.env.globalZone,32342); //ok
 NormalDistImpl normDist3 = new NormalDistImpl(Globals.env.globalZone,
randomGen,0,0.2);

We should use PMMLCG1genImpl(Zone aZone, int seed)  to set our own
generator.
rather than
PMMLCG1genImpl()
 PMMLCG1genImpl(Zone aZone)
          Default constructor for Impl class





-----Original Message-----
From: address@hidden
[mailto:address@hidden Behalf Of Paul Johnson
Sent: Wednesday, July 17, 2002 5:18 PM
To: address@hidden
Subject: Re: Anybody has experience with Normal distriubution of javaswarm?


Please consult the recently enhanced guidelines on how to ask for help:

http://lark.cc.ukans.edu/~pauljohn/Swarm/SwarmFaq/SwarmOnlineFaq.html#5.1

I don't understand why this one crashes and i wonder if it is caused by
something in your computer's operating system or the particular edition
of Swarm you are using.  One can only speculate. It appears to me the
setting phase usage should be sufficient.  Are you sure
meanGAParameterMutation and stdGAPParameterMutation are doubles?

In the manual  I see;
DistImpl(Zone aZone, Object generator, double mean, double sdev)

and I think that means you could try to get all this done in the
constructor:

NormalDistImpl normDist = new
NormalDistImpl(getZone(),Globals.env.randomGenerator,
meanGAParameterMutation,stdGAParameterMutation);

This takes care of it all in one shot. I don't do a lot of Java, so my
syntax here for your Zone may not be exactly right.


I do know the Normal does work because I have a project that uses it and
my usage is this style:
   NormalDist1 = new NormalDistImpl (getZone(), newRandomGenForNormal1) ;

   holderfloat = NormalDist1.getSampleWithMean$withVariance (70, 100);

and it does work.

pj




Hu, Jianjun wrote:
> I am using the swarm-2.1.1 java version.  but now I met the following
> problem.
> The normal distribution of the swarm doesn't work!.
>
> Here is my simple code:
>
>        NormalDistImpl normDist = new NormalDistImpl();
>        normDist.setMean$setStdDev(meanGAParameterMutation,
> stdGAParameterMutation);
>
>        if ((Globals.env.uniformDblRand.getDoubleWithMin$withMax (0.0, 1.0))
>                < pGAParameterMutation){
>                double offset = normDist.getDoubleSample();    //Gaussian 
> mutations
>                pGASitDefault+= offset;
>                if(pGASitDefault<0) pGASitDefault = 0.0;
>                else if(pGASitDefault>1) pGASitDefault = 1.0;
>        }
>
> compilation is ok. but
> The runtime error is:
> unable to find Java selector `setMean:setStdDev:' in objc:`JavaProxy'
> 0xa6ae0d8 java: 0xa17cf90 hash: 18063
>
> It seems that I can't call the setMean$setStdDev function.
>
> What's wrong?
>
>
> Your help is greatly appreciated.
>
>
> Jianjun  Hu
>


--
Paul E. Johnson                       email: address@hidden
Dept. of Political Science            http://lark.cc.ku.edu/~pauljohn
University of Kansas                  Office: (785) 864-9086
Lawrence, Kansas 66045                FAX: (785) 864-5700


                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]