Building a Model - Constrained Optimization using CONMINΒΆ

Usually, an optimization problem also contains constraints that reduce the design space. Constraints are equations or inequalities that are expressed as functions of the design variables. You will add a constraint to your model in First, copy the file and give the new file the name Inside of this file, change the name of the assembly from OptimizationUnconstrained to OptimizationConstrained. Don’t forget to also change it in the bottom section where it is instantiated and run.

In OpenMDAO, you can construct a constraint with an expression string, which is an equation or inequality built using available variables with Python mathematical syntax and functions. CONMIN supports inequality constraints but not equality constraints.

You want to add the constraint x-y >= 15 to this problem. The unconstrained minimum violates this constraint, so a new minimum must be found by the optimizer. You can add a constraint to your existing OptimizationUnconstrained model by adding one line to the initialize function:

# CONMIN Constraints
self.driver.add_constraint('paraboloid.x-paraboloid.y >= 15.0')

The add_constraint method is used to add a constraint to the driver.

Please add this line to the __init__ function in and save it. Execute it by typing:


When it is executed, it should produce this output:

[ CONMIN output not shown ]
CONMIN Iterations:  6
Minimum found at (7.175775, -7.824225)
Elapsed time:  0.0295481681824 seconds

Notice that the minimum of the constrained problem is different from the minimum of the unconstrained problem.

Now you are ready to add derivatives to your comnponent, which you will do in the next section.

OpenMDAO Home

Previous topic

Executing the Simple Optimization Problem

Next topic

Adding Derivatives to Your Components

This Page