Freight calculation

Asked

Viewed 303 times

2

I’m trying to work out a freight system for a company but I’m having a problem. So,:

  • the freight itself is calculated by the Post Office system which access through an API;
  • I have already done everything on the website of the Post Office to carry out consultations for freight calculation;

For the Post API, height, width, weight and product length are required. These values, in turn, are obtained from the customer’s database according to the product to which the freight is to be calculated. As the products are customized, if the quantity of products goes beyond a certain quantity - for example, 50 - the system I made ends up multiplying the values by 2.

I need the system to get the highest value of length and width and add up the height and weight. I need this calculation to be done to, for example, place one box on top of the other and not side by side because the smaller boxes will always be placed on top of the larger ones. Avoids harm to customer and supplier.

I can’t think of a way to solve this problem. Any idea?

  • 1

    I edited your question to make the text more readable. Anyway, you need to show your code so someone can help you - the relevant part of the question. And yet, the doubts here in the OS should be more directed to technical perspective and learning than to something like 'do it for me' - maybe someone signals your question (I suppose).

  • 2

    So Leonard, in spite of his explanation... she begs doubts... this material will actually be sent by mail Or is it another kind of freight? If it’s by mail that I know of, is there a maximum space limit to send in a box right? To optimize this space you have to calculate its area along with the area of each product...

  • the name is right ? "" ?

  • 1

    Your problem is not trivial. When you define a fixed bounding space (the size of the box/space limit mentioned by colleague @Andreicoelho), the problem is popularly known as "Pallet Loading Problem". If you look for this term, you will find several proposals for approach. For example: http://www.lac.inpe.br/~Lorena/glaydston/lagclus-pallet.pdf Maybe some of them will suit you. Unfortunately, that’s as far as I can help.

  • 1

    Another link that may be useful: http://www.scielo.br/pdf/pope/v23n2/a07v23n2. It does not involve overlapping, but you may be able to do it in several executions (by layers) and prioritize larger boxes in the first executions (lower layers).

  • 1

    But, I think the easiest approach for you is perhaps to "estimate" in a grosser way (with bigger error) the volume needed simply by adding the volumes of the boxes and trying to accommodate them in a pre-defined size box. Something like the backpack problem (that one another question may also be useful).

  • 1

    I like your tips @Luizvieira... can help me in the future too

Show 2 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.