Optimization with sum and max function

Hi. I have a difficulty in writing this objective function for optimization. Especially in defining the second term and the summation. Should I make nested optimization for this?
Sum {[I * (x(i) - x(i-1) + lo(i) - g(i)) * p(i)] + max [I * (x(i) - x(i-1) + lo(i) - g(i)) * pfix]}
I = 1 if x(i) - x(i-1) + lo(i) - g(i)) * p(i) > 0 ; otherwise I = 0
for i = 1:24
Thanks in advance!

답변 (1개)

Walter Roberson
Walter Roberson 2016년 4월 4일

0 개 추천

When I = 1 if x(i) - x(i-1) + lo(i) - g(i)) * p(i) > 0 ; otherwise I = 0, then [I * (x(i) - x(i-1) + lo(i) - g(i)) * p(i)] is
max(0, (x(i) - x(i-1) + lo(i) - g(i)) * p(i))
so
max [I * (x(i) - x(i-1) + lo(i) - g(i)) * pfix]
is
max( max(0, (x(i) - x(i-1) + lo(i) - g(i)) * p(i)) * pfix )
Note: that max would only make sense to calculate if pfix is a vector
It is possible to vectorize the sum, but the details of the method would depend upon the orientation of x and lo and g and p and pfix

댓글 수: 4

Nana
Nana 2016년 4월 5일
How can I define that the decision variable is only x(i); and x(i-1) value is from the previous optimization step?
Walter Roberson
Walter Roberson 2016년 4월 5일
That formula does not permit that interpretation. The Sum has to be a sum over i for the formula to make sense.
Nana
Nana 2016년 4월 6일
In other words, you suggest to use loop for that objective function other than vectorized?
Walter Roberson
Walter Roberson 2016년 4월 6일
The objective function you wrote can likely be vectorized. I would need to know whether x, lo, g, p, and pfix are row vectors are column vectors, and I need an idea of the size of pfix in order to vectorize the max() term properly.
However, more recently you asked "How can I define that the decision variable is only x(i); and x(i-1) value is from the previous optimization step?". If that were the case, there would not appear to be anything to Sum over. Are you asking how to calculate one term of it without the Sum ?

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

카테고리

도움말 센터File Exchange에서 Annotations에 대해 자세히 알아보기

질문:

2016년 4월 4일

댓글:

2016년 4월 6일

Community Treasure Hunt

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

Start Hunting!

Translated by