How to optimize analityc function in GPdotNET

This is short tutorial how to use GPdotNET in order to find global optimum of analytically defined function.

Let’s take an example of not so simple function. The picture below shows graph of the function. The function has two local minimum in interval from -5 to 5.


Analytic term of the function is: 2b516ec5b2eb31fa2fc2ceed6d96b1e2.


To be sure that we are dealing with the correct result, first we will find the optimum from Wolfram Alpha. The picture below shows global optimum of our function, calculated by Wolfram Alpha.


From the above we see that global minimum can be found for X=-2.93536, and corresponded optimal value is y=-2,377.

So let’s try to find this optimum with GPdotNET v2.

1. Open the GPdotNET and choose New.



2. Select Optimization of Analytic Function radio box

3. Click OK button.

4. Optimization module appears on the screen.


Now we need to define function in analytic form. As we have previously seen in blog post:

5. Select ” +” function from Function combo box and press Add Function button.

6. Click on left outer node

7. Select “/” function and press Add Function button.

8. Select left outer node

9. Select Mul4 function and press Add Function button.

10. For each outer node of Mult4 function add + function, similar like previous.

11. For each left outer node of + function , add Param Name X1 and press Add Param buton.

12. For right node add 4,1,-1,-3 param from left to right.

13. For right node of Mul4 function add 14 param.

14. For right node of / function add 0,5 param.

After you finish you get the following picture:


15. Press Finish button and select Optimize Tab page.

16. Select X1 variable in List View control for defining variable range

17. Enter -10 for min and 15 for maximum and press update button.

18. Select Minimize check box, for minimum.

19. Now we can perform optimization by press Optimize toolbar icon.

20. After very short period of time you get the following picture:


From picture above we can see that we got Xmin=-2,935 and Ymin=-2,9377, exactly as we got when we have performed optimization by Wolfram Alpha.

With GPdotNET v2 you can optimize any analityc function, regladles of number of inut variables.


2 thoughts on “How to optimize analityc function in GPdotNET

  1. Pingback: Function optimization with Genetic Algorithm by using GPdotNET | Bahrudin Hrnjica Blog

  2. hai. I have followed the intructions as posted in your tutorial. But when i wanted to run/optimize, the message box said ‘GPModel must be created’. how to create the model?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s