Skip to content

factory layout optimization using Genetic Algorithm for maximizing production efficiency and minimizing material flow distance

License

Notifications You must be signed in to change notification settings

imjeasung/Factory-Layout-Optimizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

23 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🏭 Factory Layout Optimizer | 곡μž₯ λ ˆμ΄μ•„μ›ƒ μ΅œμ ν™” μ‹œμŠ€ν…œ

Python License Matplotlib Genetic Algorithm

English | ν•œκ΅­μ–΄

🎯 Overview

An AI-powered factory layout optimization system using Genetic Algorithm (GA) to maximize production efficiency while minimizing material flow distances. This system intelligently arranges 16 manufacturing equipment units in a linear 16-step production sequence to achieve optimal throughput and workflow efficiency.

πŸ”₯ Key Results

Our genetic algorithm successfully optimized a real factory layout with 16 equipment units (ID 0-15) over 300 generations:

  • 🎯 Target Production: 35 units/hour
  • ⚑ Optimized Throughput: Achieved target with minimal distance
  • πŸ”„ Convergence: Stable optimization over 300 generations
  • πŸ“Š Multi-objective: Balanced production rate vs. material flow distance
  • 🎨 Visual Analytics: Comprehensive performance tracking and layout visualization

✨ Key Features

  • 🧬 Advanced Genetic Algorithm: N populations Γ— N generations evolutionary optimization
  • 🎯 Multi-objective Optimization: Balances production throughput (35 units/hour) and material flow distance
  • πŸ“Š Real-time Visualization: Interactive layout visualization with performance analytics
  • βš™οΈ Constraint Handling: Equipment footprint, clearance zones, and spatial constraints
  • πŸ“ˆ Progress Monitoring: Generation-wise fitness evolution and convergence analysis
  • πŸ”§ Flexible Configuration: Customizable equipment definitions and process sequences

πŸš€ Quick Start

Prerequisites

pip install matplotlib numpy

Installation & Usage

git clone https://github.com/imjeasung/Factory-Layout-Optimizer.git
cd Factory-Layout-Optimizer
python GA_Facility_Optimizer.py

πŸ“Š Results & Visualizations

🏭 Optimized Factory Layout

Optimized Layout

🎨 Interactive Factory Layout Visualization

Layout Features:

  • πŸ“ Equipment Arrangement: 16 machines (ID 0-15) optimally positioned in 19Γ—19 grid
  • 🌈 Color-coded Identification: Each equipment unit with unique color visualization
  • πŸ”’ Safety Clearance Zones: Automated clearance space management
  • πŸ”„ Optimized Flow Paths: Minimized inter-equipment material transport distances
  • πŸ“ Spatial Constraints: Intelligent footprint management and collision avoidance

🚚 Optimized Material Flow Path Visualization

Optimized Paths

🎨 Visualization of Optimized Material Flow Paths

Path Details:

  • πŸ“œ Script Used: path_visualizer.py
  • 🧠 Algorithm: Utilizes A* search to find optimal paths between sequential machines.
  • ↔️ Continuous Flow: Visualizes the "one-stroke" or continuous path for material handling, minimizing travel interruptions.
  • πŸ“„ Input Data: Requires optimized_layout_data.json (generated by GA_Facility_Optimizer.py) which contains the optimized layout and machine sequence.
  • 🎯 Objective: To clearly show the actual travel routes for materials/AGVs post-layout optimization, aiding in identifying potential bottlenecks or inefficiencies in flow.

πŸ“ˆ Comprehensive Performance Analysis

Performance Analysis

πŸ“Š Multi-dimensional Algorithm Performance Tracking

Analysis Dashboard Includes:

  • πŸ“ˆ Fitness Evolution Curve: Real-time convergence tracking over 300 generations
  • πŸ“ Distance Optimization Progress: Material flow distance minimization trends
  • ⚑ Throughput Performance: Production rate optimization and target achievement
  • βœ… Population Validity Metrics: Solution feasibility and constraint satisfaction rates
  • 🎯 Multi-objective Balance: Trade-off analysis between competing objectives

πŸ›  Technical Specifications

Algorithm Parameters

  • Population Size: 100 individuals per generation
  • Generations: 300 iterations
  • Mutation Rate: 0.3 (30%)
  • Crossover Rate: 0.8 (80%)
  • Elite Preservation: Top 5 individuals per generation
  • Tournament Selection: Size 5

Optimization Objectives

  1. 🎯 Maximize Throughput: Target 35 units/hour production rate
  2. πŸ“ Minimize Distance: Reduce material flow distances between equipment
  3. βœ… Constraint Satisfaction: Ensure spatial and operational constraints

Factory Configuration

  • πŸ“ Factory Dimensions: 19Γ—19 grid units
  • πŸ—οΈ Equipment Count: 16 manufacturing stations
  • πŸ”„ Process Sequence: Linear 16-step production flow
  • ⚑ Material Transport Speed: 0.5 units/second

πŸŽ›οΈ Equipment Specifications

