Bug introduced in 11.0.0 and fixed in 11.1
I have found that FindMinimum
crahses is a certain situation. Here is my minimal working example:
length = 50;
roundoffErrorMatrix =
10^-10*(# + Transpose@# &@RandomReal[{-1, 1}, {length, length}]);
costMatrix = IdentityMatrix@length + roundoffErrorMatrix;
variables = Table[Unique[], {i, 1, length}];
FindMinimum[{variables.costMatrix.variables, Thread[variables >= -1]},
variables]
FindMinimum[{x^2, x >= -1}, x]
Explanation of code
In the minimal working example there two calls to FindMinimum
. The second call is just a simple example to show some bad behavior that happens; I will explain more after discussing the first call to FindMinimum
.
The first call to FindMinimum
just basically minimizes the square length of a vector (since costMatrix
is essentially the identity matrix), subject to the constraint that the components are all greater than -1.
To set up the first call to FindMinimum
, I first pick length
which gives the dimensionality of the minimization problem. Then I make a simulated round off error matrix, which is necessary to reproduce the error. Then I set my costMatrix
equal to this round off error matrix plus the identity matrix. Lastly, I create an array for the variables for FindMinimum
.
Description of Behavior
Now I will describe what happens when I run the code. I have the code in three cells: the setup, and the two calls to FindMinimum
. The first cell runs just fine. When I run the second cell (first call to FindMinimum
) for the first time, it does just fine.
After running the second cell once, I can do two things, both of which crash the kernel. The first thing I can do is to repeatedly run the second cell again. The other thing that crashes the kernel is to run the third cell once.
Necessary conditions
There are a surprising number of conditions for this bug to occur. There are three by my count:
The dimensionality of the problem (
length
) must be greater or equal to 50.The
costMatrix
must have the round off error included. SimplyIdentityMatrix
orN@IdentityMatrix
will not do.The constraints must be present.
I am using Mathematica 11.0.0.0 on Linux x86 (64 bit). Why does this crash occur, and what is a good workaround?
Method -> "InteriorPoint"
. $\endgroup$length = 90;
with version 11.0.1; with version 10.4.1 its OK. $\endgroup$