Optimization Toolbox: Solver guide

Choose and interpret LP, MILP, quadratic, nonlinear, least-squares, equation, and multiobjective solver workflows, with a detailed MATLAB capability comparison.

← Optimization Toolbox overview · Modeling guide · Global optimization · Examples · Reference

Solver-selection philosophy

The workbook user should not need to know a Python function name to get a sensible default. The notebook classifies the mathematical structure first and then chooses the narrowest validated solver path.

That is intentionally closer to a modeling environment than to a worksheet full of solver-specific buttons.

The key distinction is between:

  • problem structure — linear, integer, quadratic, nonlinear, residual/equation, multiobjective;
  • solve strategy — local, discrete, global, or repeated tradeoff solves;
  • claim strength — optimal, local optimum, feasible solution, best found, Pareto set, infeasible, unbounded, failed.

Quick solver table

Problem Workbook structure Beta backend Main result semantics
LP One linear objective; continuous vars; linear constraints scipy.optimize.linprog(method="highs") Mathematical-programming status; LP marginals where available
MILP Linear objective/constraints; any integer/binary vars scipy.optimize.milp / HiGHS Discrete mathematical-programming status
Quadratic Quadratic objective terms; linear constraints scipy.optimize.minimize(method="SLSQP") Local constrained result
Smooth NLP Nonlinear objective and/or nonlinear constraints SLSQP Local constrained result; optional bounded global comparison
Nonlinear least squares Residual expression rows scipy.optimize.least_squares Local residual minimum
Nonlinear equations Equation expression rows and no objective least_squares on residual system Feasible equation solution when residual norm passes tolerance
Multiobjective Exactly two named linear objectives Repeated HiGHS LP with epsilon constraint Pareto set
Bounded global Finite variable bounds and nonlinear objective Local SLSQP + MultiStart + Differential Evolution + SHGO Best independently feasible candidate

Linear programming

Form

The LP path solves a linear objective subject to ranged linear constraints and variable bounds.

The worksheet representation is converted to the standard forms required by linprog:

  • equal lower/upper bound → equality row;
  • upper bound → A_ub x <= b_ub;
  • lower bound → sign-flipped upper-bound row.

Solver

The beta calls SciPy linprog(..., method="highs"). HiGHS chooses an appropriate high-performance LP algorithm internally.

Status mapping

SciPy/HiGHS condition Toolbox status
Successful optimal solve OPTIMAL
Infeasible INFEASIBLE
Unbounded UNBOUNDED
Other termination/numerical failure FAILED

Marginals

For an optimal LP, the workbench reads HiGHS equality/inequality marginals and associates them with named worksheet constraints. Lower-bound ranged sides are sign-adjusted, then all marginals are normalized to the natural workbook objective direction.

Interpret them as local objective sensitivity to a small RHS change at the current solution, subject to ordinary LP dual assumptions.

Do not interpret a marginal as:

  • a full allowable increase/decrease range;
  • a MILP shadow price;
  • a global nonlinear sensitivity measure.

Classical basis-preserving sensitivity ranges are a planned depth feature.

Mixed-integer linear programming

MILP uses SciPy milp, backed by HiGHS.

Supported variable types

  • Continuous
  • Integer
  • Binary

Binary bounds are normalized to 0 and 1.

Current limits

  • The workbench does not expose advanced MIP tuning controls in the workbook.
  • The solve uses a 10-second backend time limit in the beta.
  • MIP node count is surfaced when available.
  • MILP duals are not presented as if they were LP shadow prices.

For integer models, scenario-based perturbation is generally more interpretable than pretending LP sensitivity applies unchanged.

Quadratic objectives

The workbook can represent named quadratic objective terms together with variable bounds and linear constraints.

Backend choice

The current beta compiles those terms into the natural objective and sends the problem through SLSQP. This has two consequences:

  1. The included portfolio fixture can be solved effectively.
  2. The workbench does not claim generic quadprog-style dedicated QP behavior or convexity certification.

A successful result is therefore LOCAL_OPTIMUM, not OPTIMAL.

Roadmap

A dedicated browser-validated QP backend should eventually add:

  • explicit convexity handling;
  • QP-specific termination semantics;
  • better performance on larger quadratic models;
  • QP dual/KKT diagnostics where available.

Smooth constrained nonlinear optimization

SLSQP is the current local NLP method.

It accepts:

  • lower/upper variable bounds;
  • linear ranged constraints;
  • safe nonlinear constraint expressions;
  • a linear, quadratic, nonlinear, or combined scalar objective.