ID Equipment Name Footprint Cycle Time Clearance
0 μ›μžμž¬_νˆ¬μž… 2Γ—2 20s 1 unit
1 1μ°¨_μ ˆμ‚­ 3Γ—3 35s 1 unit
2 밀링_가곡 4Γ—2 45s 1 unit
3 λ“œλ¦΄λ§ 2Γ—2 25s 1 unit
4 μ—΄μ²˜λ¦¬_A 3Γ—4 70s 2 units
5 μ •λ°€_가곡_A 3Γ—2 40s 1 unit
6 쑰립_A 2Γ—3 55s 2 units
7 μ΅œμ’…_검사_A 1Γ—2 15s 1 unit
8 2μ°¨_μ ˆμ‚­ 3Γ—2 30s 1 unit
9 ν‘œλ©΄_처리 2Γ—4 50s 2 units
10 μ„Έμ²™_곡정_1 2Γ—2 20s 1 unit
11 μ—΄μ²˜λ¦¬_B 4Γ—4 75s 2 units
12 μ •λ°€_가곡_B 2Γ—3 42s 1 unit
13 λΆ€ν’ˆ_쑰립 3Γ—3 60s 1 unit
14 ν’ˆμ§ˆ_검사_B 2Γ—1 18s 1 unit
15 포μž₯_라인_A 4Γ—3 30s 2 units

πŸ“ˆ Performance Metrics

Fitness Function

fitness = (THROUGHPUT_WEIGHT Γ— throughput) - (DISTANCE_WEIGHT Γ— total_distance)

Optimization Weights:

  • THROUGHPUT_WEIGHT: 1.0
  • DISTANCE_WEIGHT: 0.005
  • BONUS_ACHIEVEMENT: 0.2 (when target reached)

Achieved Results

  • 🎯 Production Target: 35 units per hour βœ…
  • πŸ“ Material Transport Speed: 0.5 units per second
  • ⚑ Algorithm Convergence: Stable optimization after ~150 generations
  • βœ… Solution Validity: >90% valid solutions maintained throughout evolution
  • πŸ”„ Consistency: Reproducible results across multiple runs

πŸ”§ Customization Guide

Equipment Configuration

machines_definitions = [
    {"id": 0, "name": "μ›μžμž¬_νˆ¬μž…", "footprint": (2, 2), "cycle_time": 20, "clearance": 1},
    {"id": 1, "name": "1μ°¨_μ ˆμ‚­", "footprint": (3, 3), "cycle_time": 35, "clearance": 1},
    # Add more equipment definitions...
]

Process Sequence

PROCESS_SEQUENCE = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]  # Linear 16-step

Factory Dimensions

FACTORY_WIDTH = 19
FACTORY_HEIGHT = 19

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.


Korean Section

🏭 곡μž₯ λ ˆμ΄μ•„μ›ƒ μ΅œμ ν™” μ‹œμŠ€ν…œ

🎯 ν”„λ‘œμ νŠΈ κ°œμš”

μœ μ „ μ•Œκ³ λ¦¬μ¦˜(GA)을 ν™œμš©ν•˜μ—¬ 16개 μ„€λΉ„μ˜ μ„ ν˜• 16단계 곡정을 μ΅œμ ν™”ν•˜λŠ” AI μ‹œμŠ€ν…œμž…λ‹ˆλ‹€. 생산 νš¨μœ¨μ„±μ„ κ·ΉλŒ€ν™”ν•˜λ©΄μ„œ λ¬Όλ₯˜ 동선을 μ΅œμ†Œν™”ν•˜μ—¬ 졜적의 μ„€λΉ„ 배치λ₯Ό μ°Ύμ•„μ€λ‹ˆλ‹€.

πŸ”₯ μ£Όμš” μ„±κ³Ό

ID 15λ²ˆκΉŒμ§€μ˜ μ„€λΉ„λ‘œ κ΅¬μ„±λœ μ‹€μ œ 곡μž₯ λ ˆμ΄μ•„μ›ƒμ„ 300μ„ΈλŒ€μ— 걸쳐 μ„±κ³΅μ μœΌλ‘œ μ΅œμ ν™”:

  • 🎯 λͺ©ν‘œ μƒμ‚°λŸ‰: μ‹œκ°„λ‹Ή 35개
  • ⚑ μ΅œμ ν™”λœ μ²˜λ¦¬λŸ‰: λͺ©ν‘œ 달성 및 거리 μ΅œμ†Œν™”
  • πŸ”„ μˆ˜λ ΄μ„±: 300μ„ΈλŒ€μ— 걸친 μ•ˆμ •μ  μ΅œμ ν™”
  • πŸ“Š 닀쀑 λͺ©ν‘œ: μƒμ‚°μœ¨ vs λ¬Όλ₯˜ 거리 κ· ν˜•

