Borrar filtros
Borrar filtros

Optimization problem: how to limit number of transitions from 0

1 visualización (últimos 30 días)
Chiara
Chiara el 22 de Abr. de 2024
Respondida: Sameer el 22 de Mayo de 2024
Hello everyone
I am developping a solution for an optimization problem whose output x is made of 24 variables, like follows.
min(x) f'*x s.t. min_p <=x(i) <= max_p (48 constraints)
Among the other constraints I should add a constraint (maybe other 24 constraints) which limit the maximum number of startups.
For a simple understanding of what I have to reach:
everytime the optimizer evaluates a solution where x(i) is 0 and x(i+1)>0, total_startups = total_startups +1;
and in the end total_startups <= max_startups.
I am starting using intlinprog and thinking about the idea to write some constraints where to use integer variables (BIM).
Can you suggest any idea?

Respuestas (1)

Sameer
Sameer el 22 de Mayo de 2024
Hi Chiara
To model the constraint that limits the maximum number of startups in your optimization problem, you can indeed use binary integer variables and additional constraints. The idea is to introduce binary variables that capture the "startup" event, i.e., when your system transitions from an off state (x(i) = 0) to an on state (x(i+1) > 0). Let's denote these binary variables as y(i) for i = 1, ..., 23 (since a startup can only occur between these intervals in a 24-period model).
Here's how you can approach this:
Define Binary Variables: For each interval i where a startup can occur, define a binary variable y(i) that takes the value 1 if a startup occurs between x(i) and x(i+1).
Startup Detection Constraints: For each i = 1, ..., 23, you need constraints that force y(i) to be 1 if x(i) = 0 and x(i+1) > 0. This can be achieved by using big-M method constraints. You'll select a sufficiently large positive number M that is greater than any possible value of x(i+1) when x(i+1) > 0.
The constraints can be formulated as:
x(i+1) - M*y(i) <= 0 for i = 1, ..., 23
This ensures that if x(i+1) > 0, then y(i) must be 1 to satisfy the constraint, because M is large. If x(i+1) = 0, y(i) can be 0, satisfying the constraint without triggering a startup.
Limiting Total Startups: To ensure the total number of startups does not exceed max_startups, you can add the following constraint:
Additional Considerations: Ensure that your choice of M is large enough to not interfere with the feasibility of other constraints but not excessively large to cause numerical stability issues in the solver.
Implementation in intlinprog: Define your binary variables and add the constraints as described above. Remember to declare y(i) as binary variables in the solver.
I hope this helps!
Sameer

Productos


Versión

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by