← Back to Portfolio

ShipGen - AI Ship Designer

Maritime Engineering

AI-powered ship layout designer using WARGEAR algorithms from TU Delft with LLM strategic planning and maritime compliance.

Python FastAPI WebGL LLM WARGEAR

title: ShipGen - AI-Powered Ship Layout Designer slug: shipgen-ai-ship-designer description: Automated general arrangement generator with LLM strategic planning and maritime compliance status: Product published: published category: AI & Machine Learning technologies: - Python - FastAPI - WebGL - LLM - WARGEAR github: https://github.com/macleodlabs/shipgen date: 2025-01-15 featured: true hero: false

ShipGen - AI-Powered Ship Layout Designer

Transform natural language requirements into complete 3D ship layouts in minutes instead of ~150 engineer-hours.

ShipGen Multi-Deck Visualization Real-time 3D visualization of generated ship layouts with multi-deck support

Problem Statement

Traditional ship design requires:

ShipGen automates this using WARGEAR algorithms (TU Delft 2022) + LLM strategic planning.

The WARGEAR Foundation

ShipGen builds upon the WARGEAR (Weighted A* Rule-based GEneral ARrangement) methodology developed by Nick de Jong and Austin A. Kana at TU Delft's Ocean Engineering department (2022).

Original WARGEAR Contributions

Key Papers:

Core Innovations from WARGEAR:

  1. Physics-Based Space Allocation

    • Gaussian attraction/repulsion fields for spatial relationships
    • Simulated annealing for global optimization
    • Multi-objective fitness functions
  2. Rule-Based Constraint System

    • Adjacency requirements (e.g., galley near mess)
    • Distance constraints (e.g., machinery away from accommodation)
    • Accessibility requirements (fire escape routes)
  3. Corridor Generation

    • A* pathfinding with maritime constraints
    • Minimum width requirements (1.2m SOLAS)
    • Redundant escape route generation

Our Improvements Over WARGEAR

ShipGen Requirements Studio Interactive requirements studio with natural language rule compilation

1. LLM-Powered Strategic Planning

WARGEAR operated purely on rule-based heuristics. We added AI strategic planning that analyzes requirements before placement:

WARGEAR: Rules → Field Generation → Placement
ShipGen: Rules → LLM Analysis → Strategic Plan → Field Generation → Placement

The LLM layer provides:

2. Natural Language Interface

WARGEAR required structured constraint definitions. ShipGen accepts plain English:

WARGEAR:
  constraint: ADJACENT_TO("galley", "mess", max_distance=5.0)

ShipGen:
  "The galley must be adjacent to the mess"
  → LLM compiles → Same structured constraint

3. Maritime Compliance Integration

WARGEAR had generic rules. We integrated 50+ actual regulations:

Maritime Compliance Dashboard Automated checking against SOLAS, IEC, ISO, and ABS standards

4. Multi-Deck Equipment Handling

WARGEAR assumed single-deck placement. We added vertical space management:

5. Real-Time Visualization

WARGEAR output static diagrams. ShipGen provides:

6. Hull Constraint Integration

Hull Variant Selection Pre-loaded hull geometries: KCS-Wide, KCS-150, PCTC-Lean

WARGEAR used rectangular boundaries. We integrated actual hull geometries:

7. Equipment Database

50+ machinery specifications with real dimensions, weight, power consumption:

{
  "MAN_6L32_engine": {
    "length": 5.2, "width": 2.8, "height": 6.5,
    "weight_tons": 48,
    "cooling_kw": 450,
    "vibration_class": "A",
    "noise_db": 95
  }
}

Architecture

graph LR
    subgraph "Input Layer"
        REQ[Requirements Studio<br/>Natural Language]
        HULL[Hull Library<br/>KCS, PCTC]
        RULES[Maritime Rules<br/>SOLAS/IEC/ISO]
    end
    
    subgraph "AI Strategic Planning"
        LLM[LLM Planner<br/>Claude/GPT-4]
        PLAN[Spatial Strategy<br/>Before Placement]
    end
    
    subgraph "WARGEAR Engine"
        ALLOC[Space Allocation<br/>Field-Based]
        CORR[Corridor Generation<br/>A* Routing]
        MEP[MEP Systems<br/>HVAC, Plumbing]
    end
    
    subgraph "Output Layer"
        VIZ[3D Viewer<br/>Multi-Deck]
        EXPORT[Export<br/>IFC, GLTF, OCX]
    end
    
    REQ --> LLM
    HULL --> ALLOC
    RULES --> LLM
    LLM --> PLAN
    PLAN --> ALLOC
    ALLOC --> CORR
    CORR --> MEP
    MEP --> VIZ
    VIZ --> EXPORT

