Nabble removed Mailing-list integration from the Forum.
This killed the Forum. This is now an ARCHIVE.
It is likely Nabble will shutdown in the future.

So basically the Forum is now out of date, we are looking into migrating the history.

OpenSCAD support is now provided by the Mailing List.
See the first pinned post here for instructions on subscribing to the mailing list.

Challenge

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Challenge

GregL
Back in the 60's, as a young engineer, I played with Optimisation using Hill Climbing.  I had a robust hill climbing program, written in Fortran, and a weird curved hill function to test it on.
Over the years the program has been translated into Delphi and Prolog for searching in N dimensions
It is now time to shoe-horn it into OpenScad!!!
THE CHALLENGE
I have mislaid my old test function, so have created a flying saucer shape to test my routine as it is built.  The shape is a bit too simple for my liking – can you come up with a bigger challenge?
N=2 is fine!
//-----------------------------------------------------------------------------------------------------
// UFO for hill climbing test
R=10;       // radius of dome
A=80;       // angle of cone from vertical
// cone continues to infinity, but our UFO goes to disc radius D
D=50;
// height of cone H = (D-R)/tan(A);
H = (D-R)/tan(A);
$fn=100;
sphere(r=R);
translate([0,0,-H])cylinder(r1=D,r2=R,h=H);
//--------------------------------------------------------------------
// function to calculate the Z for X,Y of UFO
function ZZ(X,Y)
=   let(XY=sqrt(X*X+Y*Y))
    XY<R ? sqrt(R*R-XY*XY)          // on dome
         : (R - XY)/tan(A);                     // on disc
// test the function on our UFO
for (t= [0:36])translate([t,t,ZZ(t,t)])color("hotpink")sphere(r=0.4);
translate([R,0,ZZ(R,0)])color("hotpink")sphere(r=1);

Sent from the OpenSCAD mailing list archive at Nabble.com.

_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Challenge

adrianv
What sort of hill climbing algorithm are you talking about?  (The term "hill climbing" appears to be very vague, apparently referring to any algorithm that tries to maximize by going "up" at each step...or maybe even not that if you count "stochastic hill climbing".)  

My challenge function for a maximization algorithm that doesn't use 2nd order approximation:

f = function(x,y) 100-(x*x+y*y/50);

starting your optimization on the x or y axis is cheating.  (You can rotate the function to a random angle so that you can't find the "easy" starting points if you must.)  How many iterations to get 6 digits of accuracy?

GregL wrote
Back in the 60's, as a young engineer, I played with Optimisation using Hill
Climbing.  I had a robust hill climbing program, written in Fortran, and a
weird curved hill function to test it on.
Over the years the program has been translated into Delphi and Prolog for
searching in N dimensions
It is now time to shoe-horn it into OpenScad!!!
THE CHALLENGE
I have mislaid my old test function, so have created a flying saucer shape
to test my routine as it is built.  The shape is a bit too simple for my
liking – can you come up with a bigger challenge?
N=2 is fine!
//-----------------------------------------------------------------------------------------------------
// UFO for hill climbing test
R=10;       // radius of dome
A=80;       // angle of cone from vertical
// cone continues to infinity, but our UFO goes to disc radius D
D=50;
// height of cone H = (D-R)/tan(A);
H = (D-R)/tan(A);
$fn=100;
sphere(r=R);
translate([0,0,-H])cylinder(r1=D,r2=R,h=H);
//--------------------------------------------------------------------
// function to calculate the Z for X,Y of UFO
function ZZ(X,Y)
=   let(XY=sqrt(X*X+Y*Y))
    XY<R ? sqrt(R*R-XY*XY)          // on dome
         : (R - XY)/tan(A);                     // on disc
// test the function on our UFO
for (t= [0:36])translate([t,t,ZZ(t,t)])color("hotpink")sphere(r=0.4);
translate([R,0,ZZ(R,0)])color("hotpink")sphere(r=1);



--
Sent from: http://forum.openscad.org/
_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to <email>discuss-leave@.openscad


Sent from the OpenSCAD mailing list archive at Nabble.com.

_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Challenge

cbernhardt
adrianv wrote
GregL wrote
> I have mislaid my old test function, so have created a flying saucer shape
> to test my routine as it is built.  The shape is a bit too simple for my
> liking – can you come up with a bigger challenge?
Romulan Battle Bagel??



Sent from the OpenSCAD mailing list archive at Nabble.com.

_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Challenge

Gene Heskett
On Friday 21 May 2021 20:19:42 cbernhardt wrote:

> adrianv wrote
>
> > GregL wrote
> >
> >> I have mislaid my old test function, so have created a flying
> >> saucer shape
> >> to test my routine as it is built.  The shape is a bit too simple
> >> for my liking – can you come up with a bigger challenge?
>
> Romulan Battle Bagel??
> <http://forum.openscad.org/file/t1309/rombb.jpg>
>
>
Chuckle, but needs more phaser ports?
>
>
> --
> Sent from: http://forum.openscad.org/


Cheers, Gene Heskett
--
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
If we desire respect for the law, we must first make the law respectable.
 - Louis D. Brandeis
Genes Web page <http://geneslinuxbox.net:6309/gene>
_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Challenge

cbernhardt
Gene Heskett wrote
Chuckle, but needs more phaser ports?


Sent from the OpenSCAD mailing list archive at Nabble.com.

_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Challenge

Gene Heskett
On Saturday 22 May 2021 07:59:53 cbernhardt wrote:

> Gene Heskett wrote
>
> > Chuckle, but needs more phaser ports?
>
> <http://forum.openscad.org/file/t1309/rombb3.jpg>
>
Thats more like it. ;-)
>
>
> --
> Sent from: http://forum.openscad.org/


Cheers, Gene Heskett
--
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
If we desire respect for the law, we must first make the law respectable.
 - Louis D. Brandeis
Genes Web page <http://geneslinuxbox.net:6309/gene>
_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Challenge

GregL
In reply to this post by adrianv
Thanks for that suggestion adrianv; it is simpler than I would like.
I have since located (and identified) the missing test hill.
https://en.wikipedia.org/wiki/Rosenbrock_function
The missing hill climbing challenge was
AA=10;
BB=4;
function Func(X,Y)
=   let(XMY=X-Y, XPY=X+Y, XMY2=XMY*XMY, TERM1=XMY2 - BB*XPY, TERM2=1 - BB*XMY)
    1 - AA*TERM1*TERM1 - TERM2*TERM2;

Here are the contours for 10, 20, 50, 100, 200, 500, 1000


The hill-climbing algorithm is the Simplex method of Nelder and Meade
https://en.wikipedia.org/wiki/Nelder%E2%80%93Mead_method
I now have tested the routine, successfully, on the Flying saucer and the Rosenbrock Banana function
Reply | Threaded
Open this post in threaded view
|

Re: Challenge

MichaelAtOz
Administrator
Greg, please read the first pinned post, posts here will not generally get seen.
You may want to post the above mesage as an email to the Mailing-list.
OpenSCAD Admin - email* me if you need anything, or if I've done something stupid...
* on the Forum, click on my MichaelAtOz label, there is a link to email me.

Unless specifically shown otherwise above, my contribution is in the Public Domain;
to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work.
Obviously inclusion of works of previous authors is not included in the above.