Optimisation using Galapagos

unhandled

(Rsalelwani) #1

Hi All,

Is there any way to save my work after the solver stopped in Galapagos?
I started run the solver and I got many generations with various optimisations. For example, I’d compare between the first optimisation in third generation with the optimisation in 25th generation, how could I do that? Any suggestions would help!

Thanks in advance!
Raed


#2

Hello,
It is not possible after you close galapagos. When it is still opened you can click on genomes in lower right corner and click: reinstate. You cannot save these solutions. If you wanted to: I once figured out a messy workaround. I posted it from different account here: https://discourse.mcneel.com/t/galapagos-save-multiple-solution-states/51436/3?u=rekoks.
As far as i remember i included instructions in gh file. Let me know if you need any help with it.


(Rsalelwani) #3

Thanks @rekoks for your respond!

By today, the optimisation Galapagos run finished, which it spent three days running, so I’m really afraid to press any button!!! Also, I saw the link that you mentioned it. Is it possible to follow the steps after stopped solver without close Galapagos? I need to show all generations because I’m doing a study research for daylight and energy for a building that has 4 directions (N,E,S,W). Now I did one direction which spent 3 days, and it might spend the same time for others!!! Any suggestions?

Regarding to the link you mentioned, I tried to use gh file in different laptop but it is only to save the work. If I wanted to reinstate other Genome, what could I do?

Thanks in advance,
Raed


#4

Hello,
Bad news first. Unfortunately, once youre done you cannot simply plug these in as it uses data recorder (records data changes that happen during galapagos run). At this point you could reinstate genomes of your choice and just write variable values down to recreate them separately from galapagos.
As for reinstating from my definition, as well as whole saving process, I post more precise instructions below.

I do not know your definition exactly, but lets say it uses 3 variables (A,B,C) and a fitness function value for each combination (F). You could plug these in order A,B,C,F to data recorder. You could also save any other value you want (as its glazing, lets say window-wall ratio or glazing type etc).

At this point you can run your definition. The part with filter values may not be needed if you need ALL GENOMES. If you are using penalty functions or are interested only in f.ex. certain A variable values you can use it. Otherwise you can plug it this way:

In next part all values are set so these line in one row in excel file. This way you can have separate columns for values you want to save. In this example - List_item_0=A; List_item_1=B, LIst_item_3=F. thats why you needed to keep in mind order of connection to data recorder. Youd have as many list item components as parameters youd like to save.
AFTER optimization is done you toggle “true” to have it saved to excel file with path of your choice.

So now you have excel file and you can modify it as you want. For example sort it so that it goes from genome with best fitness to the one with worst.
Next step is bringing this file into GH to look through the results, “reinstate”, visualize them, make graphs or whatever you come up with. It is this part of definition:


The “explode tree component” lets you get branches. In our example: Branch_0 = A, Branch_1 = B, etc.
To get all the columns from your file just right click on this component and click "match outputs. Now you need to get “list item” components that matches number of branches. you should plug everything from corresponding sliders into list items output. For example - reconnect all components from variable_A slider to list item corresponding to Branch_0. Ctrl+shift+click lets you get all the wires at once.
Now the slider connected to List item component lets you cycle through results. If you sorted your data as I mentioned before - 0 would be the best result. In this picture you’d get genome with 156th fitness value from the top.

Unfortunately you’d have to rerun your 3-day optimization, but I cant think of anything else. I know it is not elegant or convinient, but it worked for me.

