site-logistics-optimization
Optimize construction site logistics including material delivery scheduling, crane positioning, storage area allocation, and traffic flow using operations research and simulation.
What this skill does
# Site Logistics Optimization
## Overview
This skill implements optimization algorithms for construction site logistics. Minimize delays, reduce costs, and improve safety through data-driven planning of deliveries, equipment placement, and material storage.
**Optimization Areas:**
- Material delivery scheduling
- Crane and equipment positioning
- Storage area allocation
- Site traffic flow
- Workforce routing
- Just-in-time delivery
## Quick Start
```python
from dataclasses import dataclass
from typing import List, Dict, Tuple
from datetime import datetime, timedelta
import heapq
@dataclass
class Delivery:
delivery_id: str
material_type: str
quantity: float
required_date: datetime
unload_duration_min: int
storage_area: str
priority: int = 1 # 1=highest
@dataclass
class TimeSlot:
start: datetime
end: datetime
is_available: bool = True
delivery_id: str = None
def schedule_deliveries(deliveries: List[Delivery],
slots_per_day: int = 8,
unload_bays: int = 2) -> Dict[str, TimeSlot]:
"""Simple delivery scheduling"""
# Sort by priority and required date
sorted_deliveries = sorted(deliveries, key=lambda d: (d.priority, d.required_date))
schedule = {}
bay_schedules = {i: [] for i in range(unload_bays)}
for delivery in sorted_deliveries:
# Find available slot
target_date = delivery.required_date.replace(hour=8, minute=0)
for bay in range(unload_bays):
# Check if bay has capacity
bay_end = max([s.end for s in bay_schedules[bay]], default=target_date)
if bay_end <= target_date:
slot_start = target_date
else:
slot_start = bay_end
slot_end = slot_start + timedelta(minutes=delivery.unload_duration_min)
# Check if within working hours (8:00-18:00)
if slot_end.hour <= 18:
slot = TimeSlot(
start=slot_start,
end=slot_end,
is_available=False,
delivery_id=delivery.delivery_id
)
bay_schedules[bay].append(slot)
schedule[delivery.delivery_id] = {
'bay': bay,
'slot': slot
}
break
return schedule
# Example
deliveries = [
Delivery("D001", "concrete", 50, datetime(2024, 1, 15, 9, 0), 45, "Zone-A", 1),
Delivery("D002", "rebar", 10, datetime(2024, 1, 15, 10, 0), 30, "Zone-B", 2),
Delivery("D003", "formwork", 20, datetime(2024, 1, 15, 9, 0), 60, "Zone-A", 1),
]
schedule = schedule_deliveries(deliveries)
for d_id, info in schedule.items():
print(f"{d_id}: Bay {info['bay']}, {info['slot'].start.strftime('%H:%M')}-{info['slot'].end.strftime('%H:%M')}")
```
## Comprehensive Logistics Optimization
### Site Layout Model
```python
from dataclasses import dataclass, field
from typing import List, Dict, Tuple, Optional
from datetime import datetime, date, timedelta
from enum import Enum
import numpy as np
from scipy.optimize import linear_sum_assignment
import heapq
class ZoneType(Enum):
CONSTRUCTION = "construction"
STORAGE = "storage"
UNLOADING = "unloading"
STAGING = "staging"
ACCESS = "access"
EQUIPMENT = "equipment"
OFFICE = "office"
@dataclass
class SiteZone:
zone_id: str
zone_type: ZoneType
area_sqm: float
capacity: float # Depends on type (tons, units, etc.)
current_usage: float = 0
position: Tuple[float, float] = (0, 0) # x, y coordinates
access_points: List[Tuple[float, float]] = field(default_factory=list)
restrictions: List[str] = field(default_factory=list)
@dataclass
class Equipment:
equipment_id: str
equipment_type: str # crane, forklift, etc.
max_reach: float # meters
capacity: float # tons
position: Tuple[float, float] = (0, 0)
operating_radius: float = 0
@dataclass
class DeliveryRequest:
request_id: str
material_type: str
quantity: float
unit: str
required_date: date
required_time_window: Tuple[int, int] # (start_hour, end_hour)
unload_duration_min: int
vehicle_type: str
destination_zone: str
priority: int = 1
requires_crane: bool = False
class SiteLogisticsModel:
"""Construction site logistics model"""
def __init__(self, site_name: str):
self.site_name = site_name
self.zones: Dict[str, SiteZone] = {}
self.equipment: Dict[str, Equipment] = {}
self.deliveries: List[DeliveryRequest] = []
self.routes: Dict[str, List[Tuple[float, float]]] = {}
def add_zone(self, zone: SiteZone):
"""Add zone to site"""
self.zones[zone.zone_id] = zone
def add_equipment(self, equipment: Equipment):
"""Add equipment to site"""
self.equipment[equipment.equipment_id] = equipment
def add_delivery(self, delivery: DeliveryRequest):
"""Add delivery request"""
self.deliveries.append(delivery)
def calculate_distance(self, point1: Tuple[float, float],
point2: Tuple[float, float]) -> float:
"""Calculate Euclidean distance"""
return np.sqrt((point1[0] - point2[0])**2 + (point1[1] - point2[1])**2)
def get_zone_distances(self) -> Dict[Tuple[str, str], float]:
"""Calculate distances between all zones"""
distances = {}
zone_ids = list(self.zones.keys())
for i, z1 in enumerate(zone_ids):
for z2 in zone_ids[i+1:]:
dist = self.calculate_distance(
self.zones[z1].position,
self.zones[z2].position
)
distances[(z1, z2)] = dist
distances[(z2, z1)] = dist
return distances
def check_crane_coverage(self, crane_id: str, zone_id: str) -> bool:
"""Check if crane can reach zone"""
crane = self.equipment.get(crane_id)
zone = self.zones.get(zone_id)
if not crane or not zone:
return False
distance = self.calculate_distance(crane.position, zone.position)
return distance <= crane.max_reach
```
### Delivery Scheduling Optimizer
```python
from datetime import datetime, date, timedelta
from typing import List, Dict, Optional
import numpy as np
@dataclass
class ScheduledDelivery:
delivery: DeliveryRequest
scheduled_date: date
scheduled_time: datetime
assigned_bay: str
assigned_crane: Optional[str]
estimated_completion: datetime
class DeliveryScheduler:
"""Optimize delivery scheduling"""
def __init__(self, site: SiteLogisticsModel):
self.site = site
self.schedule: Dict[date, List[ScheduledDelivery]] = {}
self.bay_capacity = 2 # Simultaneous unloading bays
self.working_hours = (7, 18) # 7 AM to 6 PM
def schedule_deliveries(self, deliveries: List[DeliveryRequest],
planning_horizon_days: int = 14) -> List[ScheduledDelivery]:
"""Schedule all deliveries optimally"""
# Sort by priority and required date
sorted_deliveries = sorted(
deliveries,
key=lambda d: (d.priority, d.required_date, -d.quantity)
)
scheduled = []
bay_schedules = {f"bay_{i}": [] for i in range(self.bay_capacity)}
for delivery in sorted_deliveries:
best_slot = self._find_best_slot(delivery, bay_schedules)
if best_slot:
sched = ScheduledDelivery(
delivery=delivery,
scheduled_date=best_slot['date'],
scheduled_time=best_slot['start_time'],
assigned_bay=best_slot['bay'],
assigned_crane=best_slot.get('crane'),
estimated_completion=best_slot['end_time']
)
scheduled.append(sched)
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.