Solving Inequalities

Hi All,
I am trying to write an optimization algorithm where,
I have set of inequality equations (4 equations) that I want to solve using Grasshopper.
Each equation represents a set of possible solutions. On solving all the equations I should get a region (band) as shown below.

Is it possible to solve it using Grasshopper tools or plugins so that later I can update the geometry based on the results obtained.

I hope my question is clear.
Please help me find the tools to resolve the above-mentioned issue.

Thanks

To be honest I have no idea what I am looking at mathematically but you obviously do.
This may seem like a silly question but have you looked at the math tab in GH?

4e-2 is the bottom “range vector or angle?” (sorry I don’t know math terms) of -kt?
4e-4 is the top “range vector or angle?”

same for 4e-1 and 4e-3 in relation to kb

so you are trying to evaluate if your input falls within the overlap zone between the two range vectors is that correct?

I have a feeling the components you need are in that location:

1 Like

let me check that
Thanks for the help.

1 Like

Without knowing the exact problem, it is a little difficult to develop a solution. Can you tell us more about the problem? Grasshopper has two built-in solvers, Galapagos and Kangaroo2, with which optimisations can be realised. There are also other plugins with optimisation solvers on food4rhino.com. In principle, an optimisation algorithm always has a single target value to be achieved at the end. This target value can in turn be composed of several individual target values (e.g. formula results) that are weighted against each other, such as the strength input in the Kangaroo2 components, which tells the solver how important a particular optimisation target is. For the individual goals, one can then specify a range within which the results should lie in any case. For this, however, one must know the accepted range.

I created this cluster long ago to solve the problem; the ‘T’ (Tolerance,) input is key. Default is 0.0001

isEqual_2023_Aug10a

isEqual_2023_Aug10a2

P.S. The “OLD” component is Subtraction, the expression on the Smaller ‘A’ input is “abs(x)” (Absolute Value).

I would use Mathematica, or other symbol-solving system.

Hi,
Thanks for showing interest in my query.

I have the following inequality equation at a location along the geometry. The 1/Po (inverse of force) and e(eccentricity) are the variables. The values of the M will be combing from an excel sheet (linked to the analysis software). Four such equations will give me a region as shown in the original query.

image

I want to initially assume the value of e to get the minimum value of Po. Now this P0 will be fixed.
Now for the assumed value of e , there will be new M values (from the analysis software due to update in the geometry) so I have to perform the iterations to update the P0 values

This needs to be done at the several places along the geometry.

I hope this makes sense.
Please let me know if something like that can be done in grasshopper.

Yes, that is actually a good option do such problems. I am also trying to do this using python.
But I want to immediately reflect the changes on the geometry based on the iterations done. The geometric control can be achieved better in Grasshopper and it is linked to my analysis software.
Thanks for the help.

Hi,
Thanks for reaching out to me.
I am not sure what ouput this is going to give.
Can you kindly attach a working module so that I can check this out.

What is your expected output ?
Your inequalities are linear in e so it should be possible to draw four lines, and use them to split a plane surface to get the central band. However this will be a geometric output, not a numerical one.
How do you then “choose” 1/P0 among all possible answers ?

I want a range of 1/Po for assumed value of e. Then I want to take the maxima of that range to get required unique value. This is the 1st exercise to fix my Po values at the critical locations along the geometry.
Once my Po is fixed I will use it to get the range of e at the other noncritical locations along the geometry and take the maxima or minima of the range to arrive at the required solution for e.

I hope this makes sense. Thanks

This is still quite cryptic, but here is a start.
1/ Build the 4 lines from computing a and b parameters (assuming 1/P0 = a*e+b). I used random values for testing.
2/ Split a huge surface by those lines
3/ Retrieve the correct piece. I believe this is the only 4-sided surface that touches exactly all four lines, but no external edge. There may be cases where this doesn’t work though
4/ Intersect this region with a plane at the correct x=e abscissa, and retrieve the corresponding Y = 1/P0 domain.

What I don’t get is that you have 4 inequalities that are similar, only differing by coefficients, yet some values of 1/P0 are allowed to be above or below the equality line…

Inequality.gh (18.9 KB)

2 Likes

this^


Imho, you should explain it all again, but properly.

The explanation you gave us with this picture:

is sort of (a lot) different from the first picture:

From the first picture + description I would intersect those 4 functions and evaluate only the highest or lowest intersection point. That’s it.
But from your second picture it feels a lot of informations are missing.

1 Like

Providing a FULL example of the plotting/solving process you would do by hand (on a single iteration/geometrical case) would be helpful indeed.

Thank you for your explanations. The problem from my point of view is that you do not provide a target value for your optimisation only with the evaluation of your four formulas. But this is an essential part of an optimisation. Otherwise, there is no way to determine the parameter values for the next iteration. Checking whether your two input parameters in the four formulas lead to the desired inequality is insufficient for an optimisation. If you only want to check a parameter set for compliance with your formulae, you don’t need Grasshopper for this. Since that is only a formula evaluation that gives you four true or false results you can do that in Excel.

This is great.
Let me create something like this with the actual values and get back to you.
Thanks for the help.

This sounds like a perfect job for a machine learning model to evaluate the best solution among a range of values.

Sorry for being too vague, let me start again explaining you the entire scenario,

I am trying to achieve the best possible profile for a prestressing tendons (steel cables) passing along axis of a bridge.
The following is my bridge geometry,

The following is the tendon profile along the above geometry

I wish to optimize the tendon profile so that the economy can be achieved.
For that I need to analyse the structure in sofistik and get the results (Msw and MT) from the analysis as input for the optimization algorithm.
There are four linear equations with variables 1/Po (prestressing force) and e (eccentricity of the tendon from CG of the cross section). The kt, kb,Zb, A and sigma are known constants)
Equation1:
image
image

Equation2:
image
image

Equation3:

image

image

Equation4:
image
image

Resultant region:

image

  1. My first step would be to fix the prestressing Force (Po) (as this should remain constant throughout the cable) based on the control points at critical locations. For that I will consider the maximum allowable eccentricity based on the geometry of the section and find out the minimum value of Po (this will help me decide the no. of steel strands required).
  2. Once Po value is fixed for a tendon I will consider that to calculate the eccentricity at the non critical location along the span.
  3. Now I need to iterate this because with the change in the value of e and Po the value of MT changes

Hope this is some what clear now.

Thanks

1 Like

Knowing there are actually four equations with two giving a lower bound and two an upper bound makes it infinitely more clear !
You could make the surface selection more robust using Curve Side component.

If I understand correctly you want the rightmost point of the acceptable area (max e and lowest P0), Bounding Box should give you access to that.

Then the iterative process is calling for Anemone plugin, or code.

One problem at a time, though. Start by drawing your four lines given a set of parameters :smiley:

1 Like

Thanks for the help.
I went through your program to understand the logic to get the interest region.
I am new to the Grasshopper and did not understand the part where you some how identified the interest region (by comparing the list length). Can you pls explain me the logic behind it?