Documentation

Welcome to the developer documentation for SigOpt. If you have a question you can’t answer, feel free to contact us!
Welcome to the new SigOpt docs! If you're looking for the classic SigOpt documentation then you can find that here. Otherwise, happy optimizing!

Parameter Constraints

Parameter Constraints can be added to an experiment definition to search for the optimum within a limited region of parameter space. Once parameter constraints are defined, all the configurations generated by SigOpt are guaranteed to satisfy them.

Linear inequality constraints

Linear inequality constraints can be used to define restrictions that depend on multiple parameters. Multiple linear constraints can be defined at the same time where each constraint must affect more than one parameter. The region where all the constraints are satisfied is called the feasible region. SigOpt will find the optimum inside the feasible region, while guaranteeing that no points are placed outside the feasible region. In the case of multiple constraints, SigOpt also checks the existence of the feasible region at experiment creation. For constraints that cannot be explicitly expressed as linear inequalities (e.g., nonlinear or blackbox), refer to the Metric Constraints documentation on defining constraints through thresholding on metric values.

Defining an Experiment with Linear Inequality Constraints

A SigOpt Experiment with linear inequality constraints is defined by the expression:

w1 * x1 + w2 * x2 ... >= threshold

The weight w of each parameter as well as the threshold inequality value can be set at experiment creation.

sigopt.create_experiment(
  name="Single metric optimization with nonlinear constraints",
  type="offline",
  parameters=[
    dict(
      name="alpha",
      type="double",
      bounds=dict(
        min=0,
        max=1
      )
    ),
    dict(
      name="beta",
      type="double",
      bounds=dict(
        min=0,
        max=1
      )
    ),
    dict(
      name="gamma",
      type="double",
      bounds=dict(
        min=0,
        max=1
      )
    )
  ],
  metrics=[
    dict(
      name="holdout_accuracy",
      strategy="optimize",
      objective="maximize"
    )
  ],
  linear_constraints=[
    dict(
      type="less_than",
      threshold=1,
      terms=[
        dict(
          name="alpha",
          weight=1
        ),
        dict(
          name="beta",
          weight=1
        ),
        dict(
          name="gamma",
          weight=1
        )
      ]
    ),
    dict(
      type="greater_than",
      threshold=0,
      terms=[
        dict(
          name="alpha",
          weight=3
        ),
        dict(
          name="beta",
          weight=-5
        )
      ]
    )
  ],
  parallel_bandwidth=1,
  budget=30
)

Nonzero weights are included only for the parameters involved in each constraint, e.g., note how gamma is not involved in the second constraint.

Limitations

  • The experiment type must be offline (which is the default)
  • Multisolution Experiments are not supported
  • The constraints can be defined in terms of any set of parameters of type double
  • For Conditional Parameters, constraints can only be defined for unconditional parameters
  • The constraint definitions and constraint parameters cannot be updated during the experiment

Remarks

If the constraints are defined such that a feasible region does not exist, or where a constraint affects only one parameter (i.e. the constraint is encoded in the bounds of the respective parameter), SigOpt will return an API Error.