Does anyone studied how to solve optimization mathematical problems in the MQL5 language?

 

such as:

out = F(x) , According to the value range of x, the value of x that maximizes out is obtained.

out = F(x, y) , According to the range of x and y, the value of (x, y) that maximizes out is obtained.

...


The function F is very complicated and cannot be solved mathematically. Only through brute force testing or optimization solution.

But does anyone know how to achieve optimal calculations on MQL5? The ALGLIB library seems to work, but I have not studied it. Can you give a case for the useful ones?

 

Most of post graudate quantitaive course in math, finance and business will cover good amount of knowledge in optimization course. I will recommend reading the relevant books and journals.

--------------------------------------------------------------------------------------------------------------------------------------------------------

But here is some breif introduction.

In optimization, F(x) is called Objective function. It could be either max or min objective function.

What optimization does is searching the parameters space to get the parameter set that either maximize the function or minimize the function depending on your nature of problem.

Depending on the solution surface is linear or non linear, you need to employ the differnt tools.

For example, if your solution surface is linear, then often simplex method or some other linear methods can provide the perfect solution in the feasible space.

If the solution surface is non linear, then you need to employ more complex tools.

Some common tools for non linear solution surface is local optimization and global optimization.

Good example of Local optimization is Newton's method finding solution from partitioning the solution surface. You need to have knowledge on derivatives of the function.

If you do not have it then, you probably need to go for global optimization like Genentic algorithm and simulated annealing stuffs, concept is similar to solving travelling salesman problem.

Optimization is like the race with time.

You need to find a tool that can reduce your search time but need to find the better or best solution in the given time.

In fact, optimization is used everywhere but it is quite hidden. Only few people knows that they are working in the background.

For example, multiple regression, neural network, backtesting, many prediction technolgy, classification, clustering methods and forecasting do requires optimization but various optimzation can be choice.

For example, with multiple regression, the most efficient approach would be finding the direct solution from getting the inverse matrix. But you can alternatively use local optimization like Newton's methods and gradient methods and so.

If do not want to know any math stuff, then you can just plug your regression fuction into genetric algorithm too.

However, here is something you need to watch out.

If you have less knowledge on the objective function and their derivatives, then typically it takes more time to find the good solution. Often it is not optimal.

So you can guess that, in multiple regression, finding the same solution with genetic algorithm takes longest time Plus you are not guaranteed to find the same efficient solution as inverse matrix operation or local optimization.

Considering brute force will take even longer time than genetic algorithm, you will need to use brute force with care.

But if you are trying to solve integer problem, then you might be able to use brute force when there is only few parameters in the equation.

--------------------------------------------------------------------------------------------------------------------------------------------------------

Although above brief explation can provide you some introduction on optimization, it is still considered only fraction of knowledge in the optimiztion.

 
Young Ho Seo:

Most of post graudate quantitaive course in math, finance and business will cover good amount of knowledge in optimization course. I will recommend reading the relevant books and journals.

--------------------------------------------------------------------------------------------------------------------------------------------------------

But here is some breif introduction.

In optimization, F(x) is called Objective function. It could be either max or min objective function.

What optimization does is searching the parameters space to get the parameter set that either maximize the function or minimize the function depending on your nature of problem.

Depending on the solution surface is linear or non linear, you need to employ the differnt tools.

For example, if your solution surface is linear, then often simplex method or some other linear methods can provide the perfect solution in the feasible space.

If the solution surface is non linear, then you need to employ more complex tools.

Some common tools for non linear solution surface is local optimization and global optimization.

Good example of Local optimization is Newton's method finding solution from partitioning the solution surface. You need to have knowledge on derivatives of the function.

If you do not have it then, you probably need to go for global optimization like Genentic algorithm and simulated annealing stuffs, concept is similar to solving travelling salesman problem.

Optimization is like the race with time.

You need to find a tool that can reduce your search time but need to find the better or best solution in the given time.

In fact, optimization is used everywhere but it is quite hidden. Only few people knows that they are working in the background.

For example, multiple regression, neural network, backtesting, many prediction technolgy, classification, clustering methods and forecasting do requires optimization but various optimzation can be choice.

For example, with multiple regression, the most efficient approach would be finding the direct solution from getting the inverse matrix. But you can alternatively use local optimization like Newton's methods and gradient methods and so.

If do not want to know any math stuff, then you can just plug your regression fuction into genetric algorithm too.

However, here is something you need to watch out.

If you have less knowledge on the objective function and their derivatives, then typically it takes more time to find the good solution. Often it is not optimal.

So you can guess that, in multiple regression, finding the same solution with genetic algorithm takes longest time Plus you are not guaranteed to find the same efficient solution as inverse matrix operation or local optimization.

Considering brute force will take even longer time than genetic algorithm, you will need to use brute force with care.

But if you are trying to solve integer problem, then you might be able to use brute force when there is only few parameters in the equation.

--------------------------------------------------------------------------------------------------------------------------------------------------------

Although above brief explation can provide you some introduction on optimization, it is still considered only fraction of knowledge in the optimiztion.

Thank you for your reply. I know the knowledge about optimization , I want to know how to implement these algorithms in the MQL5 language.