Smart Store System

From UBC Wiki

Authors:

Guilherme Lameira de Almeida, Prayansh Srivastava, Mingyu Gao

What is the problem?

The goal of our project is to create a smart store system for inventory tracking and cashier-less purchasing. Our system will be written in Prolog and the main queries it will answer are:

- How much of a product is available in the store at any given moment

- What products is a person taking with them when they walk out of the store

The information that will be fed into the system comes from very minimal hardware devices: 

- Various thin, mat-like, electronic scales that wirelessly broadcast their measured weight (with a timestamp and position in the store)

The store will place the mat scales in the shelves (like a shelf liner) and in the bottom of the shopping baskets. The store administrator will enter into the program which scales are basket scales, which ones are shelf scales, as well as the product that is over each scale on the shelf. The program will also have data on each product with its name, price, and weight. The program will also know the position of the entrance and exit of the store.

For simplicity we will make some assumptions (rules) of our domain:

- Every person in the store will have a shopping basket with them at all times

- When a person wants to buy something they are required to place the product in their shopping basket

- The store has a rectangular shape

What is the something extra?

As an extra challenge, we will try to detect stealing in our store (suppose a costumer does not place the products in his shopping basket, but removes it from a shelf). In order to this, we will be required to not be reliant on the weight measurements of the shopping baskets to identify which costumers posses certain items removed from the shelves. Instead, we will keep track of the customer's positions and determine which customers are possible suspects according to the time an item went missing.

What did we learn from doing this?

We learned a lot of things about Prolog (the language), but also things about the logic programming paradigm.

Firstly, we learned how to use built-in predicates such as findall() and sumlist(), which we used in order to accumulate the count of things in a list. Prolog has intuitive syntax, which is good, because it allowed us to use these functions easily.

From this we noticed that this programming paradigm does indeed allow us to spend more time thinking about problem, as opposed to the program. It has good syntax that is very close to english, and it represents logical consequences very well.

Something that we are used to from the object oriented paradigm is representing complex data using some sort of data type. We wanted to represent the items in the store. At first it was hard to get used to using something like prop() to store objects, because it is a different way of thinking.

Another difficulty was to keep track of time stamps. We did it by threading an atom through most of the predicates of our program, which represents the time. We also had to write some boilerplate code to make sure that the time was within the scope of our program.

Finally, when we were creating testing data, we found that inferring data (to fill gaps in between the given measurements) might be easier in another language. Perhaps we just have not found the right way of thinking yet.

Links to code etc

https://github.com/prayansh/CPSC312-Project-Prolog