Developer documentation

Build on 4colors from your own code

Python clients and Qiskit and dimod integrations for every 4colors product. Pick your product and start from a working example.

The same four API endpoints serve the Compiler, the QUBO solver and the scheduler.

Read the documentationGet started

Choose your product

Every product runs from Python and one hosted API. Quantum teams can also stay in Qiskit or dimod.

4colors Quantum Compiler

Compile circuits for IBM, IQM and Rigetti devices or a custom target. Keep writing circuits the way you do now and add one call.

Existing code

Qiskit plugin

Drop it into your Qiskit workflow as a pass manager.

Explore Quantum Compiler
qiskit
from fourcolors.quantum.compiler import generate_pass_managerpm = generate_pass_manager(backend, time_budget_s=30)compiled = pm.run(qc)

Scripts and notebooks

Python module

Submit a job and follow each better circuit as it arrives.

Start a Compiler trial
python
from fourcolors.quantum import compilerjob = compiler.submit(open("circuit.qasm").read(), "heavy_hex_156_cz", time_budget_s=30)for res in job.incumbents():    print(res.metrics["two_qubit_gates"], res.metrics["depth"])print(res.circuit)

4colors Optimizer for QUBO

Solve QUBO and Ising models with a time budget. Keep your models as they are and add one call.

Scripts and notebooks

Python module

Submit a model and follow each better solution as it arrives.

Start a QUBO trial
python
import fourcolorsQ = {(0, 1): 2, (1, 2): 2, (2, 3): 2, (0, 3): -3}job = fourcolors.qubo.submit(Q, time_limit_s=30, linear=[-1, -1, -1, -1])for res in job.incumbents():    print(res.objective)print(res.solution)

Existing code

dimod

Use it as a dimod sampler, on the binary quadratic models you already have.

Explore Optimizer for QUBO
dimod
import dimodfrom fourcolors import FourColorsSamplerbqm = dimod.generators.ran_r(1, 50, seed=1)   # or your own BinaryQuadraticModelsampleset = FourColorsSampler().sample(bqm, time_limit_s=30)print(sampleset.first.energy)print(sampleset.first.sample)

4colors Optimizer for Scheduling

Describe jobs, machines and the rules between them. The solver sends a first schedule at once, then better ones until the time budget ends.

Early access

Python module

Machines, changeovers, a maintenance window, a shared crew and no-wait steps in one model, with a time budget for the search.

Request early access
python
import fourcolorsfrom fourcolors.scheduling import Modelm = Model()press, oven = m.machines("press", "oven")m.changeover(press, "steel", "alu", minutes=15)  # setup timem.unavailable(oven, start=240, end=300)          # planned maintenancecrew = m.resource("operators", capacity=2)       # shared crewfor name, metal in [("A", "steel"), ("B", "alu"), ("C", "steel")]:    order = m.job(name)    cut = order.task(press, minutes=40, family=metal, uses=crew)    order.task(oven, minutes=90, after=cut, no_wait=True)  # straight inm.minimize("makespan")job = fourcolors.scheduling.submit(m, time_limit_s=60)print(job.result().schedule)

One hosted API for every product

The same four endpoints serve the Compiler, the QUBO solver and the scheduler, so one integration covers all three.

Example request

Submit and follow a job

Send a job with a time budget, then stream each better result as the search finds it.

Plans and limits
api (bash)
curl https://api.4colors-research.com/v1/jobs \  -H "Authorization: Bearer $FOURCOLORS_API_KEY" \  -H "Content-Type: application/json" \  -d '{    "solver": "quantum.compiler",    "input": {"circuit": "OPENQASM 3.0; include \"stdgates.inc\"; qubit[3] q; h q[0]; cx q[0], q[1]; cx q[1], q[2];"},    "options": {"target": "heavy_hex_156_cz", "time_budget_s": 30}  }'curl -N https://api.4colors-research.com/v1/jobs/JOB_ID/events \  -H "Authorization: Bearer $FOURCOLORS_API_KEY"

Any language or pipeline

Direct API

Submit from any language, follow results live, and stop early when the answer is good enough.

Discuss technical integration
POST /v1/jobs
Submit a circuit or model with a time budget
GET /v1/jobs/{id}/events
Follow each better result live
GET /v1/jobs/{id}
Read the final result and its metrics
POST /v1/jobs/{id}/stop
Stop early and keep the best result

One workflow for every product

  • Prepare the model

    Describe the problem in a supported format: a circuit and its target, a QUBO or Ising model, or a scheduling model.

  • Submit with a time budget

    The search returns a first answer quickly and better ones as it runs. Stop as soon as one is good enough.

  • Inspect and validate

    Read the status, the metrics and the best result, then check it in your application before it drives a decision.

Measure on representative instances

Start with a small instance you can check, then compare on your own models and settings.

Read the documentationDiscuss a technical problem