Calculations (1 Viewer)

spacepro

Registered User.
Local time
Today, 07:06
Joined
Jan 13, 2003
Messages
715
Calculations..How??

Hi all,

I want to automatic allocate stock to vehicles based on a cubic measure, which is recorded in my products table

How would I go about this ??

The vehicle would have a maximum cube and I want to press a button to allocate all the details from a temp table of all orders taken.

I suspect a Case/If statements tied with an update/append query. Possible function to be written?? Just floating ideas of the top of my head.

Any suggestions/ideas/comments would be appreciated before I embark into the unknown.

many Thanks in advance

Andy
:confused:
 
Last edited:

neileg

AWF VIP
Local time
Today, 07:06
Joined
Dec 4, 2002
Messages
5,975
You need to determine the algorithm you're going to use before you worry about the programming.

E.g. are you going to allocate the first load to the van, then the next if it fits, and if it doesn't, go on to the next van? Or are you going to cycle through all the available loads until the van is full, and then move to the next van? Or do you want to permutate all the loads until you get the minimum number of maximum loads?

These are presented in ascending order of difficulty.

Believe me, the Access programming is the easy bit.
 

spacepro

Registered User.
Local time
Today, 07:06
Joined
Jan 13, 2003
Messages
715
Hi Neil,

Hope you are well. Thanks for taking the time to have a look at my issue.

Anyway basically there are 20 stores(Depots) and about 60 Products and all of the stores place an order each week for set amount of each but not all of the products.

So for example store 1 will take 400 units, which will consist of 5 different products which have 3 different cubic measures.

I am going to import the data in from a spreadsheet into a temp table and I want to set the db to look at all of the products for each store aand allocate stock to a vehicle so if 100 units of product A and 20 products of Product B will fit on a vehicle and the rest of the products ordered are the same cube then it would output to say that store requires 3 full vehicles and one vehicle with 40 products on.(all vehicles are Artics(40ft))

But I need to output into a breakdown of each load.

Basically I want to process the whole of the data in one go and then output the breakdown of each vehicle. There will be no other users on the db.

The only reason I want to carry this out in Access, is so that we have electronic records and something I can generate performance trends and customer requirement.

Just not sure on how to go about this one?

Thanks in advance

Cheers

Andy
 

neileg

AWF VIP
Local time
Today, 07:06
Joined
Dec 4, 2002
Messages
5,975
You've not answered my question!

Say your 40ft trailer has a volume of 9,000 cuft. You may know that you have 450 units of product A and they are 20 cuft each. You may think these will fit in the trailer, but will they? Is the shape such that once you have loaded 400 units, you can't get any more in, due to some wasted space. However, product B is 4 cuft, and youy could still get 100 of these in. Perhaps you get best load optimisation by only loading 300 units of A, 500 units of B and 25 units of C.

Regardless of the volume of the units, perhaps they are palletised. This way you are not dealing with a large volume of small units, but rather a small volume of large units. The larger the unit size, the greater the chance of wasted space.

How does the logic of this work? If you can turn this into a mathematical model, then you can get Access to handle it (probably!). But you need to know how you are going to do this, since Access does not have any built in tools to deal with trailer loading!
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 01:06
Joined
Feb 28, 2001
Messages
27,303
spacepro, neileg's answer is absolutely correct, but I will say it a different way so you will understand the problem he is trying to explain.

You see, right now you are talking about using Access to model something - namely, optimizing a truck load - which is a real-world problem. But you are overlooking the basic requirement that ALL computers have when you are designing an automated solution.

If you cannot do it on paper, you cannot do it in the computer.

I.e. you need to specify the algorithm BEFORE you write the first line of code, or, to put it as gently as I can, you are hosed to tears before you start.

The factors I see here are:

1. Dimensions of the van. Not just cu.ft but height, width, and length. Also weight capacity.

2. Dimensions of EACH PACKAGE. Height, width, and length as well as cu.ft. and weight.

3. When a pallet is involved, dimensions of the pallet in the form of height, width, and length plus cu.ft and weight (superceding the dimensions of the individual components.)

Now you have to do, in essence, a 3-D TETRIS game on seeing how many items you can pile over each square inch (cm?) of your floor space.

Your model MIGHT be something like this:

