Skip to content

๐Ÿ›’ CSP solver that generates an optimal grocery list

Notifications You must be signed in to change notification settings

bornabesic/shoptimize

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

52 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Shoptimize ๐Ÿ›’

Command line tool that solves a constraint satisfaction problem (CSP) to generate an optimal n-day grocery list.

Supported constraints

  1. Maximum amount of money to spend
  2. Number of times a meal component can/must be used

Building

git clone --recursive https://github.com/bornabesic/shoptimize.git
cd shoptimize
mkdir build
cd build
cmake .. -D CMAKE_BUILD_TYPE=Release
make

Dependencies

This project uses yaml-cpp library to parse the configuration from a YAML file. It is stored in lib/ as a git submodule. During the build process, the library is statically linked against the executable.

Usage

shoptimize <configfile> <storename>

Arguments:

  • configfile: Path to a YAML configuration file
  • storename: Name of a store (defined in the configuration file) to use

Example

Expected output when using config/example.yaml configuration file.

$ shoptimize config/example.yaml Kaufland

Products: 4
Components: 3
Stores: 1
Meals: 12
Constraints: 2

Time: 0.00140942 s
Solutions: 56

Best solution:
{Minutensteaks} {Heringsfilet}  {Pasta Pesto}   {Pasta Pesto}   {Heringsfilet}  {Pasta Pesto}   {Pasta Pesto}   {Heringsfilet}  {Pasta Pesto}   {Heringsfilet}  {Minutensteaks} {Heringsfilet}
Cost: 10.249