Skip to main content

Module solver

Module solver 

Source
Expand description

Solver (Data › Analysis › Solver): finds values for variable cells that maximise, minimise or hit a value in an objective cell, subject to constraints.

The workbook is the model: every evaluation sets the variable cells on a copy of the workbook and recalculates their dependents ([Trial]), so any formula works. Two methods:

  • Simplex LP: the model is linearised from n + 1 evaluations and checked for linearity at one more point; then a dense two-phase simplex (Dantzig’s rule, Bland’s rule when it stalls) solves it exactly. Integer and binary constraints use depth-first branch and bound.

  • GRG Nonlinear (the name Excel’s dialog uses): GridCraft’s method is not a generalised reduced gradient. It is an augmented-Lagrangian method (Powell–Hestenes–Rockafellar) whose inner problems are solved by projected gradient descent with Barzilai–Borwein steps and an Armijo line search, on central-difference gradients. Variable bounds are kept by projection. It finds a local optimum of a smooth model; integer constraints use a small branch and bound on top.

  • Evolutionary: a genetic search for models that aren’t smooth (IF, lookups, rounding), with tournament selection, blend crossover and Gaussian mutation inside the variable bounds, feasibility-first ranking and integer rounding, followed by a compass (pattern) search around the best member. It stops when the population has converged, when the best member stops improving, or at the evaluation budget.

Work is bounded by an evaluation budget (no clock: Instant traps on wasm). The model is saved as hidden sheet-scoped names (solver_opt, solver_adj, solver_lhs1…), so it travels with the workbook through XLSX.

Functions§

saved_model
The saved model of a sheet as data.solver params, if any.
sensitivity_applies
Whether data.solver params (such as the model of its result) describe a model that can have a Sensitivity report: Simplex LP or GRG Nonlinear, a Max or Min objective and no integer or binary constraints.
sensitivity_status
Whether a data.solver result status is a solution the Sensitivity report can describe: an optimum (Simplex LP) or a converged local optimum (GRG Nonlinear). A run that stopped at its evaluation limit, or an Evolutionary run, has none.
specs