Archived LunaModel 0.5.9 documentation
You are reading the old LunaModel 0.5.9 documentation.
The regular documentation describes LunaModel >=0.6.0; use the
latest documentation unless you explicitly need the old release.
Migration
from_aq -> from_lm to_aq -> to_lm Sense,Vtype etc PascalCase to UPPER_CASE ConsatraintType -> Ctype
Python
from luna_quantum import Model, Sense, Variable, Vtype
from luna_model import Model, Sense, Variable, Vtype
# Create the model
model = Model("Example")
# Set the Model to minimize its objective function
model.set_sense(Sense.Min)
model.set_sense(Sense.MIN)
# Declare decision variables within the model's environment
with model.environment:
x = Variable("x", vtype=Vtype.Integer)
y = Variable("y", vtype=Vtype.Integer)
z = Variable("z", vtype=Vtype.Real)
x = Variable("x", vtype=Vtype.INTEGER)
y = Variable("y", vtype=Vtype.INTEGER)
z = Variable("z", vtype=Vtype.REAL)
model.objective = (x - y) * z
model.constraints += x >= 4, "x lower bound"
model.constraints += y <= 3, "y upper bound"
model.constraints += x - y >= 0, "two variable constraint"
model.constraints += z >= 2
model.constraints += z <= 5