MATLAB Answers

0

Using a Optimization Variable for an If Statement

Micah Mungal さんによって質問されました 2019 年 1 月 30 日
最新アクティビティ Alan Weiss
さんによって 回答されました 2019 年 1 月 31 日
Hi, I am trying to solve a unit commitment problem in MATLAB using intlinprog. I have set up a optimization variable to keep track of the state of the units and was able to solve the Unit Commitment problem by itself. However, I now have to modifiy the code with my own algorithm for the operation of battery storage, the operation of which is dependent on the change in the number of units committed from hour to hour. So I decided to compare the optimization variable which keeps track of the state of the units and ran into the following error: Conversion to logical from optim.problemdef.OptimizationConstraint is not possible. Any advice on how I can go around this problem. And the optimization variable which keeps track of the state of the units is necessary as it part of the optimization problem.

  0 件のコメント

サインイン to comment.

1 件の回答

Alan Weiss
回答者: Alan Weiss
2019 年 1 月 31 日

Generally, you have to encode these kinds of if-then switches using a more complex, but still linear, MILP set of variables. For examples, take a look at these:
Optimal Dispatch of Power Generators, Problem-Based I think that this is the most relevant example. The logic for Set the Generator Startup Indicator Variables is essentially the sort of if-then logic that I think would work for your case.
Factory, Warehouse, Sales Allocation Model: Problem-Based also shows using auxiliary indicator variables y.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation

  0 件のコメント

サインイン to comment.



Translated by