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:

w1x1+w2x2++wkxkthresholdw_1 x_1 + w_2 x_2 + \dots + w_k x_k \geq \text{threshold}

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

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.

Core Module

from sigopt import Connection

conn = Connection(client_token="USER_TOKEN")
experiment = conn.experiments().create(
  name='Experiment with constraints',
  parameters=[
    dict(name='alpha', type='double', bounds=dict(min=0.0, max=1.0)),
    dict(name='beta', type='double', bounds=dict(min=0.0, max=1.0)),
    dict(name='gamma', type='int', bounds=dict(min=0, max=10)),
    dict(name='theta', type='int', bounds=dict(min=0, max=10)),
  ],
  metrics=[dict(name='metric_value', objective='maximize')],
  observation_budget=80,
  parallel_bandwidth=1,
  linear_constraints=[
    # Constraint inequality: alpha + beta <= 1
    dict(
      type='less_than',
      threshold=1,
      terms=[
        dict(name='alpha', weight=1),
        dict(name='beta', weight=1),
      ],
    ),
    # Constraint inequality: 3 * gamma - 5 * theta >= 0
    dict(
      type='greater_than',
      threshold=0,
      terms=[
        dict(name='gamma', weight=3),
        dict(name='theta', weight=-5),
      ],
    ),
  ],
)

AI Module

sigopt.create_experiment(
  name="Single metric optimization with linear constraints",
  type="offline",
  parameters=[
    dict(name='alpha', type='double', bounds=dict(min=0.0, max=1.0)),
    dict(name='beta', type='double', bounds=dict(min=0.0, max=1.0)),
    dict(name='gamma', type='int', bounds=dict(min=0, max=10)),
    dict(name='theta', type='int', bounds=dict(min=0, max=10)),
  ],
  metrics=[dict(name='metric_value', objective='maximize')],
  budget=80,
  parallel_bandwidth=1,
  linear_constraints=[
    # Constraint inequality: alpha + beta <= 1
    dict(
      type='less_than',
      threshold=1,
      terms=[
        dict(name='alpha', weight=1),
        dict(name='beta', weight=1),
      ],
    ),
    # Constraint inequality: 3 * gamma - 5 * theta >= 0
    dict(
      type='greater_than',
      threshold=0,
      terms=[
        dict(name='gamma', weight=3),
        dict(name='theta', weight=-5),
      ],
    ),
  ],
)

Nonzero weights are included only for the parameters involved in each constraint, e.g., observe that alpha is not involved in the second constraint.

While the constraint types are less_than or greater_than, these are not strict inequalities, and we allow for equality as well. This will likely be more relevant to users defining constraints on int parameters.

Limitations

  • The experiment type must be offline or random

  • The constraints can be defined in terms of any set of parameters of type double or int

  • Mixed variable constraints are not allowed, i.e., a constraint involving both double and int parameters

  • Integer constraints can be defined on at most 10 unique int parameters

  • For Experiments with conditional parameters, constraints can only be defined for unconditional parameters

  • The constraint definitions and constraint parameters cannot be updated during the experiment

Last updated