Recall & Review
beginner
What are bounds in optimization problems?
Bounds are limits set on the values that variables can take during optimization. They restrict variables to stay within a specific range, like setting a minimum and maximum value.
Click to reveal answer
beginner
How do constraints differ from bounds in optimization?
Constraints are rules that variables must satisfy, which can be equalities or inequalities. Bounds are a simple type of constraint that only limit variable ranges, while constraints can be more complex conditions.
Click to reveal answer
intermediate
How do you define bounds in scipy.optimize.minimize?
Bounds are defined as a sequence of (min, max) pairs for each variable. For example, bounds=[(0, 10), (None, 5)] means the first variable is between 0 and 10, and the second variable has no lower bound but max 5.
Click to reveal answer
intermediate
What types of constraints can scipy.optimize.minimize handle?
It can handle 'eq' (equality) constraints where a function equals zero, and 'ineq' (inequality) constraints where a function is greater than or equal to zero.
Click to reveal answer
beginner
Why are bounds and constraints important in real-life optimization?
They ensure solutions are realistic and safe. For example, in manufacturing, constraints can keep material usage within limits, and bounds can keep temperatures within safe ranges.
Click to reveal answer
In scipy.optimize.minimize, how do you specify that a variable x must be between 1 and 5?
✗ Incorrect
Bounds are given as pairs (min, max) for each variable. So bounds=[(1, 5)] restricts x between 1 and 5.
Which constraint type in scipy.optimize.minimize means the function must equal zero?
✗ Incorrect
'eq' constraints require the function to be exactly zero.
What happens if you set bounds=[(0, None)] for a variable?
✗ Incorrect
None means no limit, so (0, None) means variable ≥ 0 with no upper limit.
Which of these is a valid inequality constraint in scipy.optimize.minimize?
✗ Incorrect
'ineq' constraints require the function to be ≥ 0, so x[0] - 2 ≥ 0 means x[0] ≥ 2.
Why might you use constraints instead of just bounds?
✗ Incorrect
Constraints can express conditions involving multiple variables or nonlinear relations, beyond simple variable limits.
Explain the difference between bounds and constraints in optimization problems.
Think about simple limits versus more complex rules.
You got /4 concepts.
Describe how to set bounds and constraints in scipy.optimize.minimize with an example.
Recall the syntax for bounds and constraints in scipy.
You got /4 concepts.