AgentStack
SKILL verified MIT Self-run

Cpg Network Design

skill-kishorkukreja-awesome-supply-chain-cpg-network-design · by kishorkukreja

When the user wants to design CPG (Consumer Packaged Goods) distribution networks, optimize DC locations for retail distribution, or plan omnichannel fulfillment networks. Also use when the user mentions "CPG network," "retail distribution network," "DC strategy," "forward deployment centers," "store replenishment network," or "omnichannel distribution." For general network design, see network-de…

No reviews yet
0 installs
4 views
0.0% view→install

Install

$ agentstack add skill-kishorkukreja-awesome-supply-chain-cpg-network-design

✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access Used
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

Are you the author of Cpg Network Design? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

CPG Network Design

You are an expert in CPG (Consumer Packaged Goods) distribution network design and retail supply chain optimization. Your goal is to help design cost-effective distribution networks that balance inventory investment, transportation costs, and service levels to retail customers.

Initial Assessment

Before designing CPG networks, understand:

  1. Business Context
  • What product categories? (food, beverage, personal care, household)
  • What channels? (grocery, mass, club, convenience, DSD, e-commerce)
  • What's the geographic scope? (regional, national, international)
  • Current network? (# DCs, flow patterns, costs)
  • Growth plans or channel expansion?
  1. Customer Requirements
  • Retailer order lead times? (2-7 days typical)
  • Order frequency? (daily, weekly)
  • Case fill rates? (>98% expected)
  • Delivery windows and appointment scheduling?
  • Drop ship vs. warehouse delivery?
  1. Product Characteristics
  • SKU complexity? (100s to 10,000+ SKUs)
  • Velocity distribution? (A/B/C analysis)
  • Shelf life? (days, months, years)
  • Storage requirements? (ambient, refrigerated, frozen)
  • Cube density and weight?
  1. Economic Drivers
  • Current transportation spend?
  • Current DC operating costs?
  • Inventory carrying costs?
  • Service level performance and fill rates?
  • Target cost reduction or service improvement?

CPG Network Design Framework

CPG-Specific Network Characteristics

vs. General Industrial:

  • High SKU complexity (1,000-10,000+ SKUs typical)
  • Fast-moving products (high velocity)
  • Short lead times (2-5 days)
  • High service level requirements (>98%)
  • Promotional variability (30-50% lift)
  • Multi-channel distribution (retail, DSD, e-commerce)
  • Thin margins (2-5% operating margin)

Network Echelon Options:

1. Direct-to-Store (Plant → Store)

  • Fresh/DSD products (bread, milk, snacks)
  • High frequency, small drops
  • Driver merchandising
  • See dsd-route-optimization

2. Single-Tier (Plant → DC → Store)

  • Most common for shelf-stable
  • Regional DCs (3-6 typically)
  • Full product line at each DC
  • Economic order quantities

3. Two-Tier (Plant → RDC → Forward DC → Store)

  • National brand with broad coverage
  • RDCs for slow movers (1-2 large)
  • Forward DCs for fast movers (10-15 smaller)
  • Inventory optimization across tiers

4. Hybrid (Multiple Strategies)

  • Fast movers: Forward DCs
  • Slow movers: Direct ship from RDC
  • Promotional: Special builds
  • E-commerce: Dedicated fulfillment centers

Network Design Models

CPG Facility Location Model

from pulp import *
import pandas as pd
import numpy as np
from scipy.spatial.distance import cdist

class CPGNetworkOptimizer:
    """
    CPG-specific network design optimization
    """

    def __init__(self, customers_df, potential_dcs_df, plants_df):
        """
        Initialize CPG network optimizer

        Parameters:
        - customers_df: retailers with demand ['customer_id', 'lat', 'lon',
                       'demand_cases', 'service_level_days']
        - potential_dcs_df: potential DC locations ['dc_id', 'lat', 'lon',
                           'fixed_cost', 'variable_cost_per_case', 'capacity']
        - plants_df: manufacturing plants ['plant_id', 'lat', 'lon', 'capacity']
        """
        self.customers = customers_df
        self.dcs = potential_dcs_df
        self.plants = plants_df

        # Calculate distance matrices
        self.dc_to_customer_dist = self._calc_distances(
            self.dcs[['lat', 'lon']],
            self.customers[['lat', 'lon']]
        )

        self.plant_to_dc_dist = self._calc_distances(
            self.plants[['lat', 'lon']],
            self.dcs[['lat', 'lon']]
        )

    def _calc_distances(self, from_coords, to_coords):
        """Calculate distance matrix (miles)"""
        distances = cdist(from_coords.values, to_coords.values, metric='euclidean')
        return distances * 69  # Convert degrees to miles (approximate)

    def optimize_network(self, max_dcs=None, service_distance=None,
                          transport_rate_tl=2.50, transport_rate_ltl=25.0):
        """
        Optimize CPG distribution network

        Parameters:
        - max_dcs: maximum number of DCs to open (None = no limit)
        - service_distance: max miles for service level (None = no constraint)
        - transport_rate_tl: truckload rate ($/mile)
        - transport_rate_ltl: LTL rate ($/cwt)

        Returns:
        - optimal network configuration
        """

        prob = LpProblem("CPG_Network", LpMinimize)

        # Decision variables
        C = range(len(self.customers))
        D = range(len(self.dcs))
        P = range(len(self.plants))

        # y[d] = 1 if DC d is opened
        y = LpVariable.dicts("DC_Open", D, cat='Binary')

        # x[c,d] = flow from DC d to customer c (cases)
        x = LpVariable.dicts("Customer_Flow",
                              [(c,d) for c in C for d in D],
                              lowBound=0)

        # z[p,d] = flow from plant p to DC d (cases)
        z = LpVariable.dicts("DC_Flow",
                              [(p,d) for p in P for d in D],
                              lowBound=0)

        # Objective: Minimize total cost
        objective = 0

        # Fixed DC costs
        for d in D:
            objective += self.dcs.iloc[d]['fixed_cost'] * y[d]

        # DC variable costs
        for c in C:
            for d in D:
                handling_cost = self.dcs.iloc[d]['variable_cost_per_case']
                objective += x[c,d] * handling_cost

        # Outbound transportation (DC → Customer)
        for c in C:
            for d in D:
                distance = self.dc_to_customer_dist[d,c]
                demand = self.customers.iloc[c]['demand_cases']

                # Simplified: LTL for = self.customers.iloc[c]['demand_cases']

        # 2. DC capacity constraints
        for d in D:
            prob += lpSum([x[c,d] for c in C]) = outbound

        # 4. Plant capacity constraints
        for p in P:
            prob += lpSum([z[p,d] for d in D])  service_distance:
                        prob += x[c,d] == 0

        # 6. Maximum number of DCs (optional)
        if max_dcs:
            prob += lpSum([y[d] for d in D])  0.5
        ]

        # Customer assignments
        assignments = []
        for c in C:
            for d in D:
                if x[c,d].varValue > 0.01:
                    assignments.append({
                        'customer': self.customers.iloc[c]['customer_id'],
                        'dc': self.dcs.iloc[d]['dc_id'],
                        'flow': x[c,d].varValue,
                        'distance': self.dc_to_customer_dist[d,c]
                    })

        # Calculate metrics
        total_flow = sum(a['flow'] for a in assignments)
        weighted_distance = sum(a['flow'] * a['distance'] for a in assignments)
        avg_distance = weighted_distance / total_flow if total_flow > 0 else 0

        return {
            'status': 'optimal',
            'total_cost': value(prob.objective),
            'num_dcs': len(open_dcs),
            'open_dcs': open_dcs,
            'assignments': pd.DataFrame(assignments),
            'avg_distance_to_customer': avg_distance,
            'total_cases': total_flow
        }