Initial values

Local nonlinear methods depend on starting points. The workbench uses InitialValue from the Variables sheet and clips it to the declared bounds.

Scaling

The Variables sheet includes a characteristic Scale. The beta uses scale values for diagnostics, not internal variable transformation. If the largest characteristic scale divided by the smallest exceeds 10,000, Diagnostics emits a warning.

If a nonlinear solve is unstable, rescale the model explicitly rather than assuming the solver has already normalized every quantity.

Local-optimum semantics

A successful SLSQP termination becomes LOCAL_OPTIMUM only if the independent feasibility check passes. The term does not imply that other local minima do not exist.

Nonlinear least squares

Residual rows create a vector \(r(x)\). The beta sends the weighted vector to SciPy least_squares with variable bounds.

This is suited to parameter estimation where observations live in worksheet Parameters and the model response can be expressed with the safe nonlinear language.

What is available

  • multiple residual rows;
  • nonnegative residual weights;
  • bounded parameters;
  • strict numerical tolerances;
  • residual norm in the termination message;
  • normalized solution publication.

What is not yet exposed

  • robust loss selection in the workbook;
  • user-selectable Jacobian methods;
  • covariance/standard-error calculation;
  • general linear/nonlinear constraints on the least-squares solve.

Nonlinear equations

Equation solving is implemented as bounded residual minimization.

The distinction from parameter fitting is interpretive:

  • least squares seeks a local residual minimum;
  • equation solving seeks a residual vector sufficiently close to zero.

The current acceptance threshold is based on residual norm. A low residual produces FEASIBLE_SOLUTION; otherwise the solve is FAILED.

The beta does not claim one-dimensional root bracketing semantics analogous to every fzero use case.

Multiobjective optimization

The current multiobjective method handles exactly two named linear objectives.

It:

  1. independently optimizes each objective to establish endpoints;
  2. constructs a sequence of epsilon bounds on objective 2;
  3. minimizes objective 1 under each epsilon bound;
  4. publishes the feasible nondominated rows.

This has an important benefit in Excel: the user sees the actual tradeoff table instead of one hidden scalarization weight.

It is not yet equivalent to MATLAB fgoalattain, fminimax, gamultiobj, or paretosearch.

Independent feasibility acceptance

Every solver path passes through the same post-solve check.

For a candidate \(x\), the workbench computes the maximum violation of:

  • variable bounds;
  • integrality;
  • linear constraint lower/upper bounds;
  • nonlinear constraint lower/upper bounds.

If maximum violation exceeds 1e-6, a nominal local/global success is not accepted as a valid result.

This design intentionally separates:

  • solver termination — what the numerical method reported;
  • model acceptance — what the workbook independently verified.

Status semantics

OPTIMAL

Reserved for LP/MILP paths where the backend status supports an optimality claim.

LOCAL_OPTIMUM

A local nonlinear/quadratic/least-squares solve terminated successfully and passed feasibility checks. Other local optima may exist.

FEASIBLE_SOLUTION

The workbench found a point that satisfies the acceptance criterion but does not make a stronger optimum claim. Equation solving uses this term when residuals are sufficiently small.

BEST_FOUND

Global-search methods produced one or more candidates and the workbench selected the best independently feasible candidate. This is deliberately not called GLOBAL_OPTIMUM.

PARETO_SET

The multiobjective sweep produced a set of nondominated tradeoff points.

INFEASIBLE / UNBOUNDED

Passed through from supported mathematical-programming backend conditions.

FAILED

Termination, numerical behavior, or independent acceptance did not justify another status.

Solver controls

Objective direction

Minimize and Maximize are the only explicit Start-level overrides. Auto preserves the Sense stored in the enabled objective definition. Overrides are supported only for a single-objective model.

Solve mode

Mode Effect
Recommended Uses the model catalog’s Preferred strategy, falling back to the class-native path
Local Requests one local solve where the class supports it
MultiStart Repeats local solves from seeded starting points for a continuous NLP
Global Requests local + MultiStart + Differential Evolution + SHGO comparison for a bounded, unconstrained continuous NLP

Problem class and solve strategy are separate concepts: selecting Global does not reclassify an NLP as “Global.” Unsupported class/strategy combinations are rejected before solver dispatch.

Analysis view

  • Auto — model-appropriate analysis.
  • Solver comparison — forces the normalized solver-comparison table when comparison results exist.

The beta intentionally does not expose a “Scenario comparison” selector because scenarios are currently solved one at a time.

