The explaination of the code will be attached to the end.
Here’re some questions combined:
- If we constantly switch the the ‘Run’ button in LB’s components, will it reduce the efficiency of the script. Or we should keep the value of ‘Run’ consistent to True and insert null as geometry to the LB’s component?
- How should we add a conditional statement while using the WallaceiX or other Genetic Algorithm?
Here’s the code.
We want 10 random points which are distanced to each other.
So we generate the points with Gene pools.
And a statement is added: If 2 of those points are too close, with the distance under 1.2 meters. Geometry returns null, and set the run buttons in ladybug to false
So the simulation is stopped, and Objectives receive a null value.
I tried to run for 100 iterations.
It seem if the points bumped into each other, and the null value is detected in the Objective slot. Wallacei will continue move to find the next random points combinations. But is this a method need to be optimized? or It literally is the common way to do that?
20241107_Rooftop_01.gh (300.3 KB)