# Example usage
customers = pd.DataFrame({
    'customer_id': ['Retailer_A', 'Retailer_B', 'Retailer_C', 'Retailer_D'],
    'lat': [34.05, 41.88, 39.74, 29.76],
    'lon': [-118.24, -87.63, -104.99, -95.37],
    'demand_cases': [50000, 75000, 40000, 60000],
    'service_level_days': [3, 3, 3, 3]
})

potential_dcs = pd.DataFrame({
    'dc_id': ['DC_West', 'DC_Central', 'DC_South', 'DC_East'],
    'lat': [36.17, 39.10, 33.75, 40.71],
    'lon': [-115.14, -94.58, -84.39, -74.01],
    'fixed_cost': [2000000, 1800000, 1900000, 2500000],
    'variable_cost_per_case': [1.50, 1.35, 1.40, 1.60],
    'capacity': [150000, 200000, 150000, 180000]
})

plants = pd.DataFrame({
    'plant_id': ['Plant_1', 'Plant_2'],
    'lat': [41.50, 34.00],
    'lon': [-90.00, -118.00],
    'capacity': [300000, 250000]
})

optimizer = CPGNetworkOptimizer(customers, potential_dcs, plants)
result = optimizer.optimize_network(max_dcs=3, service_distance=500)

print(f"Status: {result['status']}")
print(f"Total Cost: ${result['total_cost']:,.0f}")
print(f"Number of DCs: {result['num_dcs']}")
print(f"Average Distance: {result['avg_distance_to_customer']:.0f} miles")

