chiark / gitweb /
Use trusty
[nlopt.git] / crs / crs.c
index a1950c0d93186862f4e2287ea04c47ba4763f772..16f4ad5e63556fe1bbd09dde79531fe629c4bdbe 100644 (file)
--- a/crs/crs.c
+++ b/crs/crs.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007-2011 Massachusetts Institute of Technology
+/* Copyright (c) 2007-2014 Massachusetts Institute of Technology
  *
  * Permission is hereby granted, free of charge, to any person obtaining
  * a copy of this software and associated documentation files (the
@@ -177,8 +177,11 @@ static nlopt_result crs_init(crs_data *d, int n, const double *x,
      }
      else
          d->N = population;
-     if (d->N < n + 1) /* population must be big enough for a simplex */
-         return NLOPT_INVALID_ARGS;
+     if (d->N < n + 1) { /* population must be big enough for a simplex */
+          nlopt_stop_msg(stop, "population %d should be >= dimension + 1 = %d",
+                         d->N, n+1);
+          return NLOPT_INVALID_ARGS;
+     }
 
      d->n = n;
      d->stop = stop;