Grasshopper

algorithmic modeling for Rhino

I would like to learn how top optimize in python instead of galapagos. My goal is to have a list of numbers that represent the parameters and a result that represents the fitness. However instead of galapagos which randomly changes every slider at once I would like to iterate through the numbers one at a time and sequentially. so for instance say I have a list of 100 numbers and some numeric result that has the same tree structure. how would i say. starting at 1.0, move the first number in the parameter list, by .1 until the fitness goal of 20 is reached . if it goes beyond the fitness goal of 20 revert to the last closest number , then move on to the next number in the list and use the next fitness number in the fitness list as a goal? any help is SUPER appreciated thanks

Views: 1621

Replies to This Discussion

Although this is probably too late to help the original poster, I have also been working with a problem that requires a looping genetic algorithm and can share my research on the subject.

First of all, it is a challenge to import external libraries into the GH Python environment mostly because IronPython doesn't have a particularly broad support base.  You can try installing numpy and scipy (see here: https://stevebaer.wordpress.com/2011/06/27/numpy-and-scipy-in-rhino...) and maybe you'll have more luck than I did.  Another possibility is pyevolve.

However the solution that ended up working for me was to write my own genetic algorithm directly within the python component.  It's actually not so difficult, and you can find a solid base to work from here:

http://lethain.com/genetic-algorithms-cool-name-damn-simple/

Good luck!

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service