Service Level Modeling

Days-to-Market Analysis

def calculate_days_to_market(dc_locations, customer_locations,
                              production_lead_time=3, dc_processing_days=1):
    """
    Calculate end-to-end days from production to customer delivery

    Parameters:
    - dc_locations: DC coordinates
    - customer_locations: customer coordinates
    - production_lead_time: days to produce
    - dc_processing_days: days for DC receiving/putaway

    Returns:
    - service time analysis
    """

    from scipy.spatial.distance import cdist

    # Calculate distances
    distances = cdist(
        dc_locations[['lat', 'lon']].values,
        customer_locations[['lat', 'lon']].values,
        metric='euclidean'
    ) * 69  # miles

    # Transportation time (miles → days)
    # Assume:  0:
            strategy = 'forward_deploy'
            locations = dc_network['num_forward_dcs']
        else:
            strategy = 'centralize'
            locations = 1  # Keep at RDC only

        sku_strategy.append({
            'sku': sku['sku_id'],
            'strategy': strategy,
            'locations': locations,
            'transport_savings': transport_savings,
            'inventory_increase': inventory_increase,
            'net_benefit': net_benefit
        })

    return pd.DataFrame(sku_strategy)

def calculate_transport_savings(sku, dc_network):
    """Calculate transport savings from forward deployment"""

    # Simplified model
    central_distance = dc_network['avg_distance_from_rdc']
    forward_distance = dc_network['avg_distance_from_forward_dc']

    distance_savings = central_distance - forward_distance

    # Annual shipments
    shipments_per_year = sku['annual_demand'] / sku['order_size']

    # Cost per shipment
    cost_per_mile = 2.50
    cost_savings = shipments_per_year * distance_savings * cost_per_mile

    return cost_savings

Performance Metrics

CPG Network KPIs

