Giter VIP home page Giter VIP logo

gamma-opt / shelfspaceallocation.jl Goto Github PK

View Code? Open in Web Editor NEW
9.0 3.0 6.0 1.11 MB

ShelfSpaceAllocation.jl is a Julia package for solving the retail shelf space allocation problem. Internally, it relies on mathematical optimization, where the model is a mixed-integer linear program.

Home Page: https://gamma-opt.github.io/ShelfSpaceAllocation.jl/dev/

License: MIT License

Julia 100.00%
shelf-space-allocation mixed-integer-programming retail-space-planning planogram optimization julia-language

shelfspaceallocation.jl's Introduction

ShelfSpaceAllocation

Docs Image Runtests

This package contains an optimization model for solving the shelf space allocation problem (SSAP) in the context of retail stores, formulated as mixed-integer linear program (MILP). We intended the package for both developing and running the model. It includes the model, visualization capabilities, input/output related functions, and example instances. The documentation covers how to use the package, its functionalities, and the model in detail.

This package is a part of a research project at the Systems Analysis Laboratory at Aalto University, authored by Fabricio Oliveira and Jaan Tollander de Balsch.

Examples

Attribute Small Medium Large
Products 118 221 193
Shelves 7 7 10
Blocks 7 9 23
Modules 1 1 2

There are three example cases available: small, medium and large with sizes described in the table above. The example script below shows how to solve these instances with ShelfSpaceAllocation.jl using the Gurobi optimizer.

using Dates, JuMP, Gurobi
using ShelfSpaceAllocation

case = "small"
output_dir = "examples/output/$case/$(string(Dates.now()))"
mkpath(output_dir)

parameters = Params(
    "examples/instances/$case/products.csv",
    "examples/instances/$case/shelves.csv"
)
specs = Specs(height_placement=true, blocking=true)
model = ShelfSpaceAllocationModel(parameters, specs)

optimizer = optimizer_with_attributes(
    () -> Gurobi.Optimizer(Gurobi.Env()),
    "TimeLimit" => 5*60,
    "MIPFocus" => 3,
    "MIPGap" => 0.01,
)
set_optimizer(model, optimizer)
optimize!(model)

variables = Variables(model)
objectives = Objectives(model)

Saving values to JSON.

save_json(specs, joinpath(output_dir, "specs.json"))
save_json(parameters, joinpath(output_dir, "parameters.json"))
save_json(variables, joinpath(output_dir, "variables.json"))
save_json(objectives, joinpath(output_dir, "objectives.json"))

Loading values from JSON.

specs = load_json(Specs, joinpath(output_dir, "specs.json"))
parameters = load_json(Params, joinpath(output_dir, "parameters.json"))
variables = load_json(Variables, joinpath(output_dir, "variables.json"))
objectives = load_json(Objectives, joinpath(output_dir, "objectives.json"))

The plotting section of the documentation shows how to visualize the results.

Example of relax-and-fix and fix-and-optimize heuristics is available in heuristics.jl file.

Installation

Install the Julia language and then install this package.

pkg> add https://github.com/gamma-opt/ShelfSpaceAllocation.jl

Development

Clone the repository

git clone https://github.com/gamma-opt/ShelfSpaceAllocation.jl

Install dependencies

pkg> dev .

Install solver such as Gurobi.

Installing Solver

It's up to the user to choose a suitable solver for solving the JuMP model. For small instance GLPK is sufficient but for large instances, commercial solver such as Gurobi or CPLEX is recommended.

Gurobi is a powerful commercial optimizer which provides a free academic license. Gurobi can be interfaced with Julia using Gurobi.jl. Here are the steps to install Julia and Gurobi to run the program:

  1. Obtain a license of Gurobi and install Gurobi solver by following the instructions on Gurobi's website.

  2. Make sure the GUROBI_HOME environmental variable is set to the path of the Gurobi directory. This is part of standard installation. The Gurobi library will be searched for in GUROBI_HOME/lib on Unix platforms and GUROBI_HOME\bin on Windows. If the library is not found, check that your version is listed in deps/build.jl. The environmental variable can be set by appending export GUROBI_HOME="<path>/gurobi811/linux64" to .bashrc file. Replace the <path>, platform linux64 and version number 811 with the values of your Gurobi installation.

  3. Install Gurobi.jl in Julia's package manager by running commands

    pkg> add Gurobi
    pkg> build Gurobi
    

Documentation

The project documentation is created using Documenter.jl. To build the documentation, navigate inside the docs directory and run the command

julia make.jl

shelfspaceallocation.jl's People

Contributors

jaantollander avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

shelfspaceallocation.jl's Issues

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.