Solve your first model

Quicopt is a solver for hard optimization problems. This page takes you from an empty directory to a solved model in four steps: sign up, install, set your key, run an example. Pick your language below; the choice carries over to every page of the docs. In Python you build the model in a standard front-end (OR-Tools MathOpt or Pyomo), in Julia in JuMP, and in R and Ruby with the client's own model, then hand it to a single solve call.

Step 1 — Sign up

Create a free account with your email address. We send you your API key by email; it starts with qo_.

Step 2 — Install

There is no license file to install and no endpoint to configure; the client is one package.

Install it with the front-end you model in. The examples on this page use OR-Tools MathOpt; for Pyomo install quicopt[pyomo] instead.

pip install "quicopt[mathopt]"

The client is in Julia's General registry; add JuMP alongside it.

julia -e 'using Pkg; Pkg.add(["QuicoptClient", "JuMP"])'

The package comes from r-universe; the CRAN mirror supplies its dependencies.

Rscript -e 'install.packages("quicopt", repos = c("https://quicopt.r-universe.dev", "https://cloud.r-project.org"))'

Needs Ruby 3.2 or newer.

gem install quicopt

Step 3 — Set your API key

The client reads your key from the environment variable QUICOPT_API_KEY, so it never has to appear in your code:

export QUICOPT_API_KEY=qo_your_key_here

On Windows (PowerShell) that is $env:QUICOPT_API_KEY = "qo_your_key_here". To keep the key across sessions, add the line to your shell profile; in R you can put QUICOPT_API_KEY=qo_your_key_here into your .Renviron instead. You can also pass the key in code, but then it ends up wherever your code goes; see API keys.

Step 4 — Run an example

A ready-to-run script that solves a small QUBO: four binary variables, a reward for each and a penalty for each adjacent pair on a cycle. Save it and run it. In Python there is a small MILP as well; each slide shows the model and exactly what prints:

qubo.py
from ortools.math_opt.python import mathopt
from quicopt import Client

# A QUBO: 4 binary variables, a quadratic objective, no constraints.
model = mathopt.Model(name="qubo")
x = [model.add_binary_variable(name=f"x{i}") for i in range(4)]

# Reward each variable; penalise adjacent pairs on the 4-cycle 0-1-2-3-0.
# Distinct linear weights break the symmetry, so the optimum is unique.
model.minimize(
    -(1.0 * x[0] + 0.7 * x[1] + 1.3 * x[2] + 0.5 * x[3])
    + 2.0 * (x[0] * x[1] + x[1] * x[2] + x[2] * x[3] + x[0] * x[3])
)

client = Client()
result = client.solve(model)
print(result.display)
$ python qubo.py
├── shots
│   ├── 1 · primal   -2.3    0.0s  ◀ best
│   ├── 2 · primal   -2.3    0.0s
│   ├── 3 · primal   -2.3   1.72s
│   ├── 4 · primal   -2.3    2.0s
│   └── 5 · primal   -2.3    2.0s
├── status:     heuristic
├── feasible:   n/a
├── objective:  -2.3
├── x:          x0=1, x1=0, x2=1, x3=0  (4 variables)
└── solve_time: 2.002 s
qubo.jl
using QuicoptClient, JuMP

# A QUBO: 4 binary variables, a quadratic objective, no constraints.
model = Model()
@variable(model, x[1:4], Bin)

# Reward each variable; penalise adjacent pairs on the 4-cycle 1-2-3-4-1.
@objective(model, Min,
    2.0 * (x[1] * x[2] + x[2] * x[3] + x[3] * x[4] + x[1] * x[4])
    - (1.0 * x[1] + 0.7 * x[2] + 1.3 * x[3] + 0.5 * x[4]))

result = solve(model)   # reads QUICOPT_API_KEY
println(result.objective)
qubo.R
library(quicopt)

# A QUBO: 4 binary variables, a quadratic objective, no constraints.
m <- model()
x <- bin_var(m, "x", 4)

# Reward each variable; penalise adjacent pairs on the 4-cycle 1-2-3-4-1.
minimize(m, 2.0 * (x[1] * x[2] + x[2] * x[3] + x[3] * x[4] + x[1] * x[4]) -
            (1.0 * x[1] + 0.7 * x[2] + 1.3 * x[3] + 0.5 * x[4]))

result <- solve(m)      # reads QUICOPT_API_KEY
print(result$objective)
qubo.rb
require "quicopt"

# A QUBO: 4 binary variables, a quadratic objective, no constraints.
model = Quicopt::Model.new
x = Array.new(4) { |i| model.bin_var("x#{i}") }

# Reward each variable; penalise adjacent pairs on the 4-cycle 0-1-2-3-0.
model.minimize(
  2.0 * (x[0] * x[1] + x[1] * x[2] + x[2] * x[3] + x[0] * x[3]) -
  (1.0 * x[0] + 0.7 * x[1] + 1.3 * x[2] + 0.5 * x[3])
)

client = Quicopt::Client.new   # reads QUICOPT_API_KEY
result = client.solve(model)
puts result.objective

Step 5 — Understand what happened

The example did three things:

  1. Built a model — a standard MathOpt Model with variables, an objective, and (in the MILP) constraints. Nothing in it is Quicopt-specific; the same code runs against any MathOpt-compatible solver, and a Pyomo model works the same way.
  2. Called client.solve(model) — Client() needs no arguments: it reads your key from QUICOPT_API_KEY and sends the model to the Quicopt service. If the key is missing or wrong, the call fails with a message that says so and where to get a key.
  3. Printed and returned the result — result.display is the framed view the server renders. It opens with a shots block: the service takes several shots at your model and shows you what each one reached, with ◀ best on the one that won. Below it sit the summary lines, and the Result object carries the same values as fields — status, objective, and the solution keyed by your variable names. Every field is described in the API reference.

What you can solve today

The API currently solves LP, QP, MILP, MIQP, MINLP, QUBO, PUBO/HUBO, and NLP models — there is a runnable example for each. Black-box objectives are coming soon; a model outside today's classes is declined with a readable message, never a half-solved result.

Beyond the free tier

The free account solves models with up to 50 variables and comes with a limited compute allowance. For larger models we can give you 30 days of evaluation access without that limit. For regular use there are token packages, and for production planning an enterprise license; see Pricing. Questions, or real models you want to try Quicopt on? Just ask:

Questions? Talk to us.

Whether something's unclear or you want to try Quicopt on your real models — tell us what you're optimizing.

Talk to us →

Where next

  • Examples — a runnable model for every supported problem class, including how an infeasible model comes back.
  • API reference — the quicopt Python client in full: Client, solve(), the Result fields, and the async job API.
  • Modeling front-ends — what you can express in Pyomo and OR-Tools MathOpt.

About this service

The free tier is provided as-is, for evaluation and research only — without availability, functionality or result guarantees, and without any service level. Liability is limited, to the extent permitted by law, to intent and gross negligence.

We keep the data you send over the API for 24 months to improve future versions of our solvers; you can delete a job at any time from the client. Please don't submit personal, confidential or otherwise sensitive data inside an optimization model — the service isn't designed for that. Full details: Terms of Use · Privacy Policy · Legal notice.