Cody

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

Solution 2581990

Submitted on 19 Jun 2020 by Rafael S.T. Vieira
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)

Exiting: Maximum number of function evaluations has been exceeded - increase MaxFunEvals option. Current function value: -1152921504606846976.000000 xmin = 2.0000 fmin = 1.0000

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 = 2.0000 0.0000 fmin = 2

Suggested Problems

More from this Author17

Community Treasure Hunt

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

Start Hunting!