liveBook · Manning

Optimal solution

As explained in Statistics Every Programmer Needs

An optimal solution is a feasible assignment of decision variables that gives the best objective value under the problem's optimization direction.

An optimal solution is a feasible assignment of decision variables that produces the best objective value while satisfying every constraint. In binary feature selection, each variable indicates whether a feature is selected. section 8.2.6

A linear-programming solution is evaluated through:

  • Feasibility: decision variables obey bounds, such as 0 or 1, and all inequality constraints. section 8.2.6
  • Objective value: minimizing negated priorities effectively maximizes the selected features' priority score. section 8.2.6

Binary feature selection

Calling scipy.optimize.linprog with the HiGHS method returns success=True and a binary assignment selecting 12 features. The resulting priority score is 17.6. section 8.2.6

>>> from scipy.optimize import linprog
>>> import numpy as np
>>> result = linprog(c, A_ub = A_ub, b_ub = b_ub,
>>>                  bounds = x_bounds, method = 'highs')

Inspect the SciPy call that computes the constrained solution from objective coefficients, inequality constraints, bounds, and a solver method. section 8.2.6

How Statistics Every Programmer Needs covers it

How deep it goes
Explains solver inputs and interprets success, assignments, selection count, and objective value without deriving optimization algorithms.
Examples
Demonstrates binary feature selection yielding twelve selected features and a priority score of 17.6.
What you can do after
Apply it via SciPy's linprog to obtain and inspect a constrained decision-variable assignment.
How it connects
Connects linear programming with decision variables, objective functions, constraints, bounds, and binary feature selection.

Also explained in

Compare how 3 books explain optimal solution →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Statistics Every Programmer Needs. The section links point to the parts of the book it draws on.