Code Monkey home page Code Monkey logo

Comments (8)

jfowkes avatar jfowkes commented on August 18, 2024

Hi @pangtai6,

Good questions, in reply:

  1. You can only set the parameters and values printed by pycutest.print_available_sif_params(), so for example for BROYDN7D it tells us that
>>> pycutest.print_available_sif_params('BROYDN7D')
Parameters available for problem BROYDN7D:
N/2 = 5 (int, n=10 original value) 
N/2 = 25 (int, n=50) 
N/2 = 50 (int, n=100) 
N/2 = 250 (int, n=500) 
N/2 = 500 (int, n=1000) 
N/2 = 2500 (int, n=5000) [default]
N/2 = 5000 (int, n=10000) 
End of parameters for problem BROYDN7D

which means we can only set N/2 to one of the values listed:

>>> problem = pycutest.import_problem('BROYDN7D', sifParams={'N/2':250})
>>> problem.n
500

if you want other values of N/2 you have to put them into the BROYDN7D.SIF file (this is how CUTEst is designed).

  1. Newton's method is not 'globally convergent' meaning that it needs a 'globalisation strategy' to ensure that it converges from any starting point for nonlinear problems. This can be linesearch (or trust-region, etc) but for linesearch you need a backtracking Armijo linesearch at minimum: a fixed step size is not guaranteed to converge from any starting point for general nonlinear problems (see the Line Search chapter of Nocedal & Wright's Numerical Opimization for details).

from pycutest.

pangtai6 avatar pangtai6 commented on August 18, 2024

Thank you very much for your clarity. Wish you a happy life.

from pycutest.

pangtai6 avatar pangtai6 commented on August 18, 2024

Excuse me, why can't I find the local minimum by changing the initial point here, using the line search Newton method?
image
image

from pycutest.

lindonroberts avatar lindonroberts commented on August 18, 2024

For your example code, you need to resample the gradient/Hessian at each iteration after you have taken your step (after line 36), so the new step calculation in the next loop iteration uses the gradient/Hessian at the new value of x.

from pycutest.

pangtai6 avatar pangtai6 commented on August 18, 2024

When I import the numpy and scipy, the program will report an error. The result is as follows:
image
exercise2.py.zip
The zip folder contains the code.
Could you help me, please?

from pycutest.

jfowkes avatar jfowkes commented on August 18, 2024

I see that you're running IPython in the Python Console, please change this to your standard Python Interpreter that you installed pycutest with:
https://www.jetbrains.com/help/pycharm/using-consoles.html#python-console-settings

from pycutest.

pangtai6 avatar pangtai6 commented on August 18, 2024

I see that you're running IPython in the Python Console, please change this to your standard Python Interpreter that you installed pycutest with:
https://www.jetbrains.com/help/pycharm/using-consoles.html#python-console-settings

I tried it out, and the setup in pycharm was ok, I found it was acceptable not to use the "scipy" package alone, and the "pycutest" instruction worked fine; Similarly, the commands in the "scipy" package will work fine without calling "pycutest". There might be a conflict between the two commands.
7581685699039_ pic_hd

from pycutest.

pangtai6 avatar pangtai6 commented on August 18, 2024

I found the problem and corrected the program. Thank you very much for your reply.

from pycutest.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.