Build mathematical modelsLesson 37 of 48 · 8 min

Optimise inside the permitted region

Compare stationary candidates with feasible boundary values.

Maths refresher: Interior points and boundaries

An optimum can occur at a flat interior point or at an edge where movement is restricted.

f(x)=x(10−x),f′(x)=10−2xf(x)=x(10-x),\quad f^{\prime}(x)=10-2x
Worked example

The stationary point is x=5x=5. On 0≤x≤40\le x\le4 it is not feasible; comparing the feasible boundaries gives the maximum at x=4x=4.

Maths prerequisite map ↗

Optimisation asks for the best value within a stated feasible region. Solving a derivative equal to zero finds interior stationary candidates, but those candidates may be infeasible or may fail to be the desired maximum or minimum.

See the mathematics
01.753.55.257-25.51320.528xy(4, 24)
01.753.55.257-25.51320.528xy(4, 24)
max⁡0≤x≤4  x(10−x)\max_{0\le x\le4}\;x(10-x)
Starter reference. Shading marks the feasible interval. The unconstrained stationary point at 5 lies outside it; compare admissible candidates and endpoints.

For a smooth function on a closed bounded interval, examine feasible stationary points and the endpoints. The example maximises x(10−x)x(10-x) on the teaching interval zero to four. Its unconstrained stationary point lies outside that interval.

Keep the objective, feasible domain and candidate evaluation together. A solver cannot infer an omitted budget or physical bound from the variable name. More complex constrained problems can need specialised optimisation methods, but this small case makes the boundary issue visible.

Can the derivative-zero point be rejected because the model does not permit that input?

Write a prediction (optional)

Exact optimisation of an authored model

Select Run Python with the code unchanged.

Tools
About Python

Python and the course packages can load while you read. Each run starts with fresh user variables; imported modules stay loaded. Stop replaces the worker. Runtime details ↗

Ctrl+Enter or ⌘+Enter runs Python.

Compare with the worked example

Executed from the published Python during the site build. Your own run appears above. Build environment ↗

Objective
x(10−x)x \left(10 - x\right)
Unconstrained stationary points
[5]\left[ 5\right]
Feasible candidates
[0, 4]\left[ 0, \ 4\right]
Best feasible x
44
Best value
2424
Worked text output
Objective: x*(10 - x)
Unconstrained stationary points: [5]
Feasible candidates: [0, 4]
Best feasible x: 4
Best value: 24

Read the starter result

Unconstrained stationary points includes 5, which lies outside the starter’s permitted region. Compare Feasible candidates with Best feasible x to see which values actually determine the answer.

Edit and compare

Replace upper = 4 with upper = 8. The upper bound applies to the endpoint candidate and the stationary-point filter. Select Run Python. Compare Feasible candidates and Best feasible x with the first run. Which point becomes available?

Return to the editor

Scope. This closed-interval polynomial permits a complete candidate check; general constrained optimisation can be much harder.

Try a fresh case

An unconstrained optimum violates a physical bound. What should you report?

Choose an answer
Need a hint?
Hint 1

Check whether each candidate belongs to the permitted region.

Hint 2

Include boundaries when the domain includes them.

Your notesNotes save in this browser when storage is available.