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(XX+YY))
XY<R ? sqrt(RR-XYXY) // 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/
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-(xx+yy/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(XX+YY))
XY<R ? sqrt(RR-XYXY) // 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: http://forum.openscad.org/
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
--
Sent from: http://forum.openscad.org/
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/
"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.
Gene Heskett wrote
Chuckle, but needs more phaser ports?
On Saturday 22 May 2021 07:59:53 cbernhardt wrote:
Gene Heskett wrote
Chuckle, but needs more phaser ports?
Thats more like it. ;-)
--
Sent from: http://forum.openscad.org/
"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.