9
$\begingroup$

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:

  1. The dimensionality of the problem (length) must be greater or equal to 50.

  2. The costMatrix must have the round off error included. Simply IdentityMatrix or N@IdentityMatrix will not do.

  3. 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?

$\endgroup$
3
  • 5
    $\begingroup$ Thank you for pointing this out, I have filed a bug report. For a workaround, please try Method -> "InteriorPoint". $\endgroup$
    – ilian
    Commented Dec 13, 2016 at 18:28
  • $\begingroup$ Thank you for pointing this out. I confirm that I also observe this bug (Linux x86 64-bit, Mathematica v-11.0.1.0). FindMinimum kills the Kernel when used twice. The Method -> "InteriorPoint" trick works for me (no more crashes). I also have (Linux x86 64-bit, Mathematica v-10.0.0.1), in that case, everything is ok (works with the default FindMinimum method). Concerning necessary conditions, in my case the crashes occur with less than 50 variables and yes I have (bound) constraints. $\endgroup$ Commented Jan 26, 2017 at 10:58
  • $\begingroup$ On my system the crash appears starting from length = 90; with version 11.0.1; with version 10.4.1 its OK. $\endgroup$ Commented Mar 17, 2017 at 6:41

1 Answer 1

5
$\begingroup$

Update: This bug has been fixed in the just released Mathematica 11.1.


A good workaround was suggested by ilian.

For a workaround, please try Method -> "InteriorPoint".

This workaround worked for me. In particular, I can now run the first FindMinimum command for the code listing in my question as many times as I want, and the second FindMinimum command does not cause a crash either. Even better, the solution found with this option seems to be more accurate. I also did not notice a slow down when I applied this workaround to the original application.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.