algorithmic modeling for Rhino
One list has lets say 500 true false booleans and I want to find closest matches out of many of same 500 lists with different true false values. Either an x ammount of closest matches or a cut off value of x non matches. I don't even know where to begin?
wait is it as simple as similarity component lul? brb
Tags:
How do you define 'closest match'? Let's say you have two sequences {TTTFFTFT} and {TTFTFTFT}. Is the distance between these sequences 1 or 2? Ie. they differ in the third and fourth place, but I created the second sequence by swapping two adjacent elements in the first sequence.
If you accept the swapping of two adjacent elements as a single modification, then you can use the [Text Distance] component (it uses a Levenshtein distance metric). You'll have to convert your boolean lists into T and F strings first though.
If you feel that swapping two entries should weigh more heavily towards the distance, then a different approach will be needed.
EDIT: I'm talking total bollocks. The Levenshtein metric does not take swapping into account. You can just count the number of substitutions this way.
Similarity will not help you, it compares two numbers only. You can make it work by multiplying each boolean value with a prime number, and then adding all results together. That way you can compare numbers that are guaranteed not multiples of each other.
However I suggest using Text Distance.
Welcome to
Grasshopper
© 2025 Created by Scott Davidson.
Powered by