MATLAB capability comparison

The following comparison is about user capability, not API identity.

Optimization Toolbox

MATLAB Optimization Toolbox area Representative MATLAB functions/capability Python for Excel beta Notes
Linear programming linprog Available HiGHS through SciPy
Mixed-integer linear programming intlinprog Available HiGHS milp; continuous/integer/binary
Quadratic programming quadprog Partial Quadratic model surface available; current solver is SLSQP, not a dedicated QP backend
Second-order cone programming coneprog Planned Runtime includes candidate conic packages but no validated workbook path yet
Unconstrained nonlinear minimization fminunc, fminsearch Partial General nonlinear model can be solved locally; no separate Newton/quasi-Newton/Nelder-Mead selection UI
Constrained nonlinear minimization fmincon Available in core form SLSQP with bounds and linear/nonlinear constraints
Scalar bounded minimization fminbnd Representable, not dedicated A one-variable nonlinear model can be solved but no specialized scalar workflow
Semi-infinite optimization fseminf Not available Outside current beta scope
Linear least squares lsqlin Partial Residual workflow exists; no dedicated linearly constrained linear-LS interface
Nonlinear least squares lsqnonlin, lsqcurvefit Available in core form Worksheet residuals + bounds; fewer solver/options surfaces
Nonlinear equations fsolve, fzero Available in system form Bounded equation residual system; no dedicated scalar bracketing workflow
Goal attainment fgoalattain Planned Current method is epsilon-constraint
Minimax fminimax Planned No dedicated minimax formulation yet
Problem-based modeling optimproblem, optimvar, expressions Analogous workbook layer Worksheet rows form a declarative problem; not MATLAB symbolic objects
Solver-based modeling matrices/functions passed directly to solvers Internal compiler layer Notebook compiles tables to solver arrays/functions
Automatic differentiation problem-based automatic derivatives Not available Current SciPy paths use solver numerical derivative behavior
Solver outputs / exit flags exitflag, output, lambda Available with normalized semantics Result/diagnostic tables intentionally abstract backend-specific fields
LP sensitivity ranges MATLAB sensitivity analysis capabilities Partial Constraint marginals only; classical ranges planned

MathWorks currently documents Optimization Toolbox around LP/MILP, QP/SOCP, nonlinear optimization, least squares, nonlinear equations, problem-based/solver-based setup, automatic differentiation, and result interpretation. The beta’s documentation mirrors those questions so users can see where the workbook is equivalent, partial, or not implemented.

Global Optimization Toolbox

Global methods are documented separately in Global optimization because local/global claim strength needs additional explanation.

Why the beta sometimes uses a different algorithm

There are three reasons not to clone solver names mechanically:

  1. Browser feasibility. A method must import, solve, and return results reliably in the actual Pyodide environment.
  2. Excel relevance. The feature should correspond to a plausible worksheet decision workflow, not exist only to increase a parity count.
  3. Result semantics. Different algorithms can answer the same business question while requiring different guarantees and diagnostics.

For example, SciPy’s Differential Evolution and SHGO are useful bounded global methods even though they are not the headline solver names in MATLAB Global Optimization Toolbox. They broaden capability without pretending to be MATLAB’s genetic algorithm or GlobalSearch object.

Choosing a method as an author

Situation Recommended beta approach
Linear continuous business model LP / HiGHS
Linear model with yes/no or whole-number decisions MILP / HiGHS
Smooth quadratic portfolio/design objective with linear constraints Quadratic model + SLSQP; validate carefully
Smooth nonlinear objective with known business bounds/constraints SLSQP local first
Local result appears start-sensitive or multimodal Compare local, MultiStart, DE, SHGO if all variables can be bounded
Parameter estimation Residual rows + least_squares
Solve a small nonlinear system Equation rows + bounded residual solve
Compare two linear objectives Epsilon-constraint Pareto workflow
Expensive black-box objective Current beta may be inappropriate; surrogate optimization is planned
Mixed-integer nonlinear problem Not supported in current beta

Numerical-quality checklist

Before blaming a solver:

  • check units and orders of magnitude;
  • remove contradictory/redundant constraints where practical;
  • use realistic finite bounds for global search;
  • give nonlinear variables meaningful starting values;
  • inspect Diagnostics for scaling warnings;
  • check maximum violation, not just objective;
  • compare against a simplified model whose solution you understand;
  • for global search, rerun with a different seed as a robustness test rather than as proof of optimality.

External references