Dear MATLAB users and MathWorks support team,
I cannot find a solution to represent an optimization problem in MATLAB in which variables in the objective function can take on a two-part value range. The variable in the objective function should correspond to the thermal output of a heat pump in a central heating system. The variable should be able to assume the values 0 (heat pump off) and all values between 100 and 400 (heat pump on with an output between 100 and 400 kW).
x ∈ {0} ∪ [100, 400]
Do you know of a way to implement this condition? I would very much appreciate an answer or the opportunity to discuss this in more detail.

 채택된 답변

Stephan
Stephan 2024년 6월 11일

0 개 추천

You could try to define 2 variables x1 and x2 as the solution. x1 is an integer that assumes either 0 or 1 and x2 corresponds to the interval of the output of your heat pump. The actual output is the product of x1 and x2. This should solve your problem.

댓글 수: 3

Marius Buck
Marius Buck 2024년 6월 11일
Dear Stephan,
I've already thought about it too. As I understand it, this would lead to mixed-integer nonlinear programming, for which I could use the solvers ga and surrogateopt. I have tested this approach with both the solver ga and the solver surrogateopt. Unfortunately, due to the large number of variables (hourly for 3 different heat generators for a period of 2 days, i.e. at least 144), I was unable to achieve a meaningful result. Do you have any idea how I can fix this?
Kind regards
Marius
Stephan
Stephan 2024년 6월 12일
편집: Stephan 2024년 6월 12일
Can you share your code? This would make it easier for contributers to help you. You could also read here - maybe this is helpful.
Maybe it would be useful to adress this topic in a new question.
Marius Buck
Marius Buck 2024년 6월 13일
Dear Stephan, I found out about another way to solve the problem from Matlab Support. It is possible to keep the problem as a linear MILP and thus solve it with the intlinprog solver.
The trick is to use binary indicator variables. Information on this can be found here, for example:

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

추가 답변 (0개)

카테고리

제품

릴리스

R2023b

질문:

2024년 6월 11일

댓글:

2024년 6월 13일

Community Treasure Hunt

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

Start Hunting!

Translated by