Skip to content

Releases: MATPOWER/mp-opt-model

MP-Opt-Model 5.0

12 Jul 21:31

Choose a tag to compare

5.0 Downloads

What's New in MP-Opt-Model 5.0

Released Jul 12, 2025

Below is a summary of the changes since version 4.2 of MP-Opt-Model. See
the CHANGES.md file for all the gory details. For release notes
for previous versions, see Appendix C of the MP-Opt-Model User's
Manual
.

New Features:

  • Support for quadratic constraints in opt_model and quadratically-constrained quadratic programming (QCQP) problems, including functions qcqps_master(), qcqps_gurobi(), qcqps_knitro(), qcqps_nlps(), and more.
    Thanks to Wilson González Vanegas.
  • Support for the open-source HiGHS solver for LP, QP and MILP problems, including functions miqps_highs(), qps_highs(), have_feature_highs(), highsver(), and highs_options(). Uses the HiGHSMEX interface for HiGHS.
  • New relax_integer option for opt_model.solve(). Set to true to easily solve the LP or QP relaxation of a mixed integer LP or QP.
  • Support for Artelys Knitro solver for LP and QP problems, including functions qps_knitro(), knitrover(), and artelys_knitro_options().
    Thanks to Wilson González Vanegas.
  • Support for Artelys Knitro 15.x, which required changes to the prior options handling.
  • Support for conversion between objects and structs to facilitate workarounds for Octave's inability to save and load classdef objects.
  • New classes:
    • mp.opt_model replaces legacy opt_model and mp_idx_manager classes with a new modeling API. The legacy classes are retained for backward compatibility.
    • mp.set_manager encapsulates mp_idx_manager functionality into an individual field object representing a specific set type, rather than in the container class.
    • mp.set_manager_opt_model is a subclass of mp.set_manager that handles common functionality, e.g. related to handling solution data, for all of the set manager subclasses used by opt_model.
    • mp.sm_lin_constraint - set manager class for linear constraints
    • mp.sm_quad_constraint - set manager class for quadratic constraints
    • mp.sm_nln_constraint - set manager class for nonlinear constraints
    • mp.sm_nln_cost - set manager class for general nonlinear costs
    • mp.sm_quad_cost - set manager class for quadratic costs
    • mp.sm_quad_cost_legacy - backward compatible set manager class for quadratic costs
    • mp.sm_variable - set manager class for variables
  • New functions:
    • artelys_knitro_options() sets options for Artelys Knitro.
    • convert_constraint_multipliers() replaces convert_lin_constraint_multipliers().
    • convert_quad_constraint() converts bounded quadratic constraints to equality/inequality pairs.
    • have_feature_highs() feature detection function for HiGHS solver.
    • highsver() displays version of installed HiGHS.
    • highs_options() sets options for HiGHS.
    • knitrover() displays version of installed Artelys Knitro.
    • miqps_highs() provides standardized interface for using HiGHS to solve MILP problems.
    • mpopt2qcqpopt() creates/modifies qcqps_master options struct from MATPOWER options struct.
    • mp.struct2object() converts a struct back to the object from which it was created.
    • qcqps_gurobi() provides standardized interface for using Gurobi to solve QCQP problems.
    • qcqps_knitro() provides standardized interface for using Artelys Knitro to solve QCQP problems.
    • qcqps_nlps() provides standardized interface for using nlps_master to solve QCQP problems via fmincon, IPOPT, Artelys Knitro, or MIPS.
    • qcqps_master() provides a single wrapper function for calling any of MP-Opt-Model's QCQP solvers.
    • qps_highs() provides standardized interface for using HiGHS to solve LP/QP problems.
    • qps_knitro() provides standardized interface for using Artelys Knitro to solve LP/QP problems.

New Documentation:

Two live scripts illustrate the use of new features.

  • milp_example1.mlx (in examples) illustrates the use of MP-Opt-Model and the new mp.opt_model class to build and solve an optimization (MILP) model.
  • qcqp_example1.mlx (in examples) illustrates the new quadratic constraint features and two methods of building and solving a quadratically-constrained quadratic programming (QCQP) model.

Bugs Fixed:

  • Using miqps_master() with 'DEFAULT' solver to solve an LP/QP problem without a MILP/MIQP solver available incorrectly threw a fatal error stating there was no solver available.