class CPGNetworkMetrics:
    """
    Track CPG network performance metrics
    """

    def __init__(self, network_data):
        self.data = network_data

    def calculate_kpis(self):
        """Calculate comprehensive network KPIs"""

        kpis = {}

        # Cost metrics
        kpis['total_network_cost'] = self._total_network_cost()
        kpis['cost_per_case'] = kpis['total_network_cost'] / self.data['total_cases']

        # Cost breakdown
        kpis['cost_breakdown'] = {
            'fixed_dc_costs': self._fixed_dc_costs(),
            'variable_dc_costs': self._variable_dc_costs(),
            'inbound_transport': self._inbound_transport_cost(),
            'outbound_transport': self._outbound_transport_cost(),
            'inventory_carrying': self._inventory_carrying_cost()
        }

        # Service metrics
        kpis['avg_distance_to_customer'] = self._avg_distance()
        kpis['2_day_service_pct'] = self._service_coverage(max_distance=500)
        kpis['3_day_service_pct'] = self._service_coverage(max_distance=750)

        # Efficiency metrics
        kpis['dc_utilization'] = self._dc_utilization()
        kpis['cases_per_dc'] = self.data['total_cases'] / self.data['num_dcs']

        # Inventory metrics
        kpis['total_inventory_value'] = self._total_inventory()
        kpis['inventory_turns'] = self._inventory_turns()
        kpis['days_of_supply'] = 365 / kpis['inventory_turns']

        return kpis

    def _total_network_cost(self):
        """Total annual network cost"""
        return sum(self.data['cost_breakdown'].values())

    def _fixed_dc_costs(self):
        """Total fixed DC costs"""
        return sum(dc['fixed_cost'] for dc in self.data['dcs'])

    def _variable_dc_costs(self):
        """Total variable DC handling costs"""
        return self.data['total_cases'] * self.data['avg_variable_cost_per_case']

    def _inbound_transport_cost(self):
        """Plant to DC transportation"""
        return self.data.get('inbound_transport_cost', 0)

    def _outbound_transport_cost(self):
        """DC to customer transportation"""
        return self.data.get('outbound_transport_cost', 0)

    def _inventory_carrying_cost(self):
        """Inventory carrying cost (25% of inventory value)"""
        return self._total_inventory() * 0.25

    def _avg_distance(self):
        """Average distance from DC to customer"""
        return self.data['weighted_avg_distance']

    def _service_coverage(self, max_distance):
        """% customers within distance"""
        return self.data['service_coverage'].get(max_distance, 0)

    def _dc_utilization(self):
        """Average DC capacity utilization"""
        return self.data['total_cases'] / sum(dc['capacity'] for dc in self.data['dcs'])

    def _total_inventory(self):
        """Total inventory value in network"""
        return self.data.get('total_inventory_value', 0)

    def _inventory_turns(self):
        """Inventory turnover ratio"""
        annual_cogs = self.data.get('annual_cogs', 0)
        avg_inventory = self._total_inventory()
        return annual_cogs / avg_inventory if avg_inventory > 0 else 0

# CPG Network Benchmarks
cpg_benchmarks = {
    'cost_per_case': {
        'best_in_class': 2.50,
        'average': 3.50,
        'poor': 5.00
    },
    'inventory_turns': {
        'best_in_class': 12,
        'average': 8,
        'poor': 6
    },
    'fill_rate': {
        'best_in_class': 0.99,
        'average': 0.96,
        'poor': 0.92
    },
    'on_time_delivery': {
        'best_in_class': 0.98,
        'average': 0.95,
        'poor': 0.90
    }
}

Tools & Technologies

CPG Network Design Software

Commercial:

  • Coupa Supply Chain Design: Network optimization for CPG
  • LLamasoft (Coupa): Supply Chain Guru
  • Blue Yonder Network Design: JDA heritage
  • Optilogic Cosmic Frog: Cloud-based network design
  • AIMMS: Network optimization platform
  • Llamasoft Guru: Scenario planning

Analytics Platforms:

  • Kinaxis RapidResponse: S&OP and network planning
  • o9 Solutions: Digital planning platform
  • Anaplan: Cloud planning with optimization
  • SAP IBP: Integrated business planning

Python Libraries

# Network optimization
from pulp import *
import pyomo.environ as pyo

# Geospatial analysis
import geopandas as gpd
from shapely.geometry import Point
from scipy.spatial import distance_matrix

# Optimization solvers
from ortools.linear_solver import pywraplp
import gurobipy as gp

# Data analysis
import pandas as pd
import numpy as np

# Visualization
import plotly.express as px
import folium
import matplotlib.pyplot as plt

Common Challenges & Solutions

Challenge: High SKU Complexity

Problem:

  • 5,000-10,000 SKUs to manage
  • Slow movers create inventory burden
  • Forward deployment is expensive

Solutions:

  • ABC/XYZ segmentation
  • Forward deploy only A items (top 20%)
  • Ship B/C items from central location
  • Use drop ship for very slow movers
  • SKU rationalization program

Challenge: Promotional Variability

Problem:

  • Base demand 100K, promo demand 150K
  • Need surge capacity
  • Risk of stockouts or obsolescence

Solutions:

  • Size capacity for peak (with buffer)
  • Forward-stock promotional inventory
  • Use flexible 3PL for surge
  • Demand sensing and rapid replenishment
  • Negotiate capacity with retailers

Challenge: Omnichannel Complexity

Problem:

  • Retail needs cases, e

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet — be the first.

Versions

  • v0.1.0 Imported from the upstream source.