Recent Releases of mp-opt-model
mp-opt-model - MP-Opt-Model 5.0
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_modeland quadratically-constrained quadratic programming (QCQP) problems, including functionsqcqps_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(), andhighs_options(). Uses the HiGHSMEX interface for HiGHS. - New
relax_integeroption foropt_model.solve(). Set totrueto 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(), andartelys_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_modelreplaces legacyopt_modelandmp_idx_managerclasses with a new modeling API. The legacy classes are retained for backward compatibility.mp.set_managerencapsulatesmp_idx_managerfunctionality into an individual field object representing a specific set type, rather than in the container class.mp.set_manager_opt_modelis a subclass ofmp.set_managerthat handles common functionality, e.g. related to handling solution data, for all of the set manager subclasses used byopt_model.mp.sm_lin_constraint- set manager class for linear constraintsmp.sm_quad_constraint- set manager class for quadratic constraintsmp.sm_nln_constraint- set manager class for nonlinear constraintsmp.sm_nln_cost- set manager class for general nonlinear costsmp.sm_quad_cost- set manager class for quadratic costsmp.sm_quad_cost_legacy- backward compatible set manager class for quadratic costsmp.sm_variable- set manager class for variables
- New functions:
artelys_knitro_options()sets options for Artelys Knitro.convert_constraint_multipliers()replacesconvert_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/modifiesqcqps_masteroptions 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 usingnlps_masterto solve QCQP problems viafmincon, 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_managerto use newmp.set_managerclass. - Major refactor of
opt_modelto use newmp.set_manager_opt_modelsubclasses:mp.sm_lin_constraint- set manager class for linear constraintsmp.sm_quad_constraint- set manager class for quadratic constraintsmp.sm_nln_constraint- set manager class for nonlinear constraintsmp.sm_nln_cost- set manager class for general nonlinear costsmp.sm_quad_cost_legacy- backward compatible set manager class for quadratic costsmp.sm_variable- set manager class for variables
- Deprecate the following
opt_modelmethods in favor of methods of the individualmp.set_managerobjects contained by theopt_modelobject:add_named_set()-- usemp.set_manager.add()describe_idx()-- usemp.set_manager.describe_idx()getN()-- usemp.set_manager.get_N()init_indexed_name()-- usemp.set_manager.init_indexed_name()set_type_idx_map()-- usemp.set_manager.set_type_idx_map()add_lin_constraint()-- usemp.sm_lin_constraint.add()add_nln_constraint()-- usemp.sm_nln_constraint.add()add_nln_cost()-- usemp.sm_nln_cost.add()add_quad_cost()-- usemp.sm_quad_cost.add()add_var()-- usemp.sm_variable.add()eval_lin_constraint()-- usemp.sm_lin_constraint.eval()eval_nln_constraint()-- usemp.sm_nln_constraint.eval()eval_nln_constraint_hess()-- usemp.sm_nln_constraint.eval_hess()eval_nln_cost()-- usemp.sm_nln_cost.eval()eval_quad_cost()-- usemp.sm_quad_cost.eval()init_indexed_name()-- usemp.set_manager.init_indexed_name()params_lin_constraint()-- usemp.sm_lin_constraint.params()params_nln_constraint()-- usemp.sm_nln_constraint.params()params_nln_cost()-- usemp.sm_nln_cost.params()params_quad_cost()-- usemp.sm_quad_cost.params()params_var()-- usemp.sm_variable.params()set_params()-- usemp.set_manager.set_params()varsets_cell2struct()-- usemp.sm_variable.varsets_cell2struct()varsets_idx()-- usemp.sm_variable.varsets_idx()varsets_len()-- usemp.sm_variable.varsets_len()varsets_x()-- usemp.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 ofconvert_constraint_multipliers().
Incompatible Changes:
- Parsed solution information was moved from the
solnproperty of theopt_modelobject to thesolnproperty of the individual childmp.set_manager_opt_modelobjects. Currently it is still available at the original location, but this is now deprecated. - The
knitro_optsfield of theoptinput tonlps_master()andnlps_knitro()and thesolve()method ofopt_modelhas been redesigned. It is now a raw Artelys Knitro options struct, so theopts,tol_xandtol_ffields are no longer valid. Fortol_xandtol_f, usextolandftol, and the contents ofoptsshould be placed directly in the top level of theknitro_optsfield. - Remove support for older versions of Artelys Knitro, including all references to
ktrlinkfor pre-v9 versions. Currently supports Artelys Knitro version 13.1 and later.
- MATLAB
Published by rdzman 8 months ago
mp-opt-model - MP-Opt-Model 4.2
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 callingnlps_<my_solver>()by settingopt.algto'<MY_SOLVER>'to allow for handling custom NLP solvers. - Add support to
miqps_master()for callingmiqps_<my_solver>()by settingopt.algto'<MY_SOLVER>'to allow for handling custom MILP/MIQP solvers. - Add to the
parse_soln()method ofopt_modelan optionalstashinput argument that, if present and true, causes the parsed solution to be stored back in the object, as thesolve()method was already doing whenopt.parse_solnis 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_modelmethods: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_fsolvein 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
x0as a valid input tolinprog. 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 anipopt.mwrapper 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 unnecessaryipopt.mentirely.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().
- MATLAB
Published by rdzman almost 2 years ago
mp-opt-model - MP-Opt-Model 4.1
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 callingqps_<my_solver>()by settingopt.algto'<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 ofopt_model, returned inom.soln.output.et. - Add
runtimefield tooutputargument ofqps_glpk()andqps_mosek().
- MATLAB
Published by rdzman about 3 years ago
mp-opt-model - MP-Opt-Model 4.0
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.threshoption. If the absolute value of any element of the solution vector exceeds the threshold,exitflagis 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 forpnes_master()from a MATPOWER options struct.
Bugs Fixed:
- Calling the
problem_type()oris_mixed_integer()method on an empty model no longer causes a fatal error.
Other Changes
- Labels from the
set_typesproperty are now used as headers foropt_model/display()to simplify things facilitate use by sub-classes. - Refactored
describe_idxinto a new method,set_type_idx_map, that returns in information in a programmatically usable form, and an updateddescribe_idxthat calls the new method, then formats the results in the expected char array(s).
- MATLAB
Published by rdzman over 4 years ago
mp-opt-model - MP-Opt-Model 3.0
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 thesolnfield of the MP-Opt-Model object. - Allow
v0,vl, andvuinputs toopt_model/add_var()method, andlanduinputs toopt_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 problemsosqp_options()initializes options for OSQP solverosqpver()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()viaopt.x0is no longer ignored for nonlinear equations. - Calling
params_var()method with emptyidxno 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 extensiblehave_feature(), which has now been moved to MP-Test (https://github.com/MATPOWER/mptest).
- MATLAB
Published by rdzman over 5 years ago
mp-opt-model - MP-Opt-Model 2.1
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 viamplinsolve(). - The
solve()method ofopt_modelcan 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
outputreturn value fromnleqs_newton(), changed thenormFfield ofoutput.histtonormf, for consistency in using lowercasefeverywhere.
- MATLAB
Published by rdzman over 5 years ago
mp-opt-model - MP-Opt-Model 2.0
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 tohave_fcn()to check for availability offsolve()function. - Add
nleqs_master()function as unified interface for solving nonlinear equations, including implementations forfsolveand Newton's method in functionsnleqs_fsolve()andnleqs_newton(), respectively. - Add support for nonlinear equations (NLEQ) to
opt_model. For problems with only nonlinear equality constraints and no costs, theproblem_type()method returns'NLEQ'and thesolve()method callsnleqs_master()to solve the problem. - New functions:
mpopt2nleqopt()creates or modifies an options struct fornleqs_master()from a MATPOWER options struct.nleqs_fsolve()provides implementation of unified nonlinear equation solver interface forfsolve.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.
- MATLAB
Published by rdzman over 5 years ago
mp-opt-model - MP-Opt-Model 1.0
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:
- Add the MP-Opt-Model User's Manual with LaTeX source code included in
docs/src.
Other Improvements:
- Refactor
opt_modelclass to inherit from new abstract base classmp_idx_managerwhich can be used to manage the indexing of other sets of parameters, etc. in other contexts.
- MATLAB
Published by rdzman almost 6 years ago