Other Changes:

  • Major refactor of mp_idx_manager to use new mp.set_manager class.
  • Major refactor of opt_model to use new mp.set_manager_opt_model subclasses:
    • mp.sm_lin_constraint - set manager class for linear constraints
    • mp.sm_quad_constraint - set manager class for quadratic constraints
    • mp.sm_nln_constraint - set manager class for nonlinear constraints
    • mp.sm_nln_cost - set manager class for general nonlinear costs
    • mp.sm_quad_cost_legacy - backward compatible set manager class for quadratic costs
    • mp.sm_variable - set manager class for variables
  • Deprecate the following opt_model methods in favor of methods of the individual mp.set_manager objects contained by the opt_model object:
    • add_named_set() -- use mp.set_manager.add()
    • describe_idx() -- use mp.set_manager.describe_idx()
    • getN() -- use mp.set_manager.get_N()
    • init_indexed_name() -- use mp.set_manager.init_indexed_name()
    • set_type_idx_map() -- use mp.set_manager.set_type_idx_map()
    • add_lin_constraint() -- use mp.sm_lin_constraint.add()
    • add_nln_constraint() -- use mp.sm_nln_constraint.add()
    • add_nln_cost() -- use mp.sm_nln_cost.add()
    • add_quad_cost() -- use mp.sm_quad_cost.add()
    • add_var() -- use mp.sm_variable.add()
    • eval_lin_constraint() -- use mp.sm_lin_constraint.eval()
    • eval_nln_constraint() -- use mp.sm_nln_constraint.eval()
    • eval_nln_constraint_hess() -- use mp.sm_nln_constraint.eval_hess()
    • eval_nln_cost() -- use mp.sm_nln_cost.eval()
    • eval_quad_cost() -- use mp.sm_quad_cost.eval()
    • init_indexed_name() -- use mp.set_manager.init_indexed_name()
    • params_lin_constraint() -- use mp.sm_lin_constraint.params()
    • params_nln_constraint() -- use mp.sm_nln_constraint.params()
    • params_nln_cost() -- use mp.sm_nln_cost.params()
    • params_quad_cost() -- use mp.sm_quad_cost.params()
    • params_var() -- use mp.sm_variable.params()
    • set_params() -- use mp.set_manager.set_params()
    • varsets_cell2struct() -- use mp.sm_variable.varsets_cell2struct()
    • varsets_idx() -- use mp.sm_variable.varsets_idx()
    • varsets_len() -- use mp.sm_variable.varsets_len()
    • varsets_x() -- use mp.sm_variable.varsets_x()
  • Update mosek_options() for MOSEK 11.x compatibility.
  • Update miqps_<solver>() functions to avoid changing MIP solution values in price computation stage. It was rounding integer variables, potentionally causing a small discrepancy between the objective value reported by the solver and the value obtained by computing directly from the returned solution x.
  • Deprecate the convert_lin_constraint_multipliers() in favor of convert_constraint_multipliers().

Incompatible Changes:

  • Parsed solution information was moved from the soln property of the opt_model object to the soln property of the individual child mp.set_manager_opt_model objects. Currently it is still available at the original location, but this is now deprecated.
  • The knitro_opts field of the opt input to nlps_master() and nlps_knitro() and the solve() method of opt_model has been redesigned. It is now a raw Artelys Knitro options struct, so the opts, tol_x and tol_f fields are no longer valid. For tol_x and tol_f, use xtol and ftol, and the contents of opts should be placed directly in the top level of the knitro_opts field.
  • Remove support for older versions of Artelys Knitro, including all references to ktrlink for pre-v9 versions. Currently supports Artelys Knitro version 13.1 and later.

MP-Opt-Model 4.2

15 May 21:55

Choose a tag to compare

4.2 Downloads

What's New in MP-Opt-Model 4.2

Released May 10, 2024

Below is a summary of the changes since version 4.1 of MP-Opt-Model. See
the CHANGES.md file for all the gory details. For release notes
for previous versions, see Appendix C of the MP-Opt-Model User's
Manual
.

