06-09-2025 03:38 AM
Hello everyone, I have been practicing Unconstrained Optimization VI recently. I'm wondering if it can find the maximum value and F (maximum value).
Solved! Go to Solution.
06-09-2025 11:11 AM
Unconstrained Optimization is a "minimization" algorithm, so it by default always looks for the smallest value, not largest.
But since you pass in your own function, you should just be able to either set your function to output either its reciprocal or inverse, and then it will essentially search in reverse.
06-10-2025 07:31 AM
Oh thank for your reply!
I think I understand what you mean.
If you can give me a simple example maybe I can understand it more clearly!
06-10-2025 11:43 AM
Sure...
If you do a "create constant" on its "objective function" input, it shows you a reference to a VI with a certain connection pane:
I then created that VI myself, and created a static reference to it. I have a call to the VI here. I chose "Downhill simplex" because it gave the best results, but for yours, check them all.
This is that VI:
Most details are unimportant. It's an optical calculation designed to minimize area. But you can see the function has an output directed at the f(x) indicator, and that's what the "Unconstrained Optimization VI" tries to make as small as possible.
If I had wanted to make it as large as possible instead, I could have just inserted a reciprocal function right at the very end:
A "Negate" node to make it negative would likely work too.
06-10-2025 11:59 AM
Of course of the function is a paraboloid, there is exactly one minimum, but an infinite number of infinite maxima. 😄
06-10-2025 01:38 PM
I understand your idea. After using your method, my function will indeed become infinite.
In addition, I have another problem. I would like to have my two variables perform from 0 to 100 and find the maximum F(X) and the best variable solution therein.
06-10-2025 01:45 PM
You can just calculate your function in a grid, iterating over the two variables in a stack of two FOR loops.
Array max will give you the maximum array element (quantized to the 100x100 grid) and its indices. You can use the indices to get the corresponding value of the two input ramps.
I don't understand your term "best variable therein" Do you want to do a bounded search in the grid square around that max?
06-10-2025 03:36 PM
Row 0 is variable A, and row 1 is variable B.
I hope that every item in A can be matched with every item in B and brought into my function.
Just like the following:
(A,B) = (1,0.1), (1,0.2), (1,0.3)...
So according to the above example, there will be 25 sets of answers.
I hope to find the maximum value F(X) among these 25 solutions, and what is the (A,B) of the solution?
06-11-2025 12:58 AM
Hello, I would also like to ask you about the meaning of the value of the "start" input in Unconstrained Optimization.
06-11-2025 02:26 AM
The attached file is my simple example. I hope to find the maximum solution, as well as the Q and a0 of the solution.