Python implementation dichotomy and golden section

  The class operations research, first introduced the planning algorithm for unconstrained nonlinear programming algorithm. Dichotomy and golden section is part of the representative of the one-dimensional search method for unconstrained programming algorithm.

  Dichotomy: $$. 1} ^ {X_ {(. 1 + K)} = \ FRAC. 1} {2} {(R & lt X_ {} ^ {(K) + X_ {L}} ^ {(K)} - \ delta) $$$$ x_ {2} ^ {(k + 1)} = \ frac {1} {2} (x_ {R} ^ {(k)} + x_ {L} ^ {(k)} + \ Delta) $$

  Golden Section: $$. 1} ^ {X_ {(. 1 + K)} = X_ {R & lt ^ {} (K)} - (\ FRAC {\ sqrt {-1}. 5} {2}) (R & lt X_ { } ^ {(k)} - x_ {L} ^ {(k)}) $$$$ x_ {2} ^ {(k + 1)} = x_ {L} ^ {(k)} + (\ frac {\ sqrt {5} -1} {2}) (x_ {R} ^ {(k)} - x_ {L} ^ {(k)}) $$

  Selected $ x_ {1} ^ {(k + 1)} $ and $ x_ {2} ^ {(k + 1)} $ must meet $$ x_ {L} ^ {(k)} <x_ {1} ^ {(k + 1)} <x_ {2} ^ {(k + 1)} <x_ {R} ^ {(k)} $$

  Implementation code dichotomy Golden Section and under the following recording by the Python.

  

Guess you like

Origin www.cnblogs.com/chester-cs/p/11751508.html