POV-Ray : Newsgroups : povray.general : Going nuts: racetrack optimization Server Time
8 Aug 2024 08:12:01 EDT (-0400)
  Going nuts: racetrack optimization (Message 1 to 7 of 7)  
From: Greg M  Johnson
Subject: Going nuts: racetrack optimization
Date: 21 Feb 2001 08:50:13
Message: <3A93C62B.F8828CAE@my-dejanews.com>
I published scene files for a race track simulation.  I changed the code
to try an optimization of the parameters related to braking, steering,
acceleration, etc.  and ran into a problem that I do NOT understand.
Here's pseudo code:

----------------
SHORT VERSION:
-----------------
LOOP:  evaluate randomized parameters: if give desired results write to
file, if  bad try next set
OPEN file of good parameters, insert to program, find that the code now
give undesired results:  tells me I have three car crashes!

--------------------
LONG VERSION:
----------------
#declare years=0;
#while(years<1750)
1. declare my 7 PARAMETERS as random variables
2. initialize positions and velocities of actors.
3. Run a race where I count the number of crashes as per
     #if (cars get too close)
     #declare carcrash=carcrash+1;
     #end
4.  #if (carcrash<1)
     write to file my 7 parameters plus current value of carcrash
     #end
#declare years=years+1;
#end

So as you can see, I try 1750 different combinations of variables and
store the ones with zero crashes to a file. Then I open the file to read
the combinations of parameters that give zero crashes. I then paste one
of these data sets back into the car race file (replacing step 1
above).  I run the simulation (effectively trying the perfect conditions
1750 times if I were to let it run all day.)  I GET CRASHES!

Going nuts.


Post a reply to this message

From: Greg M  Johnson
Subject: chaos theory?
Date: 21 Feb 2001 13:11:22
Message: <3A94036A.6F6D042B@my-dejanews.com>
My algo has tens of thousands of vlength, trace, and Reorient operations.

Is it possible that the values one gets for any of these depends on what the
computer has done before, say like at the 12th decimal?


Post a reply to this message

From: Warp
Subject: Re: chaos theory?
Date: 21 Feb 2001 14:20:11
Message: <3a9414eb@news.povray.org>
Greg M. Johnson <gre### [at] my-dejanewscom> wrote:
: Is it possible that the values one gets for any of these depends on what the
: computer has done before, say like at the 12th decimal?

  Not probably. It should be impossible to create a non-initialized variable
in povray.

-- 
char*i="b[7FK@`3NB6>B:b3O6>:B:b3O6><`3:;8:6f733:>::b?7B>:>^B>C73;S1";
main(_,c,m){for(m=32;c=*i++-49;c&m?puts(""):m)for(_=(
c/4)&7;putchar(m),_--?m:(_=(1<<(c&3))-1,(m^=3)&3););}    /*- Warp -*/


Post a reply to this message

From: Greg M  Johnson
Subject: Re: chaos theory?
Date: 21 Feb 2001 14:29:54
Message: <3A9415D1.F2C42F30@my-dejanews.com>
Warp wrote:

>   Not probably. It should be impossible to create a non-initialized variable
> in povray.

Okay.  I'm working on finding some conditions where someone could repeat my
problem with 10 minutes of work (as opposed to the current 8 hours), then will
*beg* for help...


Post a reply to this message

From: Fabien Mosen
Subject: Re: chaos theory?
Date: 22 Feb 2001 15:18:55
Message: <3A9573B9.E500C711@skynet.be>
"Greg M. Johnson" wrote:
> 
> My algo has tens of thousands of vlength, trace, and Reorient operations.
> 
> Is it possible that the values one gets for any of these depends on what the
> computer has done before, say like at the 12th decimal?

Well, at least, from your description, you are creating the 2 conditions
of a chaotic system :
 - sensibility to initial values
 - iterative system

Think of the simplistic Lorenz system of 3 equations, it falls
so quickly into chaotic behaviour...

To check for a chaotic property of your system, you might want to
try to draw the phase diagram of some parts of your system.

Fabien.


Post a reply to this message

From:
Subject: Re: Going nuts: racetrack optimization
Date: 22 Feb 2001 16:47:41
Message: <3a957eec.1511200@news.povray.org>
On Wed, 21 Feb 2001 08:44:11 -0500, "Greg M. Johnson"
<gre### [at] my-dejanewscom> wrote:

>I published scene files for a race track simulation.  I changed the code
>to try an optimization of the parameters related to braking, steering,
>acceleration, etc.  and ran into a problem that I do NOT understand.
>Here's pseudo code:
>
>----------------
>SHORT VERSION:
>-----------------
>LOOP:  evaluate randomized parameters: if give desired results write to
>file, if  bad try next set
>OPEN file of good parameters, insert to program, find that the code now
>give undesired results:  tells me I have three car crashes!

If you're using random numbers in the simulation you'll need to use a
repeatable sequence of random numbers. Right now you grab random
numbers beginning at the position in the sequence where you left it in
the previous simulation and thus doesn't get the same sequence when
you try the same initial variables in a later run.

Erkki


Post a reply to this message

From: Greg M  Johnson
Subject: Re: Going nuts: racetrack optimization
Date: 23 Feb 2001 09:33:21
Message: <3A967344.FB9E57EA@my-dejanews.com>
No, I had a routine at the beginning which generated random parameters--the
rest of the algorithm uses no random numbers. When the algo liked one set of
parameters, I pasted the text it wrote to a file back into the algo,
*replacing* the random number generation.  In other words I used  #write
(MyFile2,wallaccelturns,",")  and then pasted the text from this file back
into my algo.

In trying to generate a file which could enable repeating the problem with 10
minutes look, I stumbled onto some really good parameters.  Hand-typing these
back in, instead of   zero crashes until 370 frames, I now get zero crashes
until 422 frames.

Perhaps Fabien is right--there is extreme sensitivity to inital conditions
(or really here, the rules of operation at several decimal points out.).
When I hand typed "most" of the digits for the parameters my algo *really*
liked, I cut off some digits and things got a tiny bit better.  When I pasted
the complete text for parameters my algo *sort of* liked, it is possible that
the #write-ing lost some precision and thus turned my OK-parameters into
crash-prone parameters.

It was chaotic, man.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.