New Features:

  • Option for opt_model.add_lin_constraint() to provide/store the
    transpose of the A matrix instead of the original. This can
    potentially save significant memory for sparse matrices with many
    more columns than rows. E.g. storage constraints in MOST
    for 8760 hour planning horizon.
  • Add support to nlps_master() for calling nlps_<my_solver>() by
    setting opt.alg to '<MY_SOLVER>' to allow for handling custom
    NLP solvers.
  • Add support to miqps_master() for calling miqps_<my_solver>()
    by setting opt.alg to '<MY_SOLVER>' to allow for handling custom
    MILP/MIQP solvers.
  • Add to the parse_soln() method of opt_model an optional stash
    input argument that, if present and true, causes the parsed
    solution to be stored back in the object, as the solve() method
    was already doing when opt.parse_soln is true.
  • New Sphinx-based Reference documentation.
  • New functions:
    • convert_lin_constraint() converts linear constraints from a
      single set of doubly-bounded inequality constraints to separate
      sets of equality and upper-bounded inequality constraints.
    • convert_lin_constraint_multipliers() converts multipliers on
      linear constraints from separate sets for equality and
      upper-bounded inequality constraints to those for doubly-bounded
      inequality constraints.
  • New opt_model methods:
    • is_solved() indicates whether the model has been solved.
    • has_parsed_soln() indicates whether a parsed solution is
      available in the model.
    • display_soln() display the results of a solved model,
      including values, bounds and shadow prices for variables and
      linear constraints, values and shadow prices for nonlinear
      constraints, and individual cost components.

Bugs Fixed:

  • Clear cached parameters after updating linear constraints or
    quadratic costs via opt_model.set_params().
  • In miqps_mosek() the lower and upper bounds of binary variables
    got overwritten with 0 and 1, respectively, effectively relaxing
    any potentially tighter bounds provided as input.
  • Fix false positive in have_feature_fsolve in case where the file
    is present, but without a valid license.

Other Changes:

  • Update for compatibility with MATLAB R2023a (Optimization Toolbox
    9.5) and later, which removed x0 as a valid input to linprog.

  • Update have_feature_ipopt() to recognize IPOPT MEX installations
    from Enrico Bertolazzi's mexIPOPT, which include MEX files
    that have been renamed to architecture-specific names along with an
    ipopt.m wrapper function to call the appropriate one.
    Thanks to Carlos Murillo-Sánchez.

    Note: While MP-Opt-Model no longer requires this, my
    recommendation is still to simply rename the MEX file to
    ipopt.<mexext>, with the appropriate architecture-specific
    extension, and delete the unnecessary ipopt.m entirely.

  • Always skip price computation stage in miqps_<solver>() functions
    for pure (as opposed to mixed) integer problems.

  • Add caching of aggregate output parameters in
    opt_model.params_var().

MP-Opt-Model 4.1

13 Dec 22:12

Choose a tag to compare

4.1 Downloads

What's New in MP-Opt-Model 4.1

Released December 13, 2022

Below is a summary of the changes since version 4.0 of MP-Opt-Model. See
the CHANGES.md file for all the gory details. For release notes
for previous versions, see Appendix C of the MP-Opt-Model User's
Manual
.

New Features

  • Add support to qps_master() for calling qps_<my_solver>() by
    setting opt.alg to '<MY_SOLVER>' to allow for custom solvers.

Other Changes

  • Update for compatibility with Artelys Knitro 13.1 and later.
  • Add elapsed time in seconds to results of the solve() method of
    opt_model, returned in om.soln.output.et.
  • Add runtime field to output argument of qps_glpk() and
    qps_mosek().

MP-Opt-Model 4.0

19 Oct 02:52

Choose a tag to compare

4.0 Downloads

What's New in MP-Opt-Model 4.0

Released October 18, 2021

Below is a summary of the changes since version 3.0 of MP-Opt-Model. See
the CHANGES.md file for all the gory details. For release notes
for previous versions, see Appendix C of the MP-Opt-Model User's
Manual
.

