Cody

# Problem 524. Sequential Unconstrained Minimization (SUMT) using Interior Penalty

Solution 1699262

Submitted on 25 Dec 2018 by Binbin Qi
• Size: 67
• This is the leading solution.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
f = @(x) 0.5*x; g = @(x) 2-x; x0 = 5; [xmin,fmin]=sumt_interior(f,g,x0) %#ok<*NOPTS> xcorrect=2; assert(norm(xmin-xcorrect)<2e-3) assert(abs(fmin-f(xcorrect))<1e-3)

xmin = 2.0001 fmin = 1.0001

2   Pass
f = @(x) 0.5*x; g = @(x) 2-x; x0 = 5; [xmin,fmin]=sumt_interior(f,g,x0,1) % 1 iteration for unit penalty value xr1=4; assert(norm(xmin-xr1)<1e-4) assert(abs(fmin-f(xr1))<1e-4)

xmin = 4 fmin = 2

3   Pass
f = @(x) sum(x); g = @(x) [x(1) - 2*x(2) - 2 8 - 6*x(1) + x(1).^2 - x(2)]; x0 = [3; 3]; [xmin,fmin]=sumt_interior(f,g,x0,1) % 1 iteration xr2=[1.8686 2.1221]; assert(norm(xmin-xr2)<1e-2) assert(abs(fmin-f(xr2))<1e-2)

xmin = 1.8686 2.1221 fmin = 3.9906

4   Pass
f = @(x) sum(x); g = @(x) [x(1) - 2*x(2) - 2 8 - 6*x(1) + x(1).^2 - x(2)]; x0 = [2.1; 0.1]; r = 2^12; [xmin,fmin]=sumt_interior(f,g,x0,r) % Final iteration xcorrect=[2; 0]; assert(norm(xmin-xcorrect)<5e-3) assert(abs(fmin-f(xcorrect))<2e-3)

xmin = 1.9999 0.0006 fmin = 2.0005

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!