liveBook · Manning

Decision variable

As explained in Statistics Every Programmer Needs

A decision variable is an unknown quantity whose value represents a selectable decision in an optimization problem.

A decision variable represents a choice in an optimization problem. In linear programming, it records which alternatives are selected and appears in both the objective function and the constraints. Its coefficients connect each choice to value, cost, effort, resource limits, or strategic requirements. section 8.2

Define decision variables by specifying their meaning, allowable values, and relationships to the optimization model:

  • Use binary variables when each alternative is a yes-or-no choice: 0 means excluded and 1 means selected. section 8.2.5
  • Use continuous variables when a decision represents a quantity that can vary within a range. section 8.3
  • Combine variables with an objective function and linear constraints so the solver can find a feasible, high-value or low-cost solution. section 8.2

Selecting project features

For a feature-selection model, define one binary variable per feature. In Python, `x_bounds = [(0, 1) for _ in features]` gives every variable the allowable range 0–1. Passing these bounds to `scipy.optimize.linprog` restricts the solution to selecting or excluding each feature while budget and epic constraints are enforced. section 8.2.5 section 8.2.2

How Statistics Every Programmer Needs covers it

How deep it goes
Defines binary and continuous roles, specifies bounds, and connects variables to objectives and constraints without deriving solver algorithms.
Examples
Uses project-feature selection, feature cost and value data, and Python bounds of `(0, 1)` for each feature.
What you can do after
Apply it via `scipy.optimize.linprog` by defining variable bounds alongside objectives and linear constraints.
How it connects
Connects decision variables to linear programming, objective functions, constraints, resource allocation, and binary integer programming.

Also explained in

Compare how 2 books explain decision variable →

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.