Using a Optimization Variable for an If Statement

4 visualizaciones (últimos 30 días)
Micah Mungal
Micah Mungal el 30 de En. de 2019
Respondida: Alan Weiss el 31 de En. de 2019
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.

Respuestas (1)

Alan Weiss
Alan Weiss el 31 de En. de 2019
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

Categorías

Más información sobre Linear Programming and Mixed-Integer Linear Programming en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by