Firstly, I modeled the optimal power flow (OPF) problem and solved it successfully. Then I try to add some binary variables to denote the state of unit.
But it is strange that the problem cannot be solved correctly, matlab will show that "infeasible".I have tested the program by assigning the variables value, which should be the right solution to the problem. In this case, the result is the right solution, which have been assigned. (I think that proved the constraints are right.)
Besides, the YALMIP seems to solve it by 'bnb'. I have tried different solvers, such as gurobi, cplex. But it will warning: solver not applicable (gurobi/cplex). So I guess it's because the problem is nonconvex. Because my model contains the power flow constraints, which must be nonconvex. When solving OPF problem, the solvers are efficient enough to get the result, but when solving the nonconvex MIP problem (Unit Commitment problem), the solvers are not efficient enough. And just because that the problem is nonconvex, the solvers (gurobi/cplex) are not applicable.
But that's just my guess, I think there are many experts here who can help me find the cause of the problem.
Thank you very much! I hope my poor English has not caused you too much trouble.
The code is too long, and it includes some script and functions. So I think it's useless. If necessary, please tell me, I will update them as soon as possible!