Optimization of discontinuous function where function constants come from an array.

5 ビュー (過去 30 日間)
Amalia Diaz
Amalia Diaz 2019 年 7 月 25 日
コメント済み: Matt J 2019 年 7 月 29 日
Hello!
I am sort of new to matlab and haven't been able to find a clear answer to my problem. Thanks in advance for the help! Here's the issue:
I am analyzing solar power production (x) with an hourly resolution (8760 hours in a year) over 15 years. I want to minimize "forgone revenues" in a proyect defined by the sum of energy that can't be used (N) throughout the whole proyect (reason irrelevant here). So my optimization problem is:
A and m are different for every hour and every year, i.e. each is an 8760x15 array.
The issue here is that I don't know how to define N so that I can find the optimum with Matlab since it is also an 8760x15 array. I assume an if-else statement won't work as an input to a the Optimization toolbox functions such as linprog(), fmincon() or ga(). I tried a piecewise / handle function:
N = @(x) (0).*((Ax + m)<=n) + (Ax + m - n).*((Ax + m)>n);
But the conditional doesn't seem to work when I evaluate it with feval. For example, for lower values of x I am 100% sure I should get some N=0, but I don't. I assume the handle function doesn't work when the function constants are arrays.
Also, I believe linprog() and fmincon() won't work for discontinuous functions, any suggestions on what optimization function I might be able to use?
I am so new that I am not sure what else I should explain, so feel free to ask questions to help me solve mine. Thanks again!
  2 件のコメント
Torsten
Torsten 2019 年 7 月 25 日
編集済み: Torsten 2019 年 7 月 25 日
Try A*x instead of Ax :-)
And I'd use
N_i,y = max(0,A*x+m-n).
Amalia Diaz
Amalia Diaz 2019 年 7 月 25 日
編集済み: Amalia Diaz 2019 年 7 月 25 日
Thank's for the fast reply Torsten! That works to define the function quite well.
What function would you suggest to run the optimization? For this problem my constraints depend on that same N, so they are dependent constraints, that is:
N_i,y - U_i,y = n - m; where U is a function similar to N_i,y in form
and
A*x <= n - m; (This one doesn't depend on N , though)
Thank you!

サインインしてコメントする。

採用された回答

Matt J
Matt J 2019 年 7 月 25 日
Reformulate the problem as the following linear program in x and N_{i,y}
The solution has to have the property that N_{i,y}=max(0,A*x+m-n), because otherwise there would be room to further reduce N_{i,y} without violating the constraints.
  2 件のコメント
Amalia Diaz
Amalia Diaz 2019 年 7 月 25 日
Thank you! I'll try this and see if it works.
Matt J
Matt J 2019 年 7 月 29 日
You're welcome, but if it does work, please Accept-click the answer.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSolver 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