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

6 次查看(过去 30 天)
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 个评论
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.

更多回答(0 个)

类别

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