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:
1
w1 * x1 + w2 * x2 ... >= threshold
Copied!
The weight w of each parameter as well as the `threshold` inequality value can be set at experiment creation.
Python
YAML
1
sigopt.create_experiment(
2
name="Single metric optimization with linear constraints",
3
type="offline",
4
parameters=[
5
dict(
6
name="alpha",
7
type="double",
8
bounds=dict(
9
min=0,
10
max=1
11
)
12
),
13
dict(
14
name="beta",
15
type="double",
16
bounds=dict(
17
min=0,
18
max=1
19
)
20
),
21
dict(
22
name="gamma",
23
type="double",
24
bounds=dict(
25
min=0,
26
max=1
27
)
28
)
29
],
30
metrics=[
31
dict(
32
name="holdout_accuracy",
33
strategy="optimize",
34
objective="maximize"
35
)
36
],
37
linear_constraints=[
38
dict(
39
type="less_than",
40
threshold=1,
41
terms=[
42
dict(
43
name="alpha",
44
weight=1
45
),
46
dict(
47
name="beta",
48
weight=1
49
),
50
dict(
51
name="gamma",
52
weight=1
53
)
54
]
55
),
56
dict(
57
type="greater_than",
58
threshold=0,
59
terms=[
60
dict(
61
name="alpha",
62
weight=3
63
),
64
dict(
65
name="beta",
66
weight=-5
67
)
68
]
69
)
70
],
71
parallel_bandwidth=1,
72
budget=30
73
)
Copied!
1
name: Single metric optimization with linear constraints
2
type: offline
3
parameters:
4
- name: alpha
5
type: double
6
bounds:
7
min: 0
8
max: 1
9
- name: beta
10
type: double
11
bounds:
12
min: 0
13
max: 1
14
- name: gamma
15
type: double
16
bounds:
17
min: 0
18
max: 1
19
metrics:
20
- name: holdout_accuracy
21
strategy: optimize
22
objective: maximize
23
linear_constraints:
24
- type: less_than
25
threshold: 1
26
terms:
27
- name: alpha
28
weight: 1
29
- name: beta
30
weight: 1
31
- name: gamma
32
weight: 1
33
- type: greater_than
34
threshold: 0
35
terms:
36
- name: alpha
37
weight: 3
38
- name: beta
39
weight: -5
40
parallel_bandwidth: 1
41
budget: 30
Copied!
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` or `random`
• 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
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.