fminsearch question

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

fminsearch question

Octave - General mailing list

Hello Octave team,

 

Is it possible to pass parameters into the optimized function using fminsearch?  Matlab allows it but Octave doesn’t seem too. If not, is there any workaround solution?

 

Thank you

Ruslan

 



Reply | Threaded
Open this post in threaded view
|

Re: fminsearch question

nrjank
Administrator
On Tue, Apr 14, 2020 at 7:00 PM Bikbov, Ruslan via Help-octave <[hidden email]> wrote:

Hello Octave team,

 

Is it possible to pass parameters into the optimized function using fminsearch?  Matlab allows it but Octave doesn’t seem too. If not, is there any workaround solution?



It appears from the help for fminsearch for Octave:

and matlab:
 
that they both take options the same way using optimset.  that said, the octave help does say that the only supported options currently are: "TolX""MaxFunEvals""MaxIter""Display"

If matlab permits other options that you need, you may need to find another solution.



Reply | Threaded
Open this post in threaded view
|

RE: fminsearch question

Octave - General mailing list

Thank you. What I mean is I have a function that depends on a parameter. Say my function is f(x,a) where “x” is the variable I optimize and  “a” is a parameter. How can I pass parameter “a” to fminsearch in Octave?

 

From: [External] Nicholas Jankowski <[hidden email]>
Sent: Tuesday, April 14, 2020 7:59 PM
To: Bikbov, Ruslan [ICG-RSCH]
Cc: [hidden email]
Subject: Re: fminsearch question

 

On Tue, Apr 14, 2020 at 7:00 PM Bikbov, Ruslan via Help-octave <[hidden email]> wrote:

Hello Octave team,

 

Is it possible to pass parameters into the optimized function using fminsearch?  Matlab allows it but Octave doesn’t seem too. If not, is there any workaround solution?

 

 

It appears from the help for fminsearch for Octave:

 

and matlab:

 

that they both take options the same way using optimset.  that said, the octave help does say that the only supported options currently are: "TolX""MaxFunEvals""MaxIter""Display"

 

If matlab permits other options that you need, you may need to find another solution.

 



Reply | Threaded
Open this post in threaded view
|

Re: fminsearch question

mmuetzel
Am 15. April 2020 um 14:52 Uhr schrieb "Bikbov, Ruslan via Help-octave":
> Thank you. What I mean is I have a function that depends on a parameter. Say my function is f(x,a) where “x” is the variable I optimize and  “a” is a parameter. How can I pass parameter “a” to fminsearch in Octave?

You could use anonymous functions for that use case:
x_opt = fminsearch(@(x) f(x,a), x0, ...)

HTH,
Markus



Reply | Threaded
Open this post in threaded view
|

RE: fminsearch question

Octave - General mailing list
Thank you very much!

-----Original Message-----
From: [gmx.de] Markus Mützel <[hidden email]>
Sent: Wednesday, April 15, 2020 9:02 AM
To: Bikbov, Ruslan [ICG-RSCH]
Cc: Nicholas Jankowski; [hidden email]
Subject: Re: fminsearch question

Am 15. April 2020 um 14:52 Uhr schrieb "Bikbov, Ruslan via Help-octave":
> Thank you. What I mean is I have a function that depends on a parameter. Say my function is f(x,a) where “x” is the variable I optimize and  “a” is a parameter. How can I pass parameter “a” to fminsearch in Octave?

You could use anonymous functions for that use case:
x_opt = fminsearch(@(x) f(x,a), x0, ...)

HTH,
Markus