Group Abstract Group Abstract

Message Boards Message Boards

0
|
7.8K Views
|
8 Replies
|
1 Total Like
View groups...
Share
Share this post:

Perform numerical nonlinear global optimization?

Posted 7 years ago

Dear all, the following question is mainly of a theoretical nature, I hope that works out. I have a simulation, the code for it is eternally long, so I can't give it as a minimal example but try to describe my error as good as I can. This simulation depends onthreparameters. So the simulation is a function of three variables and returns an integer as a result. E.g.

function[3.2,1, 2]=70

When I want to guess one of the parameters, depending on the result I am trying for example

NMinimize[
 {(function[x, 1, 2] - 70)^2, 3 < x < 4}, {x, 3, 4}]

The problem now is: the values tried for x are not used in the calculation of my function, e.g. I find in the error code the followin

E^(-0.00476071 x)

Where no value for x is used So I did something wrong in the beginning, what could it be? All the best and thanks in Advance

POSTED BY: Michael Fischer
8 Replies
function[mmm_?NumericQ, nnn_]

I tried to define your function in NMinimize and it runs without error message. However, the function is stochastic in nature. I doubt this type of function is suitable for NMinimize.

issue

POSTED BY: Shenghui Yang

here is the file, I just copied your definition and add a plot function.

Attachments:
POSTED BY: Shenghui Yang

First of all, thank you alot.

Could you upload that file? And I know the issue with the Randomness but I assumed if I do it mutliple times there, it is a start (I had no better idea at the moment)

POSTED BY: Michael Fischer
Attachments:
POSTED BY: Michael Fischer

I do not know what is getting in the way. Here is a simple case that works as I would expect.

function[x_?NumericQ, y_?NumericQ, z_?NumericQ] :=  x + y^3 + z^6

 NMinimize[{(function[x, 1, 2] - 70)^2, 3 < x < 4}, {x, 3, 4}]

(* Out[10]= {1., {x -> 4.}} *)

It may be too simple though, since it would also work without using the ?NumericQ pattern predicate checks.

POSTED BY: Daniel Lichtblau

Dear Daniel, thanks again for the quick reply Just to understand it correctly,

function[x_?NumericQ, y_?NumericQ, z_?NumericQ] := ...

And then, when guessing e.g. x, I use

NMinimize[{(function[x, 1,2] -70)^2, 3 < x < 4}, {x, 3, 4}] ? Because this doesn't work. However, before going into detail, as written in the Link, the solution

NMinimize[{Hold[(function[x,1,2] - 70)^2, 3 < x < 4}, {x, 3, 4}]
NMinimize[{Hold[(function[x,1,2 ] - 70)^2, 3 < x < 4}, {x, 3, 4}]

gives me twice the same result, even my simulation has (more then one) propabilistic effect in it. I assume hold is the reason? But again, no idea why

I'll now try to build a minimal example to represent my problem

POSTED BY: Michael Fischer

Might try defining function a bit differently:

function[x_?NumericQ, 1, 2] := ...

See if that improves matters. if not, more detail will be needed in the question.

POSTED BY: Daniel Lichtblau
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard