Is there a way to force the kernel to quit if some code runs for x seconds? Currently, I have:
TimeConstrained[ FindMinimumCostFlow[ mat0, Join[supplyamount, demandamount]]; TimeRemaining, 1]
As above, I am using FindMinimumCostFlow and want it to abort if it runs for more than 1 second. However, this line has been running for over 30 minutes and still refuses to stop.
Does anyone have any suggestions? I also tried
TimeConstrained[ FindMinimumCostFlow[ mat0, Join[supplyamount, demandamount]]; TimeRemaining, 1, Quit]
Which also doesn't work.
For some context, FindMinimuCostFlow seems to hang for seemingly random sets of parameters (with no discernible pattern). The only way to quit the evaluation is to quit the kernel (it does not respond to "Abort Evaluation"). I am trying to automate the process of quitting the kernel if the evaluation runs overtime and resetting the parameters.