Optimum input to minimise a result matrix
Show older comments
Hi all,
I have a 100+ test that shows me a qualitiy of a process.
For one test, there is an input (4x150) and as a result there is a matrix(260x260) that shows process quality. I want to minimize the result matrix(minimum is desired, means more quality).
To improve result matrix, I want to develop an algorithm that process all 100+ test data with input and output and show me best input for desired result(minimum matrix).
Is it possible, which tool should I use ?
I know the question is too generic, any help will be appreciated.
Best Regards
3 Comments
Aquatris
on 2 Mar 2020
It is simple. You formulate the optimization problem using a cost function and define the variables to be optimized. Then, solve it with any built-in matlab function or community-supplied function. Some example built-in functions include fmincon and ga. My personal favorite toolbox is OPTI Toolbox, an open-source toolbox for matlab.
You need to be more specific with your question. What do you mean by "minimum matrix"? what norm you using to obtain the minimum? What are the decision variables? How do they enter into the equations? etc
Alper Bilgiç
on 2 Mar 2020
Aquatris
on 3 Mar 2020
I am not an expert in this but you can formulate this as following using OPTI Toolbox (pretty similar in MATLAB built-in functions);
First, define your function that outputs the A matrix given the decision variables;
function A = fun(x)
% calculate your A here however you do it
A = someFunctionOfX;
end
Then, in the script you define;
Ades = [...]; % desired values of A
x0 = [...]; % initial guess for x
Opt = opti('fun',@fun,'ydata',ydata,'x0',x0); % Create OPTI Object
% Solve the NLS (nonlinear least-square problem (min||Ades-A||_2)
[x,fval,exitflag,info] = solve(Opt)
Then, if things go smoothly, you will obtain the x that would give you the desired A. Try to initiate the optimization using different x0 if you do not get good results in your first try. Or formulate the problem differently to use different solvers.
Hope this helps.
Answers (1)
Sai Bhargav Avula
on 26 Mar 2020
1 vote
Hi,
Adding Aquatris answer, you can also try fmincon and least squares fitting and formulate your problem accordingly.
Hope this helps!
Categories
Find more on Get Started with Optimization Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!