New Features

  • Support for new class of problems -- parameterized nonlinear equations
    (PNE). Either create a model with only equality constraints (no
    inequalities or costs) and with number of variables equal to 1 more than
    number of constraints, or call pnes_master() directly. See Section 4.5
    of User's Manual for details.
    Thanks to Shrirang Abhyankar and Alexander Flueck for contributions to this
    feature, which is based on the continuation power flow code in MATPOWER 7.1.
    • Predictor/corrector numerical continuation method for tracing solution
      curves for PNE problems.
    • Plotting of solution curves.
    • User-defined event functions and callback functions.
    • Warm-start capabilities.
  • Optional threshold for detecting failure of LEQ solve, by setting the
    leq_opt.thresh option. If the absolute value of any element of the
    solution vector exceeds the threshold, exitflag is set to 0, indicating
    failure.
  • New functions:
    • pnes_master() provides unified interface for parameterized nonlinear
      equation (PNE) solvers.
    • pne_callback_default() collects PNE results and optionally plots
      solution curve.
    • pne_callback_nose() handles event signaling a nose point or limit
      has been reached.
    • pne_callback_target_lam() handles event signaling a target value
      of parameter λ has been reached.
    • pne_detect_events() detects events from event function values.
    • pne_detected_event() returns detected event details for events
      with a particular name.
    • pne_event_nose() detects the limit or nose point.
    • pne_event_target_lam() detects a target λ value.
    • pne_pfcn_arc_length() implements arc length parameterization.
    • pne_pfcn_natural() implements natural parameterization.
    • pne_pfcn_pseudo_arc_length() implements pseudo arc length
      parameterization.
    • pne_register_callbacks() registers callback functions.
    • pne_register_events() registers event functions.
    • mp_idx_manager/set_type_idx_map() method returns information about
      mapping of indices for a given set type back to the corresponding
      named (and possibly indexed) sets.
    • mpopt2pneopt() creates or modifies an options struct for
      pnes_master() from a MATPOWER options struct.

Bugs Fixed:

  • Calling the problem_type() or is_mixed_integer() method on an empty
    model no longer causes a fatal error.

Other Changes

  • Labels from the set_types property are now used as headers for
    opt_model/display() to simplify things facilitate use by sub-classes.
  • Refactored describe_idx into a new method, set_type_idx_map, that
    returns in information in a programmatically usable form, and an updated
    describe_idx that calls the new method, then formats the results in
    the expected char array(s).

MP-Opt-Model 3.0

08 Oct 17:51

Choose a tag to compare

3.0 Downloads

What's New in MP-Opt-Model 3.0

Released October 8, 2020

Below is a summary of the changes since version 2.1 of MP-Opt-Model. See
the CHANGES.md file for all the gory details. For release notes
for previous versions, see Appendix C of the MP-Opt-Model User's
Manual
.

