Code Monkey home page Code Monkey logo

hack4retail's Introduction

Hack4Retail round 2

Β«Tsina TyzhniaΒ» team solution for the final round of Hack4Retail Hackathon. Teammates: Andrii Samoshyn, Andrii Yerko, Oleksii Galganov, Sofia Shaposhnikova.

πŸ₯‡ Achieved 1st place on the private leaderboard and 4th on the public. There is also a presentation of our approach.

Task

Optimize darkstore items placing

1 big cell = 4 small cells = 2 m

Darkstore layout

The layout of the racks in the darkstore: six 3-tier racks, each rack is divided into sections, which are numbered with the numbers 1,2, ..., 44. Each section has 3 levels. Thus, there are a total of 132 cells. Only one item can be stored in each cell

Movement speed

The movement speed between racks is 1 m/s. Time required for pick-up of any goods from levels 1, 2, 3 makes 1 s, 2 s, 3 s respectively.

Route

We assume that when forming each order, the picker knows the shortest route from section to section. The collection of the cheque begins and ends at the assembly point marked with the number 0. You can pick up goods from the shelves only from the green dots on the side of the green lines. We assume that the picker can move only on cells and, thus, the passed way is measured in city-block distance.

Given data

Orders / cheques of another, similar, darkstore for the last month.

Miscellaneous

We assume that the items in the cell never end.

Approach

Validation

At first, we created a function that computes travel and picking time for the given set of cheques: for each cheque, it computes picking time by multiplying level pick-up time and amount of items that should be picked, and the travel time by moving to the nearest section from cheque each turn. Sections and levels are taken from the current darkstore map.

Actually, our function somewhat differs from the one used on the leaderboard β€” it sometimes returns a higher time for some of the cheques. But on average it still correlated with LB, so we decide to keep it.

For travel time computing we used a distance matrix of the darkstore β€” we created it by hands, but in general, it should be created from the given layout with some algorithms like bfs.

Baseline

We sorted (section, level) pairs by the distance from section to the entry point and sorted items by the number of appears in the dataset, then concat into a single dataframe.

Ranging

The basis of our solution was two-step ranging by the linear combination of items features:

  1. Extract features from the historical data: total number of sales, the average amount in a cheque, and the average number of unique items in cheques containing this item. Create polynomial features based on them
  2. Create two linear combinations of these features.
  3. Use the first linear combination to determine the level for each item: sort them by the received metric and assume the first 1/3 should be placed on 1st level, second 1/3 on 2nd level, and the last 1/3 on 3rd level.
  4. For each group: sort sections by distance from the entry point and fill them with items starting with one with the highest value of the second linear combination.
  5. Fit linear combination coefficients with Optuna to minimize total pick-up time.

Genetic Algorithms

Our final solution was found by the genetic algorithms, using placing we received with ranging as a starting point.

Other

We also tried to use the Apriori algorithm to find relations between different items, and the clustering of items by embeddings built with Word2Vec-like approaches, but it didn't work in this task, probably because of a small amount of data.

Notebooks & Files

hack4retail's People

Contributors

yalikesifulei avatar andrii0yerko avatar samoshyn avatar

Stargazers

karazhyn avatar Artem Holoskevych avatar Nikita Fordui avatar Volodymyr Sydorskyi avatar  avatar  avatar

Watchers

 avatar

Forkers

andrii0yerko

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.