SupplyChainOptimization.jl

SupplyChainOptimization.jl is a package for modeling and optimizing supply chains.

Installation

SupplyChainOptimization can be installed using the Julia package manager. From the Julia REPL, type ] to enter the Pkg REPL mode and run

pkg> add SupplyChainOptimization

SupplyChainOptimization.jl needs an optimizer to find optimal solutions to supply chain design problems. By default the HiGHS solver is used. It is a powerful open-source solver. Other solvers can be used. The solver must be compatible with JuMP and must be able to solve mixed integer programming problems. Solvers that meet these criteria include:

Getting started

Optimizing the supply chain is done in three steps:

  • Modeling the supply chain using built-in concepts such as storage locations and customers.
  • Invoke the solver. This step may take more or less time depending on the difficulty of the problem.
  • Querying and visualizing the results.

In the example below we search for the best storage locations to use to supply a set of customers. We first download data on US cities. Then we create one product, a set of 40 possible storage locations and a set of 350 customers both distributed throughout the US. We specify the cost of operating each storage location and the cost of shipping the product from each storage location to each customer. Finally we indicate the demand for each customer. Once this is done we optimize the network.

using CSV using DataFrames using SupplyChainOptimization

nm = tempname() url = "https://raw.githubusercontent.com/plotly/datasets/master/2014uscities.csv" download(url, nm) us_cities = CSV.read(nm, DataFrame) rm(nm)

sort!(us_cities, [:pop], rev=true)

sc = SupplyChain(1)

product = Product("Product 1") add_product!(sc, product)

for r in eachrow(first(uscities, 40)) storage = Storage("Storage r.name", Location(r.lat + 0.2, r.lon + 0.2, r.name); fixedcost= 2000000 + r.pop / 2, openingcost=0.0, closingcost=0.0, initialopened=false) addproduct!(storage, product; initialinventory=100000) add_storage!(sc, storage) end

for (i, r) in enumerate(eachrow(first(uscities, 350))) customer = Customer("customer i", Location(r.lat, r.lon, r.name)) addcustomer!(sc, customer) adddemand!(sc, customer, product, [r.pop / 10000]) end

for c in sc.customers, s in sc.storages addlane!(sc, Lane(s, c; unitcost=haversine(s.location, c.location) / 250)) end

minimize_cost!(sc)

After optimizing the network we can visualize the results.

plot_flows(sc; showlegend=false)

getting_started

SupplyChainOptimization comes with a variety of built-in concepts including Customers, Lanes, Plants, Storages, and Suppliers. Each of these concepts has attributes that are used to ensure constraints are met and costs are minimized.