μ£Όμš” κΈ°λŠ₯

  • 🧬 κ³ κΈ‰ μœ μ „ μ•Œκ³ λ¦¬μ¦˜: 300개체 Γ— 300μ„ΈλŒ€ μ§„ν™” μ΅œμ ν™”
  • 🎯 닀쀑 λͺ©ν‘œ μ΅œμ ν™”: μƒμ‚°λŸ‰(μ‹œκ°„λ‹Ή 35개)κ³Ό 이동 거리 λ™μ‹œ κ³ λ €
  • πŸ“Š μ‹€μ‹œκ°„ μ‹œκ°ν™”: μ„±λŠ₯ 뢄석이 ν¬ν•¨λœ λŒ€ν™”ν˜• λ ˆμ΄μ•„μ›ƒ μ‹œκ°ν™”
  • βš™οΈ μ œμ•½ 쑰건 처리: μ„€λΉ„ 크기, ν΄λ¦¬μ–΄λŸ°μŠ€, 곡간 μ œμ•½ κ³ λ €
  • πŸ“ˆ μ§„ν–‰ 상황 λͺ¨λ‹ˆν„°λ§: μ„ΈλŒ€λ³„ 적합도 μ§„ν™” 및 수렴 뢄석
  • πŸ”§ μœ μ—°ν•œ μ„€μ •: μ„€λΉ„ μ •μ˜ 및 곡정 μˆœμ„œ μ»€μŠ€ν„°λ§ˆμ΄μ§•

πŸ“Š κ²°κ³Ό 및 μ‹œκ°ν™”

🏭 μ΅œμ ν™”λœ 곡μž₯ λ ˆμ΄μ•„μ›ƒ

16개 μ„€λΉ„(ID 0-15)κ°€ 졜적 배치된 결과둜, 각 μ„€λΉ„λŠ” 고유 μƒ‰μƒμœΌλ‘œ κ΅¬λΆ„λ˜λ©° ν΄λ¦¬μ–΄λŸ°μŠ€ μ˜μ—­κ³Ό λ¬Όλ₯˜ 흐름이 μ΅œμ ν™”λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

πŸ“ˆ μ„±λŠ₯ 뢄석

300μ„ΈλŒ€μ— 걸친 적합도 μ§„ν™”, 거리 μ΅œμ ν™”, μ²˜λ¦¬λŸ‰ 뢄석, λͺ¨μ§‘단 μœ νš¨μ„± 등을 μ’…ν•©μ μœΌλ‘œ λΆ„μ„ν•œ κ²°κ³Όλ₯Ό μ œκ³΅ν•©λ‹ˆλ‹€.

πŸ›  기술 사양

μ•Œκ³ λ¦¬μ¦˜ λ§€κ°œλ³€μˆ˜

  • 집단 크기: μ„ΈλŒ€λ‹Ή 100개 개체
  • μ„ΈλŒ€ 수: 300회 반볡
  • λ³€μ΄μœ¨: 0.3 (30%)
  • ꡐ차율: 0.8 (80%)
  • μ—˜λ¦¬νŠΈ 보쑴: μ„ΈλŒ€λ‹Ή μƒμœ„ 5개 개체

μ΅œμ ν™” λͺ©ν‘œ

  1. 🎯 μƒμ‚°λŸ‰ μ΅œλŒ€ν™”: μ‹œκ°„λ‹Ή 35개 λͺ©ν‘œ μƒμ‚°μœ¨
  2. πŸ“ 거리 μ΅œμ†Œν™”: μ„€λΉ„ κ°„ λ¬Όλ₯˜ 이동 거리 단좕
  3. βœ… μ œμ•½ 쑰건 만쑱: 곡간 및 운영 μ œμ•½ 쑰건 μ€€μˆ˜

πŸš€ μ‚¬μš©λ²•

ν™˜κ²½ μ„€μ •

pip install matplotlib numpy

μ‹€ν–‰ 방법

git clone https://github.com/imjeasung/Factory-Layout-Optimizer.git
cd Factory-Layout-Optimizer
python GA_Facility_Optimizer.py

πŸ”§ μ»€μŠ€ν„°λ§ˆμ΄μ§•

ν”„λ‘œμ νŠΈμ˜ μ„€λΉ„ ꡬ성, 곡정 μˆœμ„œ, 곡μž₯ 크기 등을 ν•„μš”μ— 따라 μˆ˜μ •ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

🀝 κΈ°μ—¬ν•˜κΈ°

Pull requestsλ₯Ό ν™˜μ˜ν•©λ‹ˆλ‹€! μ£Όμš” λ³€κ²½μ‚¬ν•­μ˜ 경우 λ¨Όμ € 이슈λ₯Ό μ—΄μ–΄ λ…Όμ˜ν•΄ μ£Όμ„Έμš”.

πŸ“ λΌμ΄μ„ μŠ€

이 ν”„λ‘œμ νŠΈλŠ” MIT λΌμ΄μ„ μŠ€ ν•˜μ— μžˆμŠ΅λ‹ˆλ‹€. μžμ„Έν•œ λ‚΄μš©μ€ LICENSE νŒŒμΌμ„ μ°Έμ‘°ν•˜μ„Έμš”.

πŸ‘¨β€πŸ’» 개발자

Made with ❀️ by imjeasung


🌟 Star this repo if you find it useful!

About

factory layout optimization using Genetic Algorithm for maximizing production efficiency and minimizing material flow distance

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages