Hello,
I call on your skills
You have probably already been faced with this problem.
Let me explain:
I am trying to understand the logic of creating this table to make it a sub-dynamo (a list which will serve as data) in order to place families afterwards
By choosing all possible combinations (I come up against a list of data which will become too large, I think)
I haven’t gone any further in this direction, I don’t think it’s the right method.
import sys
liste_longueurs = [0, 90, 110, 150, 180]
liste_possibilites = []
for val1 in liste_longueurs:
for val2 in liste_longueurs:
for val3 in liste_longueurs:
for val4 in liste_longueurs:
for val5 in liste_longueurs:
une_combinaison = [val1, val2, val3, val4,val5]
liste_possibilites.append(une_combinaison)
OUT = len(liste_possibilites),liste_possibilites
Do you think that there is a python module or dynamo node which searches for the number of elements according to a distance to be reached and not exceeded (I think this is the route that was used)
I don’t ask for the result of an algorithm (rather to know if my thinking is going in the right direction or there is yet another direction that I don’t perceive)
Not quite sure I understand the use case, but not sounds like you have a bunch of linear measurements, and you want to make them fit into a container to ensure the least amount of unused capacity in the containers.
If so, look into the BIM4Struct package as there is a recent update to allow finding the optimal container size for a given list of lengths and a list of containers. The actual node uses a list of curves though, so you may want to modify the Python code.
Search for packing in your library once installed.
(for the dimension of 340cm no real combination found (first on figure), I base myself from the largest module to the smallest module without being able to manage the combinations, really not easy to integrate them into a python code for a beginner)
hi, thank you, I’ll look tomorrow, I have a terrible headache (I’m going to do a covid test, I think)
you have to be very mentally fresh to tackle this big piece (for me)
This is a version of the minimum change making problem.
As the combinations are not excessive it is possible to iterate through all the possible combinations to generate the optimal solution - in this case minimum number of items
from itertools import combinations_with_replacement as cwr
lengths = [1.9, 1.6, 1.2, 1.0] # Adjust before calculating and after
total = 3.2 # Adjusted
solutions = []
for i in range(int(total / max(lengths)), int(total / min(lengths)) + 1):
for j in cwr(lengths, i):
if sum(j) == total:
solutions.append(j)
if solutions:
print(min(solutions, key=len)) # make adjustment if required
else:
print("No solutions")
hello, thank you (did you have python training during your life, or 100% self-taught?) and to all the contributors for having solved this.
A big thank-you
I’m 100% self taught, mainly started with free online university courses and e-books (Think Python is good).
Once I had the basics I worked through the HackerRank python challenges which helped understand common computer science algorithms and problem solving.
Since then, besides Revit & C3D for work, just my own projects on data viz, machine learning & API libraries like spotipy
I would try to apply and consult this book (to establish the skills base)
In this regard I think that you will appreciate the new quality article (again) by Mr. C. Poupin (Just like you on board the Python rocket heading to Pluto, like many other people) (Don’t worry Mr. Poupin , I loves b _ _ bs)
Personally I am on a bus heading to the hotel based in Kourou (or Cape Canaveral), waiting for takeoff.
I am aware that the progression curve is specific to each person even if I would like it to be exponential (my brain capacity is not unfortunately)
Thank you for your feedback,
Sincerely
christian.stan