Using ScopeIf to reduce calculation time by pulling results from previous runs (if already calculated)

Hi all

Sparked by @Michael_Kirschner2 comment on this issue:

I have a workflow that calculated the weight of a structure using Robot, this happens inside a custom node powered by a randomly created number of parameters. As I’m using a genetic algorithm I’m bound to end up having calculation that are dublicates of already completed calculation.

But as Michael mentions then “ScopeIf” could mean that I can pull the information from a .csv file and not execute that calculation. (A calculation takes around 6 minutes pr. iteration).

Does anyone have any ideas as to how to set it up, what I have so far is this test-setup:


Extra information is that the list.combine is used to test a population (a number of options, in this case 5 different possibilities) As index 2 exists in my .csv file (combination 3;3;7;7) I would like to pull the number 2000 and insert instead of the calculation being made in the custom node at this point. (these will of course be the same size in the real case and thus not run the custom node for this one/possibly many options)

Hope somebody might find this challenging and maybe even fun, here is the test-setups (if one does not want to recreate)
TestCombineScopeIf.dyf (4.1 KB)
TestCombineScopeIf.dyn (6.8 KB)

I cannot upload .csv so the content is here:
1;5;2;4;1500
3;3;7;7;2000

I didn’t get a chance to download, but I meant the OOTB scope if, not the custom node from clockwork (I think?)

1 Like

It seems that I need to research a little deeper before posting silly questions :wink:
By embedding my scope-if node into another layer of custom nodes (will end op having nodes within nodes within nodes). This is because the scopeif can only handle a single “true/false” value and thus not handle the list as I would like to.
By embedding it, it will handle the operation one at a time and not run the “final” core node if it is not needed. (I’ve tested this by having a python script writing a log-file to my desktop upon entry into the “TestCombineScopeIfCore” node.)
The picture below illustrate the solution which I will attempt to implement on my graphs.

2 Likes

I have a question. Doesn’t the calculation run in the background, even if the result is not needed?

No, that is the special thing about the scopeif :slight_smile:

2 Likes

Really interesting! Thanks for sharing.