PS. You could also look into colibri aggregator as i mentioned in that linked post.
Recently i experimented with daylight-based optimisations and it is pretty nice to get some graphs for fitness values and the polyline graph for genome (Like these from David Ruttens Blog https://ieatbugsforbreakfast.wordpress.com/2011/03/05/evolutionary-solver-mutations/)) together with geometry and animate the last slider - you get results (if you sorted excel file) from best to worst or other way round. This is a good way to show all genomes, as you want to.

Hope that helps,
Have a good one!


(Rsalelwani) #5

Thanks a lot @rekoks!!! I really appreciate your explain which is more helpful!!
I downloaded your gh. file, and I’m stuck in the part “filter values” ( I got this idea from you, which is choose the area that is smaller than the average of daylight illuminance and same thing with energy consumption. Please, correct me if I’m doing wrong). If you see the screenshot, you’ll figure out the problem.

yours and mine have totally different branches even thought I did copy yours and pasted but I got different, what do you thing?

I would if you could email you my file!


#6

Hello,
First of all take a closer look at second picture i posted. You can bypass filter if you want ALL genomes, you can also modify it in a way that you wouldn’t save certain results. For example “if daylight illuminance is smaller than x, do not save”. It seems that you have only one item in branch 2. Try moving the variable sliders around - that way data recorder should get more values, and thats how it would work when you run your optimization.
I pm’d you my email adress, you can send your file to me, but i do not promise I would take a look at it straight away.


(Tom) #7

Hello,

this is way too much time. You should overwork your definition and filter bottlenecks. You may check for bad algorithms, overcomplicated surface data (check properties such as control point count), furthermore improve your fitness function to filter out bad ones. „Genetic Optimisation“ is a brute force approach, and the ugly sister of any traditional algorithm. Dunno why its so hyped in gh.

Metahopper Plugin has a component to list components with excessive time consumption. Ask for workarounds, even for costly trimming operations there are workarounds.


#8

Hello,
This is interesting, please correct me if I am wrong.

How are genetic algorithms brute force? As far as I know brute force method would be an exact kind of optimization (checking all combinations, guarantees finding best answer), while genetic, anealing,particle swarm , etc algorithms are heuristic (in case of gh plugins meta-, these wouldn’t guarantee finding the right answer, but do not investigate all variable combinations). So these two are completely different things (almost opposites).

As for bottlenecks and optimization time, of course some penalty functions would probably help galapagos to find answer in less generations. I didn’t see the definition so I cannot approximate if this is fast or slow (how many variables, combinations, fitness landscape assumption?). I think bottleneck navigator wouldn’t help much here, as I bet >90% of computation time comes from mentioned illuminance/energy calculations (probably Honeybee) as geometry in such analysis is usually forced to be very simple.
When I did something similar Radiance/E+ components took about 98% of computation time of each 1,5min genome calculation (which,after lots of tests, I was very happy with). My optimization took about 8h (because i let it run for that long, didn’t use “max stagnant”. Still I am not sure if it found optimum ofc). How can you tell if it was fast or slow when you do not know how many variable combinations there are?


(Tom) #9

Sure genetic algorithms are optimised in a way that they do not blindly choose next values. However the idea behind any „try and error“ approach that there is no logic behind. Its basically trying out a combination of values and test the outcome. So you don‘t describe the process by boundary conditions, formulas or experience, instead you simply guess.

This is „brute force“ . The problem with this, is that you have very limited control on the actual design. An optimal solution in an technical sense often is not optimal under design critical aspects (and the other way around).
So often it is a matter of finding a compromise. Imagine creating million of combination, how will you filter out good solutions. A „traditional“ approach is an design process supported by the right analysis. Often its a matter of experience. If you still favor genetic optimisation, you need to filter much stronger. There nothing so important as having a good fitness function. Only using one dimension, having a good score system.

Its true, I can‘t judge about whats long or whats not. But having some years of real world experience in generative design, I strongly believe 3 days of calculation is a strong sign that something isn‘t working right. But whats weird to me, might be normal to you/your field of work. :slightly_smiling_face:


(Rsalelwani) #10

Hello All,

I have no idea spending much time but I think because of using a whole traditional shading device, which’s called Mashrabiyya. See pic. Do you think I could reduce the time? if so, how?

I would optimize this traditional device to see the optimum daylight using Honeybee/Ladybug.I do have 3 sliders, each slide has a group of blinds to control the thickness to allow daylight gets through. I assigned the 3 sliders as variables into Genomes, and the fitness is illuminance values and electric light kWh. see pic.

I have 2 objectives; increasing illuminance and decreasing energy lights. For daylight illuminance, there are 160 points, each point has illuminance value. For energy, there is 12 months, each month has amount of electricity used.

In your opinion, what is the appropriate definition or filter to get better result?

Thanks a lot,
Raed


#11

Factors potentially leading to a better result.

The only way a GA can gain “better result” is if knowing in advance what a

  1. better result is (the definition, that is. Unless accepting any attempt, or redefining/retrying until… what?)
  2. the parameters influencing that “good” result (i.e. the sliders you already picked).

What you already feed into the GA are the parameters that a filter should deal with.

The point is that if you define a “fitness” value for Galapagos to optimize, then you actually know the essense of the problem/filter. Or not.

If knowing this, then with this insight (you may use Galapagos to explore and deepen your understanding of this essential insight though) you go ahead and make a dedicated algorithm that goes “straight at it”.

What GA:s is not
One of the biggest misconceptions about GA:s out there is that GA’s would find something “new” in any non-deterministic way. That it would find some “conceptual novelty”. But this is not the case. Instead GAs is about searching for an optimum directed by a smarter brain overseeing the whole setup.

At best GA:s finds a result in a “slower way” due to not utilizing the overseer’s foreknowledge. So, due to the determinism involved, GA:s is still about optimization, because optimization is not achieved without knowing the end goal (or the criterias for a “good” result) beforehand.

All in all, a dedicated tailored algorithm going straight at it is almost always preferred in realtime processes. A typical exception case would be the immune system, due to the need for dealing also with unknown factors (or unknown “sliders”…).

// Rolf


(Rsalelwani) #12

Thank @RIL for reply!!

I think there is misunderstood by me when I said definition or filter. What I meant it that is there any way to reduce the time. For example, I want to increase daylight meanwhile decrease energy use by using artificial lighting. What I did, I took the iluminance value from simulation component and then multiplied by -1 to increase daylight (copy it from Mustapha’s tutorial, is it correct?), and I connected electricity light from energy simulation. And then, both merged together to become one objective (fitness) in Galapagos. The Genome is the variables of sliders (thickness of blinds). I’m still not sure if that’s correct way?!?!


(Tom) #13

Hello Raid,

I’m no expert regarding daylight analysis. Furthermore I’ve never worked with Honeybee/Ladybug nor I have any gh file to look at. So I’m in a bad situation to tell you how to optimise your process. However generally spoken, you could do a lot to decrease calculation time. One aspect is accuracy. Can you validate what HB/LB does? Is the calculation accurate, and if so could you decrease steps to get a sufficient accurate result? I could imagine that an error of +/- 20 % is still totally okay regarding daylight analysis. I could also imagine, that your “Mashrabiyya” could be reduced to a normal window which filters x-percent of daylight. So you don’t actually use the real geometry.
Besides all this, a GA might be a wrong approach. Why not creating 10 setups and running 10 times your daylight analysis. If you found 3 good solutions, you do 10 variations again and get the best of it. This is basically what an experienced engineer would do. Design is iterative. I doubt even the best GA setup would yield any better result, this is what Rolf points out.