# Using maximum of optimisation variable as an upper bound for another variable

2 ビュー (過去 30 日間)
Michael-Allan Millar 2019 年 8 月 12 日
コメント済み: Matt J 2019 年 10 月 7 日
Hello
I am trying to minimise a cost function where the investment cost is the the maximum value of an optimisation variable multiplied by the cost e.g.
Total cost=Cost per kW*MaxkW
However, matlab doesn't seem to like using an optimisation variable as a boundary condition.
Any solutions?
Thanks
Michael

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

### 採用された回答

Matt J 2019 年 10 月 7 日

Solve N different sub-problems
for j=1:N
prob.Constraint.TotalCost = sum(x)=CostPerkW*x(j);
prob.Constraint.Max = x(j)>=x; %x(j) is the maximum
[X{j} Cost{j}]=solve(prob)
end
and take the X{j} with the lowest Cost{j}.

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

### その他の回答 (4 件)

Ted Shultz 2019 年 8 月 21 日
you can do a bounded obtimization using this file from filecentral: fminsearchbnd

#### 0 件のコメント

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

Bruno Luong 2019 年 8 月 21 日
Not sure what you mean by "boundary condition" (there is no such thing in all optimization frameworks as far as I know), but take a look at fminmax

#### 0 件のコメント

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

Naveen Venkata Krishnan 2019 年 10 月 7 日
Hello Micheal,
Based on the question, I understood the problem in this way , please correct me if am wrong :
"You want to minimize a cost function in such a way that optimization variable lies close to its upper boundary region ".
If this the requirment one way to do it to confine the search space of the optimizer close to upper boundary ( like giving the values of upper - ub and lower boundary - lb of the optimzation variable around the maximum value of the optimization variable ) .
Another way is by using an enforcement operator, i think the following IEEE paper may be of some help to you reg this.

#### 0 件のコメント

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

Michael-Allan Millar 2019 年 10 月 7 日
Thanks very much for the help, everyone.
Basically, it's sizing a tank and heat pump. So the bigger the tank, the lower the operating cost but greater initial investment. I ended up doing it the way Matt J suggested, but was hoping there would be a way to give a single answer, rather than having to produce a list then manually picking the smallest cost.
Thanks again!
Michael

#### 1 件のコメント

Matt J 2019 年 10 月 7 日
Well, you don't have to "manually" pick. You would just do
[~,jmin]=min([Cost{:}]);
x=X{jmin};

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

R2019a

### Community Treasure Hunt

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

Start Hunting!

Translated by