Rastion Platform Integration

The Qubots framework provides seamless integration with the Rastion platform, enabling researchers and developers to leverage cloud-based optimization services, collaborate with the community, and access powerful computational resources.

What is Rastion?

Rastion is a comprehensive platform for optimization research and development that provides:

  • Cloud Computing: Scalable computational resources for optimization
  • Collaboration Tools: Share and collaborate on optimization projects
  • Repository Management: Version control and distribution for optimization components
  • Competitive Benchmarking: Leaderboards and competitions
  • Research Community: Connect with optimization researchers worldwide

Integration Overview

The Qubots-Rastion integration provides several key capabilities:

Direct API Access

Access all Rastion platform services directly from your Qubots code.

Model Management

Upload, download, and manage optimization models on the platform.

Cloud Execution

Execute optimizations on Rastion’s cloud infrastructure.

Collaboration Features

Share models, results, and insights with the research community.

Getting Started

Account Setup

  1. Create Account: Register at rastion.com
  2. Verify Email: Complete email verification process
  3. Generate API Token: Create API token in account settings
  4. Configure Qubots: Set up authentication in Qubots

Authentication

Set up authentication for platform access:

import qubots.rastion as rastion

# Method 1: Direct authentication
rastion.authenticate("your_api_token_here")

# Method 2: Environment variable
# export RASTION_API_TOKEN="your_api_token_here"

# Method 3: Configuration file
# Add to ~/.qubots/config.yaml:
# rastion:
#   api_token: "your_api_token_here"

Verify Connection

Test your connection to the platform:

# Test authentication
if rastion.is_authenticated():
    print("✓ Successfully authenticated with Rastion")
    
    # Get user information
    user_info = rastion.get_user_info()
    print(f"Welcome, {user_info.username}!")
else:
    print("✗ Authentication failed")

Core Integration Features

RastionClient

The main interface for platform operations:

from qubots import RastionClient

client = RastionClient()

# Upload a model
upload_result = client.upload_model(
    model_path="./my_optimizer",
    model_name="genetic_tsp_v2",
    description="Improved genetic algorithm for TSP",
    tags=["tsp", "genetic", "optimization"]
)

# Download a model
model = client.download_model(
    model_name="community_tsp_solver",
    username="research_group"
)

# List available models
models = client.list_models(category="optimizers")

Model Loading and Uploading

Simplified model management:

from qubots import load_qubots_model, upload_qubots_model

# Load model from platform
problem = load_qubots_model("tsp_problem", username="community")
optimizer = load_qubots_model("genetic_tsp", username="research_group")

# Upload your model to platform
upload_result = upload_qubots_model(
    model_path="./my_new_optimizer",
    model_name="advanced_genetic_tsp",
    model_type="optimizer",
    description="Advanced genetic algorithm with adaptive parameters"
)

Repository Integration

Seamless integration with Git repositories:

# Load from platform repository
problem = AutoProblem.from_repo("community/tsp_benchmark")
optimizer = AutoOptimizer.from_repo("research_lab/quantum_optimizer")

# The platform automatically handles:
# - Repository cloning and caching
# - Dependency resolution
# - Version management
# - Access permissions

Platform Services

Cloud Execution

Execute optimizations on Rastion’s cloud infrastructure:

from qubots import execute_playground_optimization

# Execute in cloud with automatic resource scaling
result = execute_playground_optimization(
    problem_name="large_tsp_instance",
    optimizer_name="my_genetic_algorithm",
    problem_username="benchmarks",
    optimizer_username="my_username",
    config={
        "population_size": 1000,
        "generations": 5000,
        "parallel_evaluation": True
    },
    resources={
        "cpu_cores": 16,
        "memory_gb": 32,
        "time_limit_hours": 2
    }
)

Leaderboard Integration

Submit results to competitive leaderboards:

from qubots import submit_to_leaderboard, get_problem_leaderboard

# Submit your best result
submission = submit_to_leaderboard(
    result=optimization_result,
    problem_id=1,
    solver_name="MyAdvancedSolver",
    solver_repository="my_username/advanced_solver",
    solver_config={"version": "2.1.0"}
)

# Check leaderboard standings
leaderboard = get_problem_leaderboard(problem_id=1)
for entry in leaderboard.top_10:
    print(f"{entry.rank}. {entry.solver_name}: {entry.best_value}")

Collaboration Features

Share and collaborate on optimization projects:

# Share a model with the community
client.share_model(
    model_name="my_optimizer",
    visibility="public",
    license="MIT",
    documentation="README.md"
)

# Follow interesting researchers
client.follow_user("optimization_expert")

# Get notifications about new models
notifications = client.get_notifications(category="new_models")

# Join research groups
client.join_group("quantum_optimization_research")

Advanced Integration

Custom Platform Workflows

Create custom workflows combining multiple platform services:

from qubots import RastionClient, BenchmarkSuite

client = RastionClient()

