필터 지우기
필터 지우기

Optimisation: minimise function while maximising a design variable

조회 수: 10 (최근 30일)
hugo c
hugo c 2021년 9월 26일
편집: Matt J 2021년 9월 29일
I am trying to perform an optimisation of a function that contains 2 design variables, R and L. The aim of the optimisation is to minimise the function, however I know that there are more than one combination of the design variables that will give this minimum. What I want is the design variables for the minimum solution but where R is at its maximum possible.
I have tried using fmincon with limited success, however the initial conditions determine which of the design variable combinations are given as the optimal solution. I have also looked into the global optimisation toolbox, which is helpful for finding the global minimum but I can't work out how to use for my problem where there are multiple of the same value minimum.
Is there a way of doing this built into MATLAB? The only other thing I was thinking to try is to do multiple fmincon optimisations at different initial conditions and output the one with highest R. However this would take a lot longer to process and maybe wouldnt be guaranteed to find the maximum R?
Any help/ suggestions would be much appreciated
  댓글 수: 2
Max
Max 2021년 9월 26일
편집: Max 2021년 9월 26일
You could try to substract R to the objective function:
O'-->O(R,L)-R.
It's often a good idea to do multiple starting points. fmincon is a gradient based local method so it might not converge to the most optimal solution if the landscape is not favourable.
It might be usefull to think also what is a succesful result (ie O<a, R>b)...
You can save time by running the code in parallel.
hugo c
hugo c 2021년 9월 29일
Thats sounds great, I will give it a go with a few different starting points and see any changes. Could you just explain a bit more about the effect subtracting R from the objective function and how that would work?

댓글을 달려면 로그인하십시오.

답변 (2개)

Alan Weiss
Alan Weiss 2021년 9월 26일
Perhaps you can change the optimization in a nearly unnoticeable way that would bias solutions to have large values of R, like this (you can change 1e-8 to a value that suits you):
function y = myfun(x)
R = x(1);
L = x(2);
% Include y (objective) calculation here.
% Then:
y = y - 1e-8*R; % Bias to large value of R
end
Alan Weiss
MATLAB mathematical toolbox documentation
  댓글 수: 2
hugo c
hugo c 2021년 9월 29일
Thanks alot Alan, as I have replied to the comment above, would you mind explaining a bit more about how subtracting the R from the objective function works? I dont quite understand how that would bias for a large R. I will give it a go anyway in the meantime and see how it goes!
Matt J
Matt J 2021년 9월 29일
편집: Matt J 2021년 9월 29일
By subtracting a multiple of R, you make x with small values of R incur higher cost. As you increase the multiplicative weight, priority will be placed on maximizing R and less priority on minimizing L. You want to choose the weight to achieve some acceptable compromise.

댓글을 달려면 로그인하십시오.


Matt J
Matt J 2021년 9월 29일
편집: Matt J 2021년 9월 29일
Another approach would be to first minimize L with fmincon.
[x0,L0]=fmincon(@(x) L(x),x00,____) %Problem (A)
Then, maximize R subject to a nonlinear equality constraint L(x)=L0,
x=fmincon( @(x) -R(x),x0,____, @(x)nonlcon(x,L0)) %Problem(B)
function [c,ceq]=nonlcon(x,L0)
c=[];
ceq=L(x)-L0;
end
Note that this will only do anything meaningful if Problem (A) has a continuuum of solutions in the neighborhood of x0. You cannot use fmincon to maximize R(x) reliably over a discontiguous set of feasible solutions x.

카테고리

Help CenterFile Exchange에서 Solver Outputs and Iterative Display에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by