Before an optimizer can choose anything, somebody must decide precisely what counts as a choice. Enough people need to be present during busy periods, the work must be assigned to appropriately trained staff and availability needs to be respected. Those requirements seem straightforward until several of them collide. A qualified employee might be unavailable during the busiest shift; assigning someone elsewhere might create an uncovered role on another day. Improving the schedule means reasoning about the decisions together.

This is a useful way to understand an optimization model. Although mathematical formulations can become sophisticated, most begin with three questions: what can we choose, what must be true and what are we trying to improve? The answers become decision variables, constraints and an objective. Getting them right is often more important than selecting a fashionable algorithm.

What can change?

Decision variables represent the choices the model is allowed to make. In a roster, a variable might indicate whether a particular employee works a particular shift. In vehicle routing, it might describe whether a vehicle travels between two locations. In a factory, it might represent the start time of a job or its assignment to a machine. The type of variable reflects the decision: a yes-or-no assignment is naturally binary, while a start time or a quantity may be represented differently.

This can involve a weighted objective, ordered priorities or several stages of optimization.

The model does not necessarily decide everything about the workplace. Holidays, machine capacity or a customer's required delivery date may be inputs rather than choices. Mistaking an input for a variable can produce a model that appears to optimize by changing something the organization cannot actually change.

What must be true?

Constraints describe the rules a valid answer must respect. A scheduled shift may require at least two trained employees; a person cannot work two overlapping shifts; a machine cannot process two jobs at the same time. If these are genuine requirements, a solution violating them is not a solution the organization can use, no matter how attractive its objective score looks.

Other requirements are preferences rather than absolute rules. Employees may prefer certain shifts, managers may want consistent schedules and a production team may prefer to group similar jobs. Treating every preference as an inviolable constraint can make an otherwise workable problem impossible. Many models therefore distinguish hard requirements from soft preferences and represent the latter with penalties or secondary objectives.

A model can optimize only the choices and priorities it has been given.

What are we trying to improve?

An objective specifies how the alternatives are evaluated. It might minimize overtime, delays or changeovers, or maximize coverage and utilization. Choosing the objective is a business and operational decision as much as a mathematical one. A roster that minimizes staffing cost without considering fairness or fatigue could satisfy one narrow measure while creating a poor experience for the people expected to work it.

When several goals matter, we need an explicit approach to tradeoffs. This can involve a weighted objective, ordered priorities or several stages of optimization. There is no universally right set of weights. The model should make the choices understandable, and the organization should be able to recognize how a change in priorities affects the result.

A small example

Suppose a venue has four employees and two evening shifts. Each shift needs two people. One employee is unavailable on the first evening, and another has a qualification required on both evenings. The decisions are the assignments of people to shifts; the constraints are the headcount, qualification and availability requirements; the objective might be to distribute undesirable hours fairly. The question is no longer simply “Who is free?” It becomes “Which valid assignment best reflects our priorities?”

Both can represent a roster, but they lead to different search spaces and may expose different structure to an algorithm.

If a model finds no feasible roster, that is useful information too. It might reveal that a requirement cannot be met with the available staff. It does not authorize the algorithm to ignore safety or contractual rules. Someone must then decide whether to change the inputs, add capacity or revise a policy.

What happens next?

Once the model is clear, an algorithm can search for feasible assignments and improvements. A result still needs to be checked against real operational conditions, including details that may not have been captured in the first draft of the model. Learn how optimization algorithms search, explore workforce rostering or read about the Optimizer for Scheduling.

Why the choice of variables matters

There can be several mathematical ways to describe the same decision. One model might use a binary variable for every employee-shift pair. Another might describe each employee's shift pattern as a single choice from a list of valid patterns. Both can represent a roster, but they lead to different search spaces and may expose different structure to an algorithm. This is why modeling is more than translating English rules into equations. A good formulation preserves the important relationships while giving the solver information it can use. For a newcomer, beginning with the simplest inspectable variables is sensible. More sophisticated representations become worthwhile when their structure or performance justifies the extra work.

Continue learning

New to Optimization, part 4 of 6. Previous: Why is optimization hard?. Next: How optimization algorithms search. View the full learning path.