LogoLogo
  • JuliaOS Documentation Hub
  • About JuliaOS
    • Mission & Vision
    • Features and Capabilities
    • Roadmap
    • Tokenomics
  • Ecosystem
    • Overview
  • Partners
    • Heurist
    • Fetch.ai
    • Soulgraph
    • cheqd.io
    • Aethir
    • Anyone
    • TensorLabs
    • Hashpower
  • Technology
    • Overview
    • Open Source
      • Modular Framework
      • CLI Mode
    • AI Platform
      • Dashboard
      • Agent Management
      • Swarm Management
      • Marketplace
      • Mining
    • LLM
    • Launchpad
    • Robotics & IOT
      • SwarmIOT
      • Modular AI with Robotics
        • J3OS MiniLLM
          • 🔧 Use Cases
  • Technical
    • Overview
    • Developer Hub
      • Getting Started
        • Installation Guide
          • Github Guide
        • Basic Concepts
        • Quick Start Guide
          • Handling secrets
        • Examples and Use
          • Example: Using the Trading Functionality
          • Example: Using the Benchmarking Feature
          • Example: Multi-Agent Swarm Coordination
          • Example: Using the Python Wrapper for LLM Integration
          • Example: Using Cross-Chain Bridges
          • Example: Creating and Running a Swarm Optimization
          • Page 4
      • Best Practices
        • Performance Tuning
        • Agent/Swarm Design Patterns
        • Best Practices & Patterns
        • Security Best Practices
      • CLI
        • JuliaOS CLI Interface
        • Agent Management (CLI)
        • CLI Configuration
        • Cross-Chain Hub (CLI)
        • Swarm Management (CLI)
        • CLI Troubleshooting
        • Wallet Management (CLI)
      • Framework SDK
        • Modules
          • Bridge
          • Agents Module
          • Dex
          • Swarms Module
          • Wallet
        • Python Wrapper
          • LangChain Integration
          • Python Wrapper
      • Contributing Guide
      • Extending JuliaOS
      • Development Setup & Conventions
      • Testing & Debugging
      • Troubleshooting
    • Architecture
      • High Level JuliaOS
      • CLI <-> Backend Communication
      • Data Storage Architecture
      • Framework Internals
      • Architecture Deep Dive
        • Architectual Notes
    • Concepts
      • Core Features & Concepts
      • Agents
        • Agent Skills & Specializations
      • Swarms
      • Neural Networks
      • Blockchains & Chains
      • Bridges (Cross-Chain)
      • Integrations
        • Google ADK
        • LLMs
        • Price Feed
        • DEX Integration
      • Storage
      • Trading Capabilities
      • Use Cases
      • Wallets
      • Portfolio Optimization
  • Research
    • JuliaOS Research
  • API Documentation
    • API Reference
      • API Reference: Julia Backend Commands
      • API Reference: CLI Commands
      • API Reference: Node.js API
      • API Reference: Python API
      • API Reference
  • Community
    • Community & Support
  • FAQ
    • General
    • Technical
    • Community
Powered by GitBook
On this page
Export as PDF
  1. Technical
  2. Developer Hub
  3. Getting Started
  4. Examples and Use

Example: Using the Benchmarking Feature

JuliaOS includes a comprehensive benchmarking suite for evaluating and comparing swarm optimization algorithms. This feature helps you select the most appropriate algorithm for your specific optimization problems.

# Start the CLI
./scripts/run-cli.sh  # or node packages/cli/interactive.cjs

# Select "🧬 Swarm Intelligence" from the main menu
# Choose "📊 Benchmark Algorithms"
# Select the algorithms to benchmark (e.g., DE, PSO, GWO, DEPSO)
# Choose the benchmark functions (e.g., Sphere, Rastrigin, Rosenbrock, Ackley, Griewank)
# Set the benchmark parameters (dimensions, runs, etc.)
# Run the benchmark and view the results

The benchmarking CLI provides an interactive interface for:

  • Selecting algorithms to benchmark (DE, PSO, GWO, ACO, GA, WOA, DEPSO)

  • Choosing benchmark functions with different difficulty levels

  • Setting dimensions, runs, and evaluation limits

  • Comparing algorithm performance across different metrics

  • Generating comprehensive HTML reports with visualizations

  • Ranking algorithms based on performance metrics

You can also use the Python wrapper to access the benchmarking functionality:

import asyncio
from juliaos import JuliaOS

async def run_benchmark():
    # Initialize JuliaOS
    juliaos_client = JuliaOS(host="localhost", port=8052)
    await juliaos_client.connect()

    # Run benchmark
    result = await juliaos_client.swarms.run_benchmark(
        algorithms=["DE", "PSO", "GWO", "DEPSO"],
        functions=["sphere", "rastrigin", "rosenbrock", "ackley", "griewank"],
        dimensions=10,
        runs=10,
        max_iterations=1000,
        population_size=50
    )

    # Print results
    print("Benchmark Results:")
    for func_name, func_results in result.items():
        print(f"\nFunction: {func_name}")
        for algo, metrics in func_results.items():
            print(f"  Algorithm: {algo}")
            print(f"    Mean Best Fitness: {metrics['mean_best_fitness']}")
            print(f"    Success Rate: {metrics['success_rate']}")
            print(f"    Mean Iterations: {metrics['mean_iterations']}")
            print(f"    Mean Time: {metrics['mean_time']} seconds")

    # Generate visualization
    visualization = await juliaos_client.swarms.generate_benchmark_visualization(
        benchmark_results=result,
        visualization_type="convergence"
    )

    # Save visualization to file
    with open("benchmark_visualization.html", "w") as f:
        f.write(visualization)

    print("\nVisualization saved to benchmark_visualization.html")

    await juliaos_client.disconnect()

# Run the benchmark
asyncio.run(run_benchmark())

The benchmarking feature provides:

  • Comparison of multiple swarm algorithms on standard test functions

  • Performance metrics including success rate, convergence speed, and solution quality

  • Statistical analysis of algorithm performance across multiple runs

  • Visualization of convergence behavior and performance comparisons

  • Parameter sensitivity analysis to optimize algorithm settings

  • Export of results in various formats (CSV, JSON, HTML)

PreviousExample: Using the Trading FunctionalityNextExample: Multi-Agent Swarm Coordination

Last updated 1 month ago