Hi,
I want to create a random numbered list of 3 items valued between 0 and 24.
And I need these numbers all to be different from each other.
I couldn’t create logic (also the condition) and I need your thoughts on this.

Jonathan thanks for the answer but I cannot use shuffle as an (integer) input for Refinery.

I’m trying to minimize the material cost between 3 cuboids and while minimizing the value those 2 cuboids uses the same point in order to minimize the distance. That’s why I’m trying to attain them to different points.

Ok I get the shuffled list and set amount to 3 to pull the first selected 3 numbers. But how Refinery will create different population if it’s input is a static number as it’s 3. When it’s “sequence random numbers”,refinery is able to try between other seeds.
I’m sorry if I didn’t understand you

Any ‘random’ value or shuffle method will not reproduce when you go to take the day out of Refinery, and will throw off the entire optimization run. As such you won’t be able to optimize anything. Instead build the list of values, or work with list permutations or other data method which will get a consistent value.

Knowing it’s also just three numbers and there is a small range, three number sliders from 0-24 is likely your best bet. Add in some logic that asks “if number 2 == number 1, divide by 2 and round up” and then “if number 3 is equal to number 1 divide by 3 round up, then check if number 3 equals number 2 and divide and round again if so.”

I may be able to help guide you more if you provide more data on what it is you are using the numbers for, showing the relevant parts of the graph and what they are controlling in the end.

The reason I randomize the location is to make Refinery find alternative placements and tell me which suit better due to the rules I defined by the Conditional. At least I hoped so. If cubes are in the right place it won’t have a color. Otherwise, they will be red and I’ll choose the right option amongst them. That’s my plan but it sure is not an optimization path. How can I improve it?

Your screen capture lacks any detail for me to weigh in on your current solution. Try using a workspace export after zooming into one node so it’s completely visible instead.

Generally speaking, there are many options besides random. I usually recommend utilizing number sliders and some post slider logic to shift any duplicate values (do them one at a time). List permutations also work, but can make optimization difficult for Refinery.

It also helps to have something static to compare to - that is find the optimum for your first piece, or hard code a common sense placement for it, then use Refinery to locate pieces 2 to N after that. Otherwise refinery will often shift piece 1 and maintain the relationship for pieces 2 to N the same distance.

How can I put a system where the cuboids start to place themselves other than this method? You are right that random placement will not remember the seed next time I open the graph.

Hi @JJUlkins , I think @Jonathan.Olesen’s solution will work but replace List.Shuffle with Manage.RandomiseOrder node (Lunchbox package) so you can still have the “seed” as an input slider which can be run in Refinery. Had the same issue yesterday

Personally I don’t use a random method at all. Such techniques will cause Refinery to be unable to optimization as there is no correlation between seed 1 and seed 2.

Instead use number sliders to shift the distances and directions rather than building a list of all possible points, then move objects from the origin.

Alternatively you can look into list permutations which at least maintain some similarities between permutation 1 and 2. Eventually these do fall off a cliff with no correlation at permutation (n-x)!. As a result this method may not always find a global optimum, but you generally finds a local optimum or two in most decent runs. Limiting your lists to 12 items or less certainly helps in that front.

Note that in either case of list alteration (random or permutations) you are exploring contents in factorial design space, so the numbers will rapidly eclipse the limit of integer sliders in Dynamo (happens in design spaces as small as 13 items long), but with some creative python work you can circumvent that limit.

@JacobSmall thanks!! I actually chose to use number sliders for my main functioning graph in order to use in Refinery. I haven’t discovered permutations yet, but I’m on it
For now, I’ll accept @archjahzzy’s solution as it solves my problem at the mock-up model. But I’ll try to see how can I use the permutation to create a set of rules between my cuboids to find their places at the main model. I’d appreciate if you know and can share an example topic at the forum. I’d like to analyze the graph.