Creating REST API for Minimum Cost Delivery Calculation with Multiple Pickup Points and a Single Delivery Vehicle

21 Views Asked by At

I'm working on a assessment task where I need to create a REST API accessible via the POST method.

The API is intended to calculate the minimum cost to deliver a given order to a specific location under certain conditions.

Here are the requirements:

Condition1 : One delivery vehicle will be deployed from either C1, C2, or C3 to fulfill the order.

Condition2: The vehicle can pick up orders from multiple centers (C1, C2, C3) and deliver them to the customer location L1. The sequence of pickups and deliveries may vary.

Conditon3 The cost of running the vehicle is provided in a table. (Attached Images Below)

1.https://i.stack.imgur.com/6ItXs.png

2.https://i.stack.imgur.com/ifqUn.png

3.https://i.stack.imgur.com/3QFKg.png

4.Input for the API will be the quantity of each product in the order, and the output should be the minimum cost to deliver the order.

Here are some sample test cases:

A-1, G-1, H-1, I-3 should output 86

A-1, B-1, C-1, G-1, H-1, I-1 should output 118

A-1, B-1, C-1 should output 78

A-1, B-1, C-1, D-1 should output 168

Attached Image of The problem for more clearity :

Entire Problem Statement with diagram

1.https://i.stack.imgur.com/6ItXs.png

2.https://i.stack.imgur.com/ifqUn.png

3.https://i.stack.imgur.com/3QFKg.png

I need only logic behind the minimum cost calculation with working testcase in any language.
I have tried to implement this using the Floyd Warshall algorithm. I am seeking someone skilled in competitive programming or problem-solving who can help resolve this coding Problem. I need only logic of this problem in any language.

0

There are 0 best solutions below