New Features

  • Support for OSQP solver for LP and QP problems (https://osqp.org).
  • Support for modifying parameters of an existing MP-Opt-Model object.
  • Support for extracting specific named/indexed variables, costs, constraint
    values and shadow prices, etc. from a solved MP-Opt-Model object.
  • Results of the solve() method saved to the soln field of the
    MP-Opt-Model object.
  • Allow v0, vl, and vu inputs to opt_model/add_var() method, and
    l and u inputs to opt_model/add_lin_constraint() to be scalars
    that get expanded automatically to the appropriate vector dimension.
  • New functions:
    • opt_model/set_params() method modifies parameters for a given named
      set of existing variables, costs, or constraints of an MP-Opt-Model
      object.
    • opt_model/get_soln() method extracts solved results for a given
      named set of variables, constraints or costs.
    • opt_model/parse_soln() method returns a complete set of solution
      vector and shadow price values for a solved model.
    • opt_model/eval_lin_constraint() method computes the constraint values
      for the full set or an individual named subset of linear constraints.
    • qps_osqp() provides standardized interface for using OSQP to
      solve LP/QP problems
    • osqp_options() initializes options for OSQP solver
    • osqpver() returns/displays version information for OSQP
    • ... plus 29 individual feature detection functions for
      have_feature(), see Table A-7 in the MP-Opt-Model User's Manual
      for details.

Bugs Fixed:

  • Starting point supplied to solve() via opt.x0 is no longer ignored
    for nonlinear equations.
  • Calling params_var() method with empty idx no longer results in
    fatal error.
  • For opt_model, incorrect evaluation of constant term has been fixed for
    vector valued quadratic costs with constant term supplied as a vector.

Other Changes

  • Simplified logic to determine whether a quadratic cost for an
    MP-Opt-Model object is vector vs. scalar valued. If the quadratic
    coefficient is supplied as a matrix, the cost is scalar varied,
    otherwise it is vector valued.
  • Deprecated have_fcn() and make it a simple wrapper around the new
    modular and extensible have_feature(), which has now been moved to
    MP-Test (https://github.com/MATPOWER/mptest).

MP-Opt-Model 2.1

25 Aug 22:27

Choose a tag to compare

2.1 Downloads

What's New in MP-Opt-Model 2.1

Released August 25, 2020

Below is a summary of the changes since version 2.0 of MP-Opt-Model. See
the CHANGES.md file for all the gory details. For release notes
for previous versions, see Appendix C of the MP-Opt-Model User's
Manual
.

New Features

  • Fast-decoupled Newton's and Gauss-Seidel solvers for nonlinear equations.
  • New linear equation ('LEQ') problem type for models with equal
    number of variables and linear equality constraints, no costs, and no
    inequality or nonlinear equality constraints. Solved via mplinsolve().
  • The solve() method of opt_model can now automatically handle mixed
    systems of equations, with both linear and nonlinear equality constraints.
  • New core nonlinear equation solver function with arbitrary, user-defined
    update function, used to implement Gauss-Seidel and Newton solvers.
  • New functions:
    • nleqs_fd_newton() solves a nonlinear set of equations via a
      fast-decoupled Newton's method.
    • nleqs_gauss_seidel() solves a nonlinear set of equations via a
      Gauss-Seidel method.
    • nleqs_core() implements core nonlinear equation solver with
      arbitrary update function.

Incompatible Changes

  • In output return value from nleqs_newton(), changed the normF
    field of output.hist to normf, for consistency in using lowercase
    f everywhere.

MP-Opt-Model 2.0

08 Jul 21:22

Choose a tag to compare

2.0 Downloads

What's New in MP-Opt-Model 2.0

Released July 8, 2020

Below is a summary of the changes since version 1.0 of MP-Opt-Model. See
the CHANGES.md file for all the gory details. For release notes
for previous versions, see Appendix C of the MP-Opt-Model User's
Manual
.

New Features

  • Add new 'fsolve' tag to have_fcn() to check for availability of
    fsolve() function.
  • Add nleqs_master() function as unified interface for solving
    nonlinear equations, including implementations for fsolve and
    Newton's method in functions nleqs_fsolve() and nleqs_newton(),
    respectively.
  • Add support for nonlinear equations (NLEQ) to opt_model. For
    problems with only nonlinear equality constraints and no costs,
    the problem_type() method returns 'NLEQ' and the solve()
    method calls nleqs_master() to solve the problem.
  • New functions:
    • mpopt2nleqopt() creates or modifies an options struct for
      nleqs_master() from a MATPOWER options struct.
    • nleqs_fsolve() provides implementation of unified nonlinear
      equation solver interface for fsolve.
    • nleqs_master() provides a single wrapper function for calling
      any of MP-Opt-Model's nonlinear equation solvers.
    • nleqs_newton() provides implementation of Newton's method solver
      with a unified nonlinear equation solver interface.
    • opt_model/params_nln_constraint() method returns parameters for
      a named (and optionally indexed) set of nonlinear constraints.
    • opt_model/params_nln_cost() method returns parameters for a
      named (and optionally indexed) set of general nonlinear costs.

Other Changes

  • Add to eval_nln_constraint() method the ability to compute constraints
    for a single named set.
  • Skip evaluation of gradient if eval_nln_constraint() is called with
    a single output argument.
  • Remove redundant MIPS tests from test_mp_opt_model.m.
  • Add tests for solving LP/QP, MILP/MIQP, NLP and NLEQ problems via
    opt_model/solve().
  • Add Table 6-1 of valid have_fcn() input tags to User's Manual.

MP-Opt-Model 1.0

08 May 22:44

Choose a tag to compare

1.0 Downloads

What's New in MP-Opt-Model 1.0

Released May 8, 2020

Below is a summary of the changes since version 0.8 of MP-Opt-Model. See the CHANGES.md file for all the gory details. For release notes for previous versions, see Appendix C of the MP-Opt-Model User's
Manual
.

New Documentation:

Other Improvements:

  • Refactor opt_model class to inherit from new abstract base class mp_idx_manager which can be used to manage the indexing of other sets of parameters, etc. in other contexts.