Quantagonia
Quantagonia offers a Hybrid Quantum Platform for solving complex computational problems.
Solvers
Model | Solvers |
---|---|
Quadratic Unconstrained Binary Optimization (QUBO) | quantagonia.qubo |
Mixed Integer Linear Programming (MILP) | quantagonia.mps |
Linear Programming (LP) | quantagonia.lp |
QUBO
import strangeworks as sw
from strangeworks_optimization import StrangeworksOptimizer
from strangeworks_optimization_models.parameter_models import QuantagoniaParameterModel
from dimod import BinaryQuadraticModel
sw.authenticate(api_key)
linear = {1: -2, 2: -2, 3: -3, 4: -3, 5: -2}
quadratic = {(1, 2): 2, (1, 3): 2, (2, 4): 2, (3, 4): 2, (3, 5): 2, (4, 5): 2}
model = BinaryQuadraticModel(linear, quadratic, "BINARY")
options = QuantagoniaParameterModel(sense="MINIMIZE")
solver = "quantagonia.qubo"
so = StrangeworksOptimizer(
model=model,
solver=solver,
options=options)
sw_job = so.run()
print(f"Job slug: {sw_job.slug}")
print(f"Job status: {so.status(sw_job.slug)}")
results = so.results(sw_job.slug)
MILP
import strangeworks as sw
from strangeworks_optimization import StrangeworksOptimizer
from strangeworks_optimization_models.problem_models import MPSFile
from strangeworks_optimization_models.parameter_models import QuantagoniaParameterModel
from dimod import BinaryQuadraticModel
sw.authenticate(api_key)
file = "example.mps"
model = MPSFile.read_file(file)
options = QuantagoniaParameterModel(sense="MINIMIZE")
solver = "quantagonia.mps"
so = StrangeworksOptimizer(
model=model,
solver=solver,
options=options)
sw_job = so.run()
print(f"Job slug: {sw_job.slug}")
print(f"Job status: {so.status(sw_job.slug)}")
results = so.results(sw_job.slug)
Presolve
If you have access to the Gurobi product, you can use the gurobi.presolve
service to preprocess the problem before submitting to Quantagonia.
This can often lead to a significant reduction in the size of the problem and make the solver more efficient.
Linear Programming
from strangeworks_optimization import StrangeworksOptimizer
from strangeworks_optimization_models.parameter_models import QuantagoniaParameterModel
from strangeworks_optimization_models.problem_models import LpFile
model = LpFile.read_file("example.lp")
options = QuantagoniaParameterModel(sense="MINIMIZE")
so = StrangeworksOptimizer(model=model, solver="quantagonia.lp", options=options)
sw_job = so.run()
results = so.results(sw_job.slug)
Parameters
from strangeworks_optimization_models.parameter_models import QuantagoniaParameterModel
options = QuantagoniaParameterModel(.....)
Parameter | Type | Description | Default | Values |
---|---|---|---|---|
sense | string | Determines the optimization direction of the problem, either maximizing or minimizing the objective function. | MINIMIZE | MAXIMIZE, MINIMIZE |
timelimit | float | Sets the maximum time, in seconds, that the solver should spend on the problem before terminating. | 86400 | - |
relative_gap | float | Specifies the stopping criterion based on the relative gap between the best found solution and the bound. | 0.0001 | - |
absolute_gap | float | Sets the absolute gap tolerance, which is the acceptable difference between the best solution's objective value and the solver's bound for concluding optimization. | 1e-9 | - |
heuristics_only | bool | (Only for QUBO) If set to true, the solver will only use heuristic methods to find a solution, potentially faster but possibly less optimal. | false | true, false |
Solvers
- quantagonia.qubo
- quantagonia.mps
For further details on these parameters and more in-depth explanations, you can consult the Quantagonia documentation directly at Quantagonia's API Documentation.