Edit: Of course, if this is the entirety of your problem, you could solve it by brute force enumeration and calculation of the objective value (if N is small enough) for all N! (if P is N by N) possible values of P, and picking the best.
Thank you very much! I have applied the Mixed integer Optimizer from MOSEK in cvx (latest version) to try to solve the problem. The number of all enumerations is 23!x33!, very huge… So brute force enumeration may be not suitable for the problem. I’ve tried the Mixed integer Optimizer and it could yield the solution. But there are two problems:
I implemented the same code (and the same data) in two different computers, but for the two computers, the solutions were different when convergence attained.
When the solver attained convergence in solution, I cannot stop the cvx program in MATLAB using Ctrl+C.
I am curious where does the problem comes from? Thanks!
Thanks for your helpful suggestion! The unstoppable problem in mosek really existed for some computers, but not for all. I don’t know why and also don’t know how to solve it after many attempts. Instead I used Gurobi, and found it worked well and there were no such problems. Though it is much slower than mosek.