I have made a setup in Grasshopper in which a Knob can be changed. At the moment, I manually adjust the Knob until I get the desired value. Now, I would like to know if i can automate this process. I want python to turn the Knob until the volume matches the desired volume.
You could use one of the optimization plug-ins in Grasshopper for this (e.g. Galapagos, Goat, Opossum), but I’m not sure that’s what you need.
It will be difficult with Python in Grasshopper because you need to “close the loop”, which is not possible in Vanilla Grasshopper. (But you could try to do this with Hopesnake, or another plug-in that allows loops.)
Or you just write this as a Python script outside of Grasshopper, with a “while” loop,
It would help if you could post the meshes here on Discourse, to provide some data to work with. Best way would be to internalise them into the mesh components (right click on each mesh component and select the Internalise Data option) and resubmit your .gh file.
As I have no additional plugins available, this option is not possible for me. Scripting is not something I exel in either. As you say, what I want is not possible in Grasshopper/phyton alone, then this is already some valuable information lt means I can try to go find otherways to solve the problem.
Do you have any suggestions on how to make galapagos find smaller values? I have a working setup now but i would like to receive more precise answers. I expected Galapagos to start iterating, and refine and refine each iteration, decreasing the range of numbers to be checked to eventually minimize to values with like 0,01 precision. If im lucky it will get to 0,1
Your suggestion is what I have done as well, I have volume A and B where I want A to equal B, So I subtracted B from A and made an absolute value of the resulting value. I told Galapagos to minimise this value, because if its zero, A equals B.
So I’ll take a look at your suggested algorithms and see if they make a difference.