Overview

AutoProblem enables you to load optimization problems with a single line of code, handling repository cloning, dependency management, and instance creation automatically.

from qubots import AutoProblem

# Load a maxcut problem from a repository
problem = AutoProblem.from_repo("ileo/demo-maxcut")

Key Features

Repository Integration

Automatically clone and manage Git repositories containing optimization problems

Caching System

Caching to avoid repeated downloads and improve performance

Parameter Override

Override default parameters when loading problems

Validation

Automatic validation of problem configurations and parameters

Basic Usage

Loading a Problem

from qubots import AutoProblem

# Load from local examples
problem = AutoProblem.from_repo("ileo/demo-maxcut")

Parameter Override

You can override default parameters when loading:

# Override parameters during loading
problem = AutoProblem.from_repo("ileo/demo-maxcut", override_params={
    "n_vertices": 20,
    "graph_type": "random",
    "density": 0.4,
    "weight_range": [1.0, 10.0]
})

Problem Configuration

Each problem repository contains a config.json file that defines the problem:

{
  "type": "problem",
  "entry_point": "qubot",
  "class_name": "MaxCutProblem",
  "default_params": {
    "n_vertices": 10,
    "graph_type": "random",
    "density": 0.5,
    "weight_range": [
      1.0,
      10.0
    ]
  },
  "metadata": {
    "name": "demo-maxcut",
    "description": "Graph partitioning optimization to maximize the weight of edges crossing between two vertex sets. The MaxCut problem is a fundamental combinatorial optimization problem with applications in statistical physics, circuit design, and machine learning.",
    "domain": "graph_theory",
    "tags": [
      "maxcut",
      "graph",
      "partitioning",
      "optimization",
      "combinatorial",
      "np-hard",
      "binary"
    ],
    "difficulty": "intermediate",
    "problem_type": "combinatorial"
  },
  "parameters": {
    "n_vertices": {
      "type": "integer",
      "default": 10,
      "min": 3,
      "max": 100,
      "description": "Number of vertices in the graph"
    },
    "graph_type": {
      "type": "string",
      "default": "random",
      "options": [
        "random",
        "complete",
        "cycle",
        "grid"
      ],
      "description": "Type of graph structure to generate"
    },
    "density": {
      "type": "number",
      "default": 0.5,
      "min": 0.1,
      "max": 1.0,
      "description": "Edge density for random graphs (probability of edge existence)"
    },
    "weight_range": {
      "type": "array",
      "default": [
        1.0,
        10.0
      ],
      "description": "Range for random edge weights [min, max]"
    }
  },
  "requirements": [
    "numpy>=1.20.0"
  ]
}

Next Steps