# Optimo For Dynamo

Hello,
I am trying to do an optimization process on my model using Optimo on dynamo.
The First Iteration on loop while gives the expected result. but the second iteration returns Null. Can Anyone provides any help ?
Thank you.

Hi!

Could you add a caption of the input to the loopBody as well? The problem might be caused by that input.

Here It is.

And the workings of any custom nodes would be required too

The Custom Node itself is pretty big but it takes 4 dimensions of surfaces and returns the thickness of the surface based on the design code for concrete slabs.

The issue is most likely inside your custom node is my bet, it is not applying each iteration of your population correctly are you outputting a single value at the end? And what is the format of this value?

The Custom Node takes all the given trials and gives 1 output as Thickness which is as expected during the first iteration. I tried removing all the Math.Round nodes from the custom node to give the model all the needed freedom inside the custom node but also the same result for trial 2 which is null. the format of the output is number as it appears in the screenshot.
Thank you.

Just an Idea… Is there a certain format that should be applied to the output node inside the custom node ?? Something to be written in the Output node ?

You should output doubles and not integers… And you should also use a list.combine to apply multiple inputs inside a intermediate custom node

Okay thank you but the problem is the same.
Can I ask How to define constraints on the variables of the Custom node or the randomized GA list?
Maybe the problem will be solved if I was able to filter the inputs of the custom nodes

It is very difficult to help when you are not showing your attempts, the inputs are constrained as you are defining the constraints on your initial population?

I don’t understand the phrase ‘‘filter the inputs of the custom node’’

First I must thank you so much for your help. Second What I am trying to say is I want the inputs or the iterations be a pair of numbers their sum is equal to a certain number… for example… If this number is 16 then I want all of my inputs to be pairs of number their summation is equal to 16. this is what I mean be filter the randomized numbers. I am sorry if I wasn’t clear… the question is after defining the upper and lower limits for my variables… is there a way to define another constraints like the sum of pairs is equal to 16 ?

Hmm sounds like you want to predefine some constraints and possibly rethink the use of the population so that it can evolve each generation…
I do not know if there is a direct way, but a little math could possibly do the trick