I would like to create a component like Galapagos using python. The idea is to create component to be able realize specific optimization. I’m not interested in the GUI part of Galapagos when you double-click. However, I’m more than interested to learn how to modify sliders and I’d like to be able to create genome and fitness input just like Galapagos .
Unfortunately, I don’t have any clue on how to do such thing. I was wondering if anyone had an idea on how to realize this ?
I wouldn’t think of it as replicating Galapagos in GHPython, but rather look into how to code genetic algorithms and evolutionary solvers. The principals of the algorithm might stay the same or at least remain similar for many tasks, but in my opinion it’s better to integrate and customise it for each individual task.
Here’s a Python example I did a while back for finding optimised solutions to the travelling salesman problem with an evolutionary approach.
It’s not perfect, but it shows at least two things:
How to structure/set up an animated GHPython component (which by the way I learned from Anders)
How to structure/set up the algorithm (populations, fitness, mutations, etc.)
Thank you @AndersDeleuran. These are really good examples ! I now see how to interact with sliders and other input sources. It’s actually easy, but I feel that finding the way to the information through the API can be sometimes quite laborious.
Hello @diff-arch,
You’re right, I may have misspoke. I use the comparison to Galapagos because the way it works is well known. I’m planning to create several components for specific optimization operation on structural design. But I didn’t know how to interact with the sliders used to make the structure vary.
That being said, thank you for sharing your work. It really is pedagogic.
Now, I’d like to look into the subject of graphics. Do you guys have an idea an how to change component color and how to create this bottom input position ?
No idea, but my guess would be that you can’t change the colour of the GHPython component, because it would change the colour for all GHPython components. @DavidRutten might be able to answer these questions for you!