Set DOF constraints¶
This guide will show you how to set DOF constraints to refine the search space of your optimization.
These constraints are evaluated by the Ax backend. See the Ax API documentation for more information.
Create DOFs and an objective¶
from blop import DOF, Objective
motor_x = MovableSignal(name="motor_x")
motor_y = MovableSignal(name="motor_y")
motor_z = MovableSignal(name="motor_z")
dof1 = DOF(movable=motor_x, search_domain=(0, 1000))
dof2 = DOF(movable=motor_y, search_domain=(0, 1000))
dof3 = DOF(movable=motor_z, search_domain=(0, 1000))
objective = Objective(name="objective1", target="max")
Set a linear constraint¶
Constraints are specified as strings that are templated and evaluated for you.
from blop import DOFConstraint
constraint = DOFConstraint(constraint="5 * x1 + 2 * x2 <= 4 * x3", x1=motor_x, x2=motor_y, x3=motor_z)
Configure an agent with DOF constraints¶
from blop.ax import Agent
agent = Agent(
readables=[],
dofs=[dof1, dof2],
objectives=[objective],
db=db,
dof_constraints=[constraint],
)