# 1. Load benchmark problems from platform
benchmark_problems = client.get_benchmark_suite("tsp_standard")

# 2. Load multiple optimizers for comparison
optimizers = [
    load_qubots_model("genetic_tsp", "research_lab"),
    load_qubots_model("simulated_annealing", "university"),
    load_qubots_model("quantum_optimizer", "quantum_team")
]

# 3. Run comprehensive benchmark in cloud
suite = BenchmarkSuite()
for problem in benchmark_problems:
    suite.add_problem(problem)
for optimizer in optimizers:
    suite.add_optimizer(optimizer)

# Execute benchmark suite in cloud
cloud_results = client.execute_benchmark_suite(
    suite=suite,
    resources={"cpu_cores": 32, "memory_gb": 64}
)

# 4. Submit best results to leaderboard
for result in cloud_results.best_results:
    submit_to_leaderboard(
        result=result,
        problem_id=result.problem_id,
        solver_name=result.optimizer_name,
        solver_repository=result.optimizer_repo
    )

# 5. Share results with community
client.publish_benchmark_report(
    results=cloud_results,
    title="Comprehensive TSP Algorithm Comparison",
    description="Comparison of state-of-the-art TSP algorithms"
)

Platform-Aware Development

Develop algorithms with platform integration in mind:

class PlatformAwareOptimizer(BaseOptimizer):
    def __init__(self):
        super().__init__()
        self.client = RastionClient()
    
    def optimize(self, problem):
        # Check if running on platform
        if self.client.is_cloud_environment():
            # Use cloud-optimized parameters
            return self._cloud_optimize(problem)
        else:
            # Use local parameters
            return self._local_optimize(problem)
    
    def _cloud_optimize(self, problem):
        # Leverage cloud resources
        config = {
            "population_size": 1000,  # Larger for cloud
            "parallel_workers": 16,
            "use_gpu_acceleration": True
        }
        return self._run_optimization(problem, config)
    
    def _local_optimize(self, problem):
        # Conservative for local execution
        config = {
            "population_size": 100,
            "parallel_workers": 4,
            "use_gpu_acceleration": False
        }
        return self._run_optimization(problem, config)

Configuration and Management

Platform Configuration

Configure platform integration settings:

# ~/.qubots/config.yaml
rastion:
  api_token: "your_token_here"
  base_url: "https://api.rastion.com"
  default_visibility: "private"
  auto_sync: true
  cache_models: true
  
cloud:
  default_resources:
    cpu_cores: 8
    memory_gb: 16
    time_limit_hours: 1
  
collaboration:
  auto_follow_contributors: true
  notification_preferences:
    new_models: true
    leaderboard_updates: true
    benchmark_results: false

Model Metadata

Provide rich metadata for platform models:

# model_metadata.yaml
name: "advanced_genetic_tsp"
version: "2.1.0"
description: "Advanced genetic algorithm with adaptive parameters"
author: "research_team"
license: "MIT"
tags: ["tsp", "genetic", "adaptive", "optimization"]
requirements:
  - "numpy>=1.20.0"
  - "scipy>=1.7.0"
parameters:
  population_size:
    type: "integer"
    default: 100
    range: [10, 1000]
  mutation_rate:
    type: "float"
    default: 0.1
    range: [0.01, 0.5]
performance:
  benchmark_results:
    tsp_50: 0.95  # Quality score
    tsp_100: 0.92
    tsp_200: 0.88

Best Practices

Model Development

  • Version your models using semantic versioning
  • Provide comprehensive documentation and examples
  • Include proper metadata for discoverability
  • Test on platform before public release
  • Follow community guidelines for naming and organization

Collaboration

  • Share interesting results with the community
  • Contribute to benchmark problems and datasets
  • Participate in discussions and provide feedback
  • Acknowledge contributions from other researchers
  • Follow platform etiquette and community standards

Resource Management

  • Monitor resource usage and costs
  • Use appropriate resource allocations for problem size
  • Clean up completed jobs and temporary data
  • Optimize algorithms for cloud execution
  • Cache frequently used models locally

Troubleshooting

Authentication Issues

# Debug authentication
try:
    rastion.authenticate("your_token")
    print("Authentication successful")
except Exception as e:
    print(f"Authentication failed: {e}")
    
# Check token validity
if not rastion.is_token_valid():
    print("Token expired or invalid")
    # Generate new token from platform

Model Loading Issues

# Debug model loading
try:
    model = load_qubots_model("model_name", "username")
except ModelNotFoundError:
    print("Model not found or access denied")
except DependencyError as e:
    print(f"Missing dependencies: {e.missing_packages}")
except Exception as e:
    print(f"Loading failed: {e}")

Cloud Execution Issues

# Monitor cloud job status
job_id = execute_playground_optimization(...)
status = client.get_job_status(job_id)

if status.failed:
    print(f"Job failed: {status.error_message}")
    print(f"Logs: {status.execution_logs}")

Next Steps

Support

For platform integration support: