![]() |
Simplex method algorith partially working
<p>I am trying to achieve the results from Table 8.6 (please see link). I am only able to reach the first few iterations.
I am following the pseudo code from table 8.5, but not successfully. Please have a look at the attempt and share suggestions. </p> <p><a href="https://rodolfoferro.wordpress.com/2017/02/24/nelder-mead-method/" rel="nofollow noreferrer">https://rodolfoferro.wordpress.com/2017/02/24/nelder-mead-method/</a></p> <p>My code attempt:</p> <pre><code>clc; close all; clear all; B=[1.2 0]; G=[0 0.8]; W=[0 0]; M=[((B(1)+(G(1)))/2) (((B(2)+G(2))/2))]; R=2*M-W; f= @(x) x(1)^2-4*x(1)+x(2)^2-x(2)-x(1)*x(2); Points = sort([f(B),f(G),f(W)]); fprintf('%d %d %d\n',Points) for i=1:5 if f(R) < f(G) if f(G) < f(B) W=R; Points = sort([f(B),f(G),f(W)]); fprintf('%d %d %d\n',Points) else %R=2*M-W; E=2*R-M; if f(E) < f(B) W=E; Points = sort([f(B),f(G),f(W)]); fprintf('%d %d %d\n',Points) else W=R; Points = sort([f(B),f(G),f(W)]); fprintf('%d %d %d\n',Points) end end end if f(R) < f(W) W=R; C = (W+M)/2; Points = sort([f(B),f(G),f(W)]); fprintf('%d %d %d\n',Points) if f(C) < f(W) W=C; Points = sort([f(B),f(G),f(W)]); fprintf('%d %d %d\n',Points) else S = (W+B)/2; W=S; G=M; Points = sort([f(B),f(G),f(W)]); fprintf('%d %d %d\n',Points) end end end </code></pre> <p>I would like to be able to plot the simplex triangle animated as well.</p> <p>Thanks much !!!!!</p> [url=https://stackoverflow.com/questions/59020584/simplex-method-algorith-partially-working]More answer...[/url] |
所有时间均为北京时间。现在的时间是 04:53。 |
Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.