Conditional statement With WallaceiX

The explaination of the code will be attached to the end.

Here’re some questions combined:

  1. 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?
  2. 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)

You should keep the ladybug operations to constant run, when a new solution is generated by Wallacei, the ladybug operations will be triggered and will perform the calculation for the new geometry/solution.
Having a conditional statement is something you need to do before Wallacei, you should do it grasshopper either with a stream filter or other scripting methods such as C#