# Is there a way to make Galapagos work with Domains instead of sliders?

Alternative to this:

Is it possible to make Galapagos set random values coming from domains instead of number sliders?

I need slider maximum and minimum value to be variable depending on other slidersâ€™ values

Hence the other thread, I need slider with two inputs for min and max

Weâ€™ve discussed this concept with @DavidRutten, but I donâ€™t think we reached a conclusion of what is feasible

Galapagos works strictly with integer variables. If your slider goes from 0.0 to 2.0 with three decimal places, thereâ€™s a total of 2001 unique values it can assume. Galapagos treats this slider as an integer value between 0 and 2001.

Any changes made to the slider accuracy or domain may result in a different number of discrete states and that would seriously complicate the algorithm.

Also it would mean that state 258 would map to a different numerical value than it used to, so now the model and Galapagosâ€™ understanding of the model are diverging.

1 Like

That is fine by me, because the optimization Iâ€™m trying to perform is complex.

When is Galapagos detecting (storing) the domain of each slider? At the beginning of the optimization (when you click start) or at every new generation. If it is at every new generation then I can still use it. If it is at the start then Iâ€™m better off developing my own algorithm or to look for neural networks.

Galapagos is dealing with it, and the result is not useless. Iâ€™m currently using a combination of components+python that in a way change the domain values and Galapagos is giving decent results.

I am not changing the goal, the output from the sliders is as it is, the domain is changed. Unfortunately the method Iâ€™m currently using is faulty, because I cannot directly change the domain of the slider. So changing one value inevitably changes all other slider values. All I need is to be able to change the domain, not the values.

E.g.
You have sliders 1, 2 and 3 as follows:

1. Min=0.0 max=1.0 current_value=0.5
2. Min=1.0 max=2.0 current_value=1.5
3. Min=2.0 max=3.0 current_value=2.5

If you change the domains as follows:

1. Min=-1.0 max=0.8 current_value=0.5
2. Min=0.8 max=1.6 current_value=1.5
3. Min=1.6 max=2.8 current_value=2.5

The values stay the same and the result of Galapagos is still valid, but the next generation values will be generated using different domains.

The whole optimization process will last longer, but for my problem it will assure correct result at the end, instead of Galapagos stagnating around the wrong result and ends up with messed up final optimization result

I meant the solver algorithm that I have to write. Not the GH network that users are running.

Depends a bit on what you mean by â€śGalapagosâ€ťâ€¦ the core program doesnâ€™t at any point know about sliders. It doesnâ€™t know about Rhino or Grasshopper either. Itâ€™s just a stand-alone solver. The Galapagos object in Grasshopper acts as a bridge between the two programs, converting sliders into discrete spaces, setting the correct slider values based on the discrete locii that the core solver is churning out, and sending back the fitness values.

When, at start point or at each generation before generating the new random values?

You may not need to rewrite it. I havenâ€™t tried looking into galapagos.dll with dir(), If everything is there I can try implementing it myself using python. That will save some processing time avoiding the GUI.

But if I had a slider component with two inputs for the min and max, this might as well save us both the additional coding. That is if Galapagos is getting the info from the sliders before every generation.

Once, before the solution starts.

Why not transform a slider value into a different domain, which can also be defined through sliders:

No additional coding required by anyone, and it neatly sidesteps the plurality problems that come with modifying interface elements based on a variable number of values.

This is exactly what Iâ€™m doing now using python, but if you connect the output of this one as Domain start of another (instance of this), and as Domain End for yet another one. Value change in one will change the output of all others as it is a percentage of the domains and what I want is an actual value between the domains without changing the others. I can give you an example in PM but Iâ€™ll never post this in public.

So itâ€™s just clipping values to domains, rather than mapping them into it?

I guess yes, Iâ€™m not sure I understand what you said.

take a look at the file I sent as PM.
if you move the slider it changes the output value, and changes the domain of the other component linked to it. But also its value.

I donâ€™t want that because this is causing Galapagos solution to take too long.

I want if the value changes to change the domain of the other component, without changing its value, unless the value of the second one is outside the new domain, in which case it should change the value to the closest limit(min or max) of the new domain.

I agree with @dsonntag that the results might not be very meaningful.
You might want to compare the results from Galapagos with a completely random search.
In this case, itâ€™s possible that thereâ€™s little difference.

Iâ€™ve found that the Galapagos GA is remarkably inefficient compared to other solvers (such as the Galapagos SA), and thatâ€™s BEFORE changing the search domain.

The percentage on the Y Axis indicates the mean difference to the best solution. The yellow line is the Galagos GA.

1 Like

Iâ€™m not familiar with Galapagos (GA, SA) differences.

Anyways, I am able to improve Galapagos (whatever version it is in GH) however I need variable domains of the sliders, or simply taking domains (instead of sliders) for random value generation.

In my case all sliders depend on each other, this changes their Min Max values after each generation of genomes. This helps Galapagos converge very quickly near the correct fitness.

Unfortunately due to my lack of csharp knowledge and @piac refusal to provide examples how to change GUI of components using Python. Iâ€™m stuck with FAILURE of my study.

Iâ€™m afraid Iâ€™ll have to move on using ANN or other Evolutionary Algorithms. Even though I might face the same issues there making the need of VariableDomainSlider a MUST HAVE.

Have you tried metahopper?
I know how to change the domain in C#, but I guess thatâ€™s unhelpful to you.

In any case, Iâ€™d check whether the improvement youâ€™re getting is any better than random (independent whether itâ€™s an ANN, evolutionary algorithm, or what have you.)

It is. For my case.

The SA is on the second, â€śSolversâ€ť tab.
Click the green gem stone in the top left corner.
Iâ€™d be surprised if it doesnâ€™t give better results.

Oh the annealing thing, hell no this runs for days. So far I havenâ€™t found it being useful, in case of self-depending sliders the chance of it finding a solution is minimal.

Intriguing â€¦