Skip to Main Content Skip to Search
Product Documentation

addModelConstraint - Add model constraint to optimization

Syntax

options=addModelConstraint(options, label, boundtype, bound)

Description

A method of cgoptimoptions. Adds a placeholder for a model constraint to the optimization. The string label is used to refer to the constraint in CAGE.

boundtype can be set either to the string 'greaterthan' or 'lessthan'.

bound must be a scalar real.

If boundtype = 'greaterthan', the model constraint takes the following form:

CAGE model >= bound

Similarly, if boundtype = 'lessthan', the model constraint takes the form

CAGE model <= bound

Examples

An optimization requires a constraint where a user-defined function must be less than 500. The following code line adds a placeholder for this constraint that is labeled 'mycon':

opt = addModelConstraint(opt, 'mycon', 'lessthan', 500);

How To

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS