Grasshopper

algorithmic modeling for Rhino

I posted this on a different thread and got some feedback from David Rutten:

"I do plan to add other solvers to Galapagos for GH2, uphill and binary searchers amongst them. These would be good alternatives for low-dimensional, or highly continuous problems. Having a somewhat faster way to trigger a galapagos run would also be beneficial."

I found a post on the 'hoopsnake/forum' describing the very same problem I am trying to solve, and looked into using HoopSnake (without satisfaction so far):

Double loop and hydrostatics?

I don't want to wait until G2 so will re-state some of what I posted earlier, then offer a template for an ideal "fast solver" component ('B-Solve') that could be widely useful.  I am ready to accept that it might be written in Python, C, or VB - as long as it's open source or built in to standard GH.  If there is a GH plugin that will do this, I'd like to know that too, though prefer a lightweight solution rather than a big toolbox.

QUESTION: Is there a FAST (binary search speed) GH way to "solve" toward a goal by "moving" a single slider?


CONTEXT:
I have a boat hull of a given displacement at rest. I rotate the hull to an arbitrary angle ("heel" caused by wind in the sails) and want to adjust a 'Z-offset' slider so the displacement is the same as it was at rest.

I can adjust the slider manually, zooming in for better control, and with a dozen tries or so, in a very short time, narrow in with a binary search method and get very close to matching the value.

When I hook up Galapagos, it runs on and on forever, trying values that are "obviously" further away instead of closer to the goal.  When I can solve it manually faster than Galapagos, a different solution is needed.

OBJECTIVE:

I want a FAST solution that doesn't need any manual input. Ideally, it would respond like any other component and re-calc whenever its inputs changed. At worst, a 'start/reset' trigger, "soft input" so it can be used inside a cluster.

It doesn't need to control a slider, they just happen to be handy for defining a range and precision of values.

Using Galapagos: HydroSolve_2015_Sep8a.gh (attached)

An extremely stripped down version of the problem using Grasshopper.

NOTE: One obvious problem here is that by using absolute value ('abs()') for the 'difference' here, Galapagos doesn't know whether it's too high or too low!

Instructions:

  1. Start with 'Roll=0', 'Volume=1543.943'
  2. Adjust 'Roll' to ~35 degrees
  3. "Solve" 'Z-offset' value to return to 'target' (original) volume of 1543.943

Using 'B-Solve': HydroSolve_2015_Sep8b.gh (attached)

'B-Solve' is the proposed fast solver component.  Its 'solution' output is always in the range of zero to one, which is remapped by the green group as -5 to 5 and used as the 'Z-offset' for 'Pitch-Roll-Z'.

Starting value ('Reset') for 'solution' is 0.5, and 'B-Solve' tries different 'solution' values to make 'result' (the 'Volume') and 'goal' match.  An efficient uphill(?) or binary searcher could be very fast.

Does this sound feasible?  Can anyone implement 'B-Solve'?

Two at once?

The post noted earlier, Double loop and hydrostatics?, brings up a complication that's worth considering from the start...  Depending on hull shape, the center of buoyancy may move fore and aft, away from the center of gravity, as the hull rolls.  This induces a change in pitch so a second 'B-Solve' component could be used in the same model to adjust pitch, which of course changes 'Volume' again...  Not quite sure how the two would get along?

Thanks.

Note: the hull in these examples is a really poor shape!

Views: 454

Attachments:

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service