Grasshopper

algorithmic modeling for Rhino

# Reach a variable number with the sum of fixed numbers

Hello guys

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
and
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

E.G.

X=98

The wrong solution is like = 1pcs of 18
= 9pcs of 9

Sum of pieces are 10

OR

= 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 ?

Thank you

Views: 1314

Attachments:

### Replies to This Discussion

yes exactly

hacking services

WHO needs money??
need travel VISA??
PAYPAL AND BANK TRANSFER AVAILABLE
flight ticket available all destinations
ATM clone cards ready to ship all country
western union services back in the game
online shopping, ask me how it works
original FAKE or REAL id, dl, pp, skul docs available for all countries.

CONTACT ME NOW AT

watsap @0014242429194
icq @745215892
inbox @cleanhackdeals at gmail dot com

NB: dont waste your time to contact for fb, ig or twitter hack... few serious buyers needed

by June Lee

by June Lee

• View All