search
UMD  This Site




File #1

%MATLAB code (optimization routine)
options= optimset('largescale','off');
[X fval]=fmincon(inline('x(1)'),[1;1],[],[],[],[],[],[],@constraint,options)

File #2 (separate file in same subdirectory)

%external function:
function [c, ceq]=constraint(x)
%nonlinear inequality constraint
c=[ (x(1)-1)^2+(x(2)-1)^2 ; (x(1)-1)^2+(x(2)+1)^2];
ceq= [];

OUTPUT
> Warning: Large-scale (trust region) method does not currently solve this type of problem,
switching to medium-scale (line search).
> In C:\MATLAB6p5p1\toolbox\optim\fmincon.m at line 213
In C:\Teaching\Optimization_Problems\Pb2\main.m at line 2
Optimization terminated: No feasible solution found. [Numerical difficulties given the feasible region]
Search direction less than 2*options.TolX but constraints are not satisfied.

X =

1.0000
0.0000

fval =

1.0000

 



Additional Resources

Problem 2 Home

Problem 2 Matlab Code

Probem 2 MPL Code

Problem 2 Excel

Teaching Home



Copyright 2011
Civil Engineering Home Applied Mathematics UMD UMD