Python Forum
Minimize function with SciPy
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Minimize function with SciPy
#1
Hello everyone,
I'm currently trying to minimize a function using a Python algorithm. The function is a bit complicated and requires an FEA solver to be calculated. Anyway, I was able to define my function in the classical way according to the parameter I'm trying to optimize:
def fonction_calcul(Parametre1):
      blabla function definition
      return function value
As this last function definition works well, I can easily get the values of my calculation_function for the parameter values I want. Knowing this, I thought I could then "foolishly" use scipy.optimize to find the minimization value of my function, but alas, it doesn't work!
Here's what I get starting with x=1

x_start=1.0
>>>	
result = spo.minimize(fonction_calcul, x_start)
>>>	
result
      fun: 106.69134802297765
 hess_inv: array([[1]])
      jac: array([0.])
  message: 'Optimization terminated successfully.'
     nfev: 2
      nit: 0
     njev: 1
   status: 0
  success: True
        x: array([1.])
Overall, as you can see, minimize calculates a single value and stops at this value, considering that it has optimized well (knowing that in this case, the minimization value is around 0.03...).

I've tried minimize with a "classic" function (polynomial) and it works well for finding the minimization value...

Any idea how to make minimize function in my case?

Thanks a lot!
Pierre
Reply


Messages In This Thread
Minimize function with SciPy - by PierreLCV - Apr-03-2024, 09:29 AM
RE: Minimize function with SciPy - by paul18fr - Apr-03-2024, 10:03 AM
RE: Minimize function with SciPy - by PierreLCV - Apr-03-2024, 12:06 PM
RE: Minimize function with SciPy - by paul18fr - Apr-05-2024, 07:51 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to edit Tkinter Minimize, Maximize, and Close Buttons kucingkembar 7 434 Apr-26-2024, 11:36 AM
Last Post: kucingkembar
  How to Minimize ADB window OomKoos 0 426 Dec-29-2023, 12:41 PM
Last Post: OomKoos
  Can I minimize the code??? shantanu97 4 2,368 Mar-23-2021, 05:26 PM
Last Post: jefsummers
  How to use scipy.optimization.brute for multivariable function Shiladitya 9 6,385 Oct-28-2020, 10:40 PM
Last Post: scidam
  ModuleNotFoundError: No module named 'scipy.optimize'; 'scipy' is not a package AaronKR 1 10,385 Jul-09-2020, 02:36 AM
Last Post: bowlofred

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020