Create a 2-dimensional array representing your floor space where each entry represents one square inch. The size of the arrays correspond to the length and width of the truck, whole inches only. (Don't try to back down to the quarter-inch. That way lies madness.) OR make it 3-dimensional, with the third dimension the truck number. For each truck, you might have different limits, so maybe the dimensions of the array will be those of the largest truck, but you will not use all of the elements in each sub-set of the array. How you arrange this is your call. I might pre-allocate all array elements outside of the possible dimensions for the truck before I start the allocation process, but what the heck, that's just an opinion.

Each array item is the depth in inches of the stack over that square inch of floor in that particular truck. Now, when you start stacking each box, you decide how you want to stack things. YOU HAVE TO DECIDE THIS. WE CANNOT. (It is, after all, your business, not ours.)

You can choose to sort your load requirements to attack lots of boxes of the same size first. That trivializes some of the issues. So what you do is take a box. Get its length and width and height from your dimensions table.

Select the placement of one corner of the box. Look for the lowest allocated height in the truck floor that has a uniform height over a footprint the size of the box starting from an arbitrary corner of said box.

Allocate the height of the box for every square inch the box will cover. For each load, note the position of the box's corner that you used as a loading reference. For instance, the bottom left rear corner as the reference point. This means you store THREE coordinates.

If the box will cover a fraction of the inch, round that UP no matter how small the fraction. (Remember, you rounded the truck dimensions DOWN to the nearest inch no matter how large the fraction.) This guarantees that your loading supervisor won't cuss you every time s/he has to shoe-horn one more box into place.

OK, with one box placed, you now repeat the process for every box. When the bottom layer of floor is covered, you have started to stack the boxes. Eventually, you run out of space because none of the boxes you want to store can fit. So you start another truck.

Now, you COULD do this a different way if you wish. You can test a box to see if it is the same size as the previous box and if it will fit in the height remaining over the previous box.

The difference between these two approaches is to fill the height first or the floor space first. Just remember, you get to choose the approach. I've given you a hint but by no means the whole packing algorithm.

OK, the report just looks at the dimensions you stored for each box you plan to ship. Those were the position of the chosen corner which includes a height, width, and length coordinate as measured from the same corner of the truck's interior, plus the truck number. To LOAD the truck, sort this by the coordinate corresponding to the length of the truck and load the smallest length coordinates first, showing the width second and the height (stacking order) third, grouped by trucks.

I emphasize that this is only a suggestion and might not be viable for your system. But it might galvanize your thinking about the problem to see how it could be done to suit your actual needs.

By the way, don't expect this to be a fast algorithm once the trucks start getting packed. I hope you have a real CRUSHER of a computer for this problem because you are going to eat your CPU's socks when you run this. The search for the lowest free space for the next box will take a LOT of time the more boxes you have already loaded.

I anticipate some issues that might come up.

For instance, allocating one truck at a time and adding a truck only when you have run out of space for the next box you have to allocate. But you should also not give up totally on the truck you just filled if the boxes don't divide evenly in the required space. If you have smaller boxes, they can become filllers (at least in potential) for the gaps between the top of the last box and the truck ceiling.

Now, there is another issue that you might have to consider - stacking depth requirements. Some boxes might say "stack no more than three boxes high" due to the ability of the box to bear the weight of other boxes above it.

You also have to consider load shifting issues if you stack boxes more than n elements high. This is something between you and the truck drivers.

Another issue is that if your trucks are not uniform in size, then you need to know ahead of time the dimensions of each truck as you allocate it and keep the allowable cu.ft in memory, too.

This is where you will earn your money, I assure you. This is not a trivial problem and has been studied many times with many wrinkles.
 

neileg

AWF VIP
Local time
Today, 07:06
Joined
Dec 4, 2002
Messages
5,975
Phew! What an exposition!

Dead right, Doc_Man
 

spacepro

Registered User.
Local time
Today, 07:06
Joined
Jan 13, 2003
Messages
715
Hi Guys,

Wow, I want to thank the pair of you on your time to express your opinions. All good input. Thanks.

Anyway guys,

I am sorry if I didn't answer the question correctly.

Right let's start from scratch.

The vehicles do not have to be completely maximised, as this is not my intention, but thinking about it this would eventually become an essential part of the automation in the future.

Basically a vehicle has 21 lanes. Each lane will fit so many products in each lane, which will be the cubic measure in the products table.

The calculation should look something like :

qty of product ordered divide product cube = no of lanes
no of lanes divide 21 = no of vehicles

but calculating the loads to say 3 full vehicles and 1 vehicle which is 5 lanes.

This calculation to be carried out for each Store.

Basically I want to cycle through the data for each store and allocate the stock to how many vehicles it is as to the calculation above.

All of the products are not palletised there are free standing products. I currently carry out the load build manually based on knowledge of the product.
Height is not an issue as most of the products are literally free standing and stock is not predominantly stacked upon apart from two models, which is very unlikely to change, but is a possiblity several years from now .

I just want to program the db to do what I am thinking, I am sure this can be done it is just a case of the way I go about this.

There are only 2 products that can be stacked upon,
I have also a full list of products with maximium totals for each product.

I hope this answers the question and explains my situation a little better, Sorry if it doesn't.

Many Thanks

Andy
 

spacepro

Registered User.
Local time
Today, 07:06
Joined
Jan 13, 2003
Messages
715
Don't know if this will explain it a little better but here is an example:

STore 1

Product A cube = 4
product b cube= 3
product c cube = 4

product A qty Ordered = 200
product B qty ordered = 100
product C qty ordered = 50

So the calculations would be :

qty ordered = 200 divide by 4(Cube) = 50 lanes
so 50 lanes divided by 21 lanes(1 vehicle) = 2 full vehicles
and 1 vehicle with 8 lanes.

Then Product B qty ordered = 100 divide by 3(Cube) =(33.3) 34 lanes (roundest off to the next round number).
so 34 lanes total then add 13 lanes to the vehicle with 8 lanes above which leaves 21 lanes (which is one vehicle).

Then product c qty ordered = 50 divided by 3(cube) = (16.25) 17 lanes (rounded to the next round number) .
so 17 alnes eequals one vehicle as it is within the 21 lanes(Vehicle measure).

So a total of 5 vehicles for store 1.

Also when I say cube this is not a cu.ft measure this is purely the amount of that product for each lane of the vehicle, which will not change.

Hope this Helps

Andy
 

spacepro

Registered User.
Local time
Today, 07:06
Joined
Jan 13, 2003
Messages
715
Neil/DOc_Man or anyone else

Anyone help me out here???;)

