Allocation system

  • Thread starter Thread starter NH
  • Start date Start date
N

NH

I am looking for a bit of advice and a shove in the right direction..I want
to create a system which will be able to store a list of products, and
distribute them based on rules.

I suppose the easiest way of looking at it is the following:

I have warehouse full of fruit,
I get an order for 40 bananas, 60 Oranges and 70 Apples
I have boxes which will hold 100 pieces of fruit each.

BUT there are rules: e.g.
1. A box cannot contain more than 20 bananas if it is to also contain
apples.
2. Bananas must be distributed in multiples of 5
3. A box cannot contain more than 80 oranges
4. Bananas must be packed at the top of a box
....You get the idea...

What I need is to use these rules to output a packing list. How many boxes
do I need, and how many of what do I put in each?

The code...

Would my best bet be to build a temporary table which actually resembles the
boxes, and distribute the fruit on a line by line basis i.e.
box slot fruit
1 1 apple
1 2 apple.....

Or write procedures which calculate all of this 'on the fly' resulting in
data something like:

Boxes = 2
Box1.Apples = 70
Box1.Oranges = 10
Box1.Bananas = 20
Box1.Top = Bananas
Box2.Oranges = 50
Box2.Bananas = 20
Box2.Top = Bananas

I assume this is something which is relatively well practiced, I am just not
quite sure of the best (or easiest) way of doing it... At what point am I
likely to run into headaches? Have I got completely the wrong idea?

Thank you

nick
 
Since you haven't got any other answers (that I can see), here is my 2c
worth.

It is really a maths problem, not (initially) a database design problem.
It's like asking, "What is the best database structure to calculate the
shortest route between two cities?". There are some well-known mathematical
algorthims for solving that problem. It would be premature to start
designing the database, until you understood those algorithyms.

So my advice is, forget the database issues for the moment. Find out what
mathematical theory or algorithms let you calculate the answers you want. It
is< a common problem, & I'm sure there is a standard theory or algorithm.
Once you understand the algorithm (& have tried it out on paper), >then< you
could get back to the database structure.

As I say, just my 2c ...

HTH,
TC
 
I've been holding off too, for the same reason. Just one thing to add: a
not-very-high-level procedural language like VB/VBA is not well suited
to this kind of problem. Better to look into languages (declarative?
functional? - I'm not a CS type myself) where you can define the rules
(constraints) and let the computer do the hard work. Modern
implementations of such languages should be able to work with data
stored in an Access database.
 
Yes - good point.

Cheers,
TC

John Nurick said:
I've been holding off too, for the same reason. Just one thing to add: a
not-very-high-level procedural language like VB/VBA is not well suited
to this kind of problem. Better to look into languages (declarative?
functional? - I'm not a CS type myself) where you can define the rules
(constraints) and let the computer do the hard work. Modern
implementations of such languages should be able to work with data
stored in an Access database.
 
Back
Top