Cody

Problem 523. Sequential Unconstrained Minimization (SUMT) using Exterior Penalty

Solution 2581708

Submitted on 19 Jun 2020
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   Fail
f = @(x) 0.5*x; g = @(x) 2-x; x0 = 0; [xmin,fmin]=sumt_exterior(f,g,[],x0) %#ok<*NOPTS> xcorrect=2; assert(norm(xmin-xcorrect)<1e-3) assert(abs(fmin-f(xcorrect))<1e-3)

Exiting: Maximum number of function evaluations has been exceeded - increase MaxFunEvals option. Current function value: -158456325028528747205099520.000000 xmin = -3.1691e+26 fmin = -1.5846e+26

Assertion failed.

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

Exiting: Maximum number of function evaluations has been exceeded - increase MaxFunEvals option. Current function value: -158456325028528747205099520.000000 xmin = -3.1691e+26 fmin = -1.5846e+26

Assertion failed.

3   Pass
f = @(x) x(1).^2 + 10*x(2).^2; h = @(x) sum(x)-4; x0 = [0; 0]; [xmin,fmin]=sumt_exterior(f,[],h,x0) xcorrect=[40; 4]/11; assert(norm(xmin-xcorrect)<1e-3) assert(abs(fmin-f(xcorrect))<1e-4)

xmin = 3.6363 0.3636 fmin = 14.5454

4   Pass
f = @(x) x(1).^2 + 10*x(2).^2; h = @(x) sum(x)-4; x0 = [0; 0]; r = [1, 5]; [xmin,fmin]=sumt_exterior(f,[],h,x0,r) % 2 iterations xr2=[3.0769 0.3077]; assert(norm(xmin-xr2,inf)<1e-4) assert(abs(fmin-f(xr2))<1e-4)

xmin = 3.0769 0.3077 fmin = 10.4141

5   Fail
f = @(x) sum(x); g = @(x) [x(1) - 2*x(2) - 2 8 - 6*x(1) + x(1).^2 - x(2)]; x0 = [0; 0]; [xmin,fmin]=sumt_exterior(f,g,[],x0) xcorrect=[2; 0]; assert(norm(xmin-xcorrect)<1e-4) assert(abs(fmin-f(xcorrect))<1e-4)

Exiting: Maximum number of function evaluations has been exceeded - increase MaxFunEvals option. Current function value: -16411457251769665455846422849268125532160.000000 xmin = 1.0e+39 * -8.2057 -8.2057 fmin = -1.6411e+40

Assertion failed.

6   Fail
f = @(x) sum(x); g = @(x) [x(1) - 2*x(2) - 2 8 - 6*x(1) + x(1).^2 - x(2)]; x0 = [5; 5]; r = [1, 2]; [xmin,fmin]=sumt_exterior(f,g,[],x0,r) % 2 iterations xr2=[1.9536 -0.0496]; assert(norm(xmin-xr2)<1e-4) assert(abs(fmin-f(xr2))<1e-4)

Exiting: Maximum number of function evaluations has been exceeded - increase MaxFunEvals option. Current function value: -2722258935367506498781177244824970985472.000000 Exiting: Maximum number of function evaluations has been exceeded - increase MaxFunEvals option. Current function value: -115020910701357813767656573658964655134023409740136896583755935285497145111827447808.000000 xmin = 1.0e+82 * -5.9977 -5.5044 fmin = -1.1502e+83

Assertion failed.