Much appreciated

Andy
 

neileg

AWF VIP
Local time
Today, 07:06
Joined
Dec 4, 2002
Messages
5,975
Ah, right. Now I understand. Bad news is, I'm not sure how to do this!

There are some variables that you have not addressed, like
- How do you decide which trailer goes to which shop
- How do you decide where to start with the allocation
Still, here's some thoughts.

The first step would be to calculate the total delivery for the shop, and convert that to lanes. You know, then, how many vehicles you need. You then need to allocate the required number of vehicles to that delivery. I don't know how you decide which vehicles.

You then need to allocate the stock to the vehicles. I don't know how you decide what stock goes on which vehicle. I suspect you will need to stick to working with lanes, not stock units.

I know this isn't much help, but as Doc_Man points out, this is a complex matter.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 01:06
Joined
Feb 28, 2001
Messages
27,303
Been busy, had two hard drives go out on my main system that has several hundred users on it. Has nothing to do with Access, it is an ORACLE system. What with restorations, reformatting, etc., that kind of work can get a bit tedious even with mirror sets protecting things. Couldn't get back 'till now.

spacepro, in this exchange I can see that you have had to examine your own problem a little closer.

The best way i can tell you what to do is this: Try to write down on paper the steps you would use to do this by hand. Identify what you need to know and how you use it. By the very act of just organizing your problem's description, you being the process of designing your solution.

And I'm EXPLICITLY saying that even if your company has a manual telling you the goal, you want to define the mental process ANYWAY. The goal is NOT the path. To solve this using Access, you NEED TO KNOW THE PATH AS WELL AS THE GOAL.

The next step is, once you have the general method written out, you go back and look at it. You decide the data you need to know in order to implement this method. You also decide what (specifically) you must do with the data once you have it. Here is where you will begin to define either queries (to at least sort & group things in some convenient order) or modules (where you have something that a simple query won't touch.)

If it is not otherwise specified in whatever documentation you have now, you should also talk to the folks who have to implement your solution - to find out what THEY need to know. Because that will begin to define other queries and reports for your (in-house) customers of your service.

Whether your arrays are based on square inches or lanes, you still have to allocate finite numbers of things in them according to their storage capacity. So your units might have changed but the concept I was describing really has not changed that much.
 

spacepro

Registered User.
Local time
Today, 07:06
Joined
Jan 13, 2003
Messages
715
Thanks Guys for the response. You have helped me so much in my thought process. Many thanks.

As you both say, as a rule I always write down the way I willl design the database first, in this instance I need to pragmatically look at each stage of the process definging my goal and the path I take and spending more time on the planning of the db, but I am sure carrying out this project I will be able to increase and develop my skills with Access.

Many Thanks for your time.

Take Care

Andy
 

Cosmos75

Registered User.
Local time
Today, 01:06
Joined
Apr 22, 2002
Messages
1,281
What happens for a situation like this?

Product , Lane/Product Unit , Ordered , Lanes (Not Rounded Up) , Lanes (Rounded)
A , 1 , 10 , 10.00 , 10.00
B , 2 , 15 , 7.50 , 8.00
C , 3 , 10 , 3.33 , 4.00

Not rounding up gives you 20.83 Lanes - Fit onto one truck
Rounding up gives you 22 Lanes - Need two trucks!
Also when I say cube this is not a cu.ft measure this is purely the amount of that product for each lane of the vehicle, which will not change.
I think that you mean that for this situation it should be two trucks, but I just wanted to make sure it's something you've thought of.

Also, do you need to know;
1) what to fit onto each truck
or
2) just the total number of trucks needed (e.g. 2 full vehicles and 1 vehicle with 8 lanes.)
 

spacepro

Registered User.
Local time
Today, 07:06
Joined
Jan 13, 2003
Messages
715
Cosmos,

I need to know both, but ideally just what goes on each vehicle.

If you take a look at the post in VBA section I have posted an example db and an explanation.

Many Thanks

Andy
 

Users who are viewing this thread

Top Bottom