algorithmic modeling for Rhino
I would like to aks your help, I'd like to make a grasshopper program which helps to solve my problem, i don't know python/C#/VB coding that's why I ask your help.
The problem is the following (It's a bit similar to the Knapsack problem):
I have a Variable --> X
I Have fix numbers (can we call "pieces") 9,12,15,18
I'd like to reach the X, with the summing of these numbers and using the minimum pieces ,it can't be lower than X, but it can be higher, maximum with 3.
After this it has to found the most optimal combination which mostly use the same pieces
The wrong solution is like = 1pcs of 18
= 9pcs of 9
Sum of pieces are 10
= 3pcs of 18
= 1pcs of 15
= 1pcs of 12
= 2pcs of 9
Sum of pieces are 7
The right solution in this case = 5pcs of 18
= 1pcs of 9
(5*18)+(1*9)=99 it's good beacuse it's over with maximum 3 and uses the minimum pieces
Then it sends to a list like
18 : 5pcs
15 : 0pcs
12 : 0pcs
9 : 1pcs
Can somebody help me ? Or is it possible to make this ?