0

I'll explain My Problem With an example.

Let's say we have:

  • An Order from a certain store for five products, We will name those products A,B,C,D, & E, with their quantities In the Order A(19),B(25),C(6),D(33),E(40).

  • A single Truck that can fit different amount of each product:
    A(30), B(40), C(25), D(50), E(30).

Ex: Transporting A & B together, I loaded the the Truck with A(19) so that's two thirds of what my Truck can handle, So that leaves one third for B, Which means i can only transport 1/3 of B's maximum Truck capacity which is (40/3 ≈ 13).

  • A Set of Warehouses which contains different amounts of each product.

I made an Excel spreadsheet which contains more useful info regarding those Warehouses like( Quantities, Distance from Each other, Distance from store ).

I want to Deliver this order to the store with the least amount of trips and distance traveled.

Is there an Algorithm for this kind of problem, Or something close i can modify on?

EDIT: Updated Links.

Makdous
  • 1,447
  • 1
  • 12
  • 24
  • Sounds like a combination of Knapsack and Travelling Salesman... – tobias_k Mar 11 '20 at 14:30
  • 1
    Could you add the tables directly as text? Would make it easier for possible answerers than having to type all that in themselves. – tobias_k Mar 11 '20 at 14:32
  • How many stores are there? – Brainless Mar 11 '20 at 15:08
  • Many stores, But the order must be delivered to the store that initiated the order – Makdous Mar 11 '20 at 15:21
  • How many trucks are there? Only 1? – Brainless Mar 11 '20 at 15:30
  • @Brainless like the stores there are many Trucks with different capacities, but only one can answer the order. – Makdous Mar 11 '20 at 15:46
  • `with the least amount of trips and distance traveled` - one can imagine scenarios where these two constraints would be at odds, say if three stores relatively close to the target can combine to fulfill the order, but a single store further away also can. – 500 - Internal Server Error Mar 12 '20 at 09:25
  • @500-InternalServerError well its true, but in my case the order must be delivered to the store that ordered it,regardless of nearby stores. – Makdous Mar 12 '20 at 09:41
  • Delivered, yes, but I am talking about pick-up. – 500 - Internal Server Error Mar 12 '20 at 09:42
  • Please [use text, not images/links, for text--including tables & ERDs](https://meta.stackoverflow.com/q/285551/3404097). Paraphrase or quote from other text. Give just what you need & relate it to your problem. Use images only for what cannot be expressed as text or to augment text. Images cannot be searched for or cut & pasted. Include a legend/key & explanation with an image. Also, links die. Insert images/links using edit functions. Make your post self-contained. – philipxy Apr 26 '20 at 12:49
  • Those links are Google docs, They won't die unless **I** deleted them or Google terminated them (which i will be notified of), And i only included theses link because they carry example data which i don't think can be displayed as wanted unless they where in a table, but thanks for notifying me, I'll try to include less unnecessary links in the future. – Makdous Apr 26 '20 at 13:08

1 Answers1

1

I would advise not to reinvent a wheel as a very first step of your work. Developing/adopting a custom algorithm for such a problem would be a very painful venture in my opinion. I would suggest using either a constraint satisfaction programming (CSP) toolkit or a direct mixed integer programming (MIP) solver.

My point is that it would be much easier to encode your problem using such tools. If performance/accuracy won't be enough for you - you could design a custom solution based on your preliminary results.

For CSP I would suggest Minizinc which has decent documentation and examples.

You could start your MIP research with GLPK. It's not very powerful, but it's definitely capable of dealing with some toy examples.

CaptainTrunky
  • 1,562
  • 2
  • 15
  • 23