# Add Constraints

Constraints can be added to a experiment definition to search for the optimum within a limited region. Once the constraints are defined, all the suggestions generated by SigOpt are guaranteed to satisfy the constraints.

## Linear Inequality Constraints

Linear inequality constraints can be used to define restrictions depending 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 maximum inside the feasible region, while guaranteeing that no suggestion is placed outside the feasible region. In the case of multiple constraints, SigOpt also checks the existence of the feasible region at experiment creation.

## Defining an Experiment with Linear Inequality Constraints

A SigOpt Experiment with linear constraints is defined in term of inequality expressions of the form:

`w`_{1} * x_{1} + w_{2} * x_{2} ... >= threshold

The weight `w`

of each parameter and the right hand side `threshold`

value can be set at the experiment definition. For example:

```
experiment = conn.experiments().create(
name='Experiment with constraints',
project="sigopt-examples",
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='double', bounds=dict(min=0.0, max=1.0)),
dict(name='nodes', type='int', bounds=dict(min=1, max=10)),
],
metrics=[dict(name='metric_value', objective='maximize')],
observation_budget=80,
parallel_bandwidth=1,
linear_constraints=[
# Constraint equation: alpha + beta + gamma <= 1
dict(
type='less_than',
threshold=1,
terms=[
dict(name='alpha', weight=1),
dict(name='beta', weight=1),
dict(name='gamma', weight=1),
],
),
# Constraint equation: 3 * alpha - 5 * beta >= 0
dict(
type='greater_than',
threshold=0,
terms=[
dict(name='alpha', weight=3),
dict(name='beta', weight=-5),
],
),
],
)
```

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). - The maximum number of permitted constraints is plan-dependent; see your profile for more information.
- Multisolution experiments are not supported.
- Conditionals are not permitted.
- The constraints can be defined in terms of any set of parameters of type
`double`

. - The constraint definitions and the parameters involved in any constraints cannot be updated during the experiment.

## Remarks

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