*There is still problems with W being singular. I have changed R and monte_M to be as big as in the original code. Either I neglected something, or there is still a bug. Or perhaps it's just normal. See [[File:a copy of warning messages from Matlab command windows.pdf]]. When W is singular, this leads to fitness function for the second stage ga being minimized to negative infinity.
*I am trying to put gurobi into a parfor in Matlab. So far, not good. Wanted to figure out how to do CPU-based parallel computing with Gurobi. I cannot find a way to run Gurobi solvers inside a parfor. I believe Matlab's linprog can, but linprog is much slower than Gurobi. There will be some trade off. I need to test this.
2018-07-06
I really need to understand the code better. Also we probably can run Gurobi inside parfor, but I need to wrap it around inside a function.