Core Algorithm: Enhanced WARGEAR Space Allocation

Spatial Field Visualization Attraction/repulsion fields guiding space placement

Field-Based Attraction/Repulsion (Enhanced from original):

def calculate_spatial_field(space: Space, constraints: List[Rule]):
    """
    Generate attraction/repulsion field for space placement
    using physics-based simulation.
    """
    field = np.zeros((deck_length, deck_width))
    
    # Attraction to preferred locations
    for constraint in constraints:
        if constraint.type == "adjacent_to":
            target = get_space_center(constraint.target)
            field += gaussian_attraction(target, strength=10.0)
        
        elif constraint.type == "min_distance":
            target = get_space_center(constraint.target)
            field += gaussian_repulsion(target, 
                                       distance=constraint.distance,
                                       strength=15.0)
    
    # Boundary repulsion (hull shape)
    field += hull_boundary_repulsion(hull_geometry)
    
    # Regulatory constraints (fire zones, escape routes)
    field += regulation_constraints(space.type, maritime_rules)
    
    return field

Placement Algorithm:

def place_spaces_iteratively(spaces: List[Space], hull: Hull):
    """
    Iterative placement using simulated annealing
    to find optimal configuration.
    """
    placed = []
    temperature = 1000.0
    
    # Sort by priority (critical spaces first)
    spaces.sort(key=lambda s: s.priority, reverse=True)
    
    for space in spaces:
        field = calculate_spatial_field(space, space.constraints)
        
        # Find best position using gradient descent
        best_pos = None
        best_score = -inf
        
        for attempt in range(100):
            pos = sample_position(field, temperature)
            score = evaluate_position(pos, space, placed, hull)
            
            if score > best_score:
                best_score = score
                best_pos = pos
        
        if best_score > threshold:
            space.position = best_pos
            placed.append(space)
            temperature *= 0.95  # Cooling schedule
    
    return placed

LLM Strategic Planning

Before placement, AI analyzes requirements:

Input: "Design a 120m RoRo ferry with 500 passengers"

AI Strategic Plan:
┌─────────────────────────────────────────────┐
│ 1. Deck Assignment Strategy                │
│    - Deck 1: Vehicle deck (80% area)       │
│    - Deck 2-3: Passenger areas             │
│    - Deck 4: Bridge + technical            │
│                                             │
│ 2. Zoning Principles                       │
│    - Fore: Navigation + wheelhouse         │
│    - Mid: Public spaces + accommodation    │
│    - Aft: Machinery + technical            │
│                                             │
│ 3. Regulatory Priorities                   │
│    - SOLAS fire zones every 40m            │
│    - Two independent escape routes         │
│    - Galley isolated from accommodation    │
│                                             │
│ 4. Constraint Resolution                   │
│    - Machinery noise: 25m buffer zone      │
│    - Wet spaces: Group for plumbing        │
│    - Public areas: Natural light access    │
└─────────────────────────────────────────────┘

Maritime Compliance Engine

50+ Regulations Automated:

MARITIME_RULES = {
    "SOLAS_II-2_5.2": {
        "category": "Fire Safety",
        "rule": "Vertical fire zones max 40m length",
        "check": lambda layout: check_fire_zones(layout, max_length=40),
        "applies_to": ["passenger_ships", "cargo_ships"],
        "severity": "critical"
    },
    
    "IEC_60092-507": {
        "category": "Electrical",
        "rule": "Emergency power within 45 seconds",
        "check": lambda layout: verify_emergency_power(layout),
        "applies_to": ["all_vessels"],
        "severity": "high"
    },
    
    "ISO_8861": {
        "category": "HVAC",
        "rule": "Accommodation ventilation ≥6 air changes/hour",
        "check": lambda layout: check_ventilation_rate(layout, min_rate=6),
        "applies_to": ["accommodation_spaces"],
        "severity": "medium"
    }
}

def validate_compliance(layout: Layout) -> ComplianceReport:
    violations = []
    
    for rule_id, rule in MARITIME_RULES.items():
        if applies_to_vessel(rule, layout.vessel_type):
            if not rule["check"](layout):
                violations.append({
                    "rule": rule_id,
                    "severity": rule["severity"],
                    "description": rule["rule"],
                    "affected_spaces": find_affected_spaces(layout, rule)
                })
    
    return ComplianceReport(violations)

Multi-Deck Routing

A Pathfinding for Corridors:*

def generate_corridor_network(spaces: List[Space], decks: List[Deck]):
    """
    Connect spaces with efficient corridor network
    using A* with maritime constraints.
    """
    graph = NetworkGraph()
    
    # Add nodes for space entrances
    for space in spaces:
        graph.add_node(space.entrance, deck=space.deck)
    
    # Add stairwell connections between decks
    for stairwell in layout.stairwells:
        for deck1, deck2 in zip(decks[:-1], decks[1:]):
            graph.add_edge(
                (stairwell.pos, deck1),
                (stairwell.pos, deck2),
                weight=3.0  # Vertical travel cost
            )
    
    # Find shortest paths between critical spaces
    for src, dst in required_connections:
        path = astar_maritime(
            graph, src, dst,
            heuristic=manhattan_distance,
            constraints=[
                avoid_machinery_zones,
                min_corridor_width(1.2),  # SOLAS minimum
                fire_escape_redundancy
            ]
        )
        
        corridors.append(Corridor(path, width=1.2))
    
    return corridors

Equipment Database Integration

50+ Machinery Specifications:

{
  "equipment": {
    "main_engine_6cyl": {
      "type": "Main Engine",
      "model": "MAN 6L32/44CR",
      "dimensions": {
        "length_m": 5.2,
        "width_m": 2.8,
        "height_m": 6.5
      },
      "weight_tons": 48,
      "power_kw": 3600,
      "fuel_consumption_l_h": 195,
      "cooling_required": true,
      "vibration_isolation": "class_A",
      "deck_span": [1, 2, 3],
      "clearance_requirements": {
        "top_m": 2.0,
        "sides_m": 1.5
      }
    }
  }
}

Interactive Requirements Studio

Web-based design interface:

┌─────────────────────────────────────────────┐
│ 🚢 ShipGen Requirements Studio              │
├─────────────────────────────────────────────┤
│                                             │
│ Vessel Parameters:                          │
│ ├─ Length: 120m                            │
│ ├─ Beam: 24m                               │
│ ├─ Draft: 6.5m                             │
│ └─ Passengers: 500                         │
│                                             │
│ Spaces (12 defined):                        │
│ ├─ Bridge (navigation)          Priority: 10│
│ ├─ Passenger Lounge            Priority: 8 │
│ ├─ Galley (catering)           Priority: 7 │
│ └─ Machinery (engine room)      Priority: 9 │
│                                             │
│ Natural Language Rules:                     │
│ ├─ "Galley adjacent to mess"               │
│ ├─ "Machinery ≥25m from cabins"            │
│ └─ "Group wet spaces for plumbing"         │
│                                             │
│ Maritime Guidelines Applied: 23/50          │
│ ├─ SOLAS Fire Safety        ✓              │
│ ├─ IEC Electrical           ✓              │
│ └─ ISO HVAC                 ✓              │
│                                             │
│ [Generate Layout]  [Preview Fields]         │
└─────────────────────────────────────────────┘

Real-Time 3D Visualization

Multi-deck viewer with WebGL:

Performance Benchmarks

Generation Time Comparison ShipGen vs. traditional manual design time comparison

Vessel Type       | Spaces | Generation Time | Compliance Pass | Manual Time
------------------|--------|-----------------|-----------------|-------------
Small Ferry       | 45     | 12 seconds      | 98%            | 40 hours
RoRo Passenger    | 120    | 35 seconds      | 95%            | 150 hours
Cruise Ship       | 450    | 3.2 minutes     | 92%            | 500+ hours
Cargo Vessel      | 80     | 18 seconds      | 99%            | 60 hours

Comparison with Original WARGEAR:

Metric WARGEAR (2022) ShipGen (2025)
Constraint types 5 15
Natural language input No Yes
Multi-deck support Limited Full
Real-time preview No Yes
Compliance checking Generic 50+ standards
Average generation time 2-5 minutes 12-180 seconds

Comparison Study Side-by-side comparison of layouts generated by original WARGEAR vs. ShipGen

Use Cases

1. Early Design Exploration

Rapidly test 10+ layout variants in hours instead of weeks.

2. Regulatory Compliance

Automated SOLAS/IEC/ISO checking during design, not after.

3. Retrofit Planning

Generate new layouts for vessel refits with existing hull constraints.

4. Design Education

Teaching tool for naval architecture students to understand space allocation.

Technical Stack

Quick Start

cd shipgen_layout
./start.sh

# Access Requirements Studio
open http://localhost:8000/requirements.html

# Generate layout
python generate_layout.py \
  spec_kit/requirements/roro_ferry.json \
  output/layout.json --agentic

AI-powered maritime engineering from MacLeod Labs