diff --git a/api/nlopt.c b/api/nlopt.c index f29e4ca87574965d4f80a40719dba923bcb97de2..e13980e4d3d8f08c5233a0b13c29c2103ed30c96 100644 --- a/api/nlopt.c +++ b/api/nlopt.c @@ -194,6 +194,10 @@ static nlopt_result nlopt_minimize_( nlopt_data d; nlopt_stopping stop; + /* some basic argument checks */ + if (n <= 0 || !f || !lb || !ub || !x || !fmin) + return NLOPT_INVALID_ARGS; + d.f = f; d.f_data = f_data; d.lb = lb; diff --git a/cdirect/cdirect.c b/cdirect/cdirect.c index f910de1f6eaf44c6780a7dfcb8b5546fa505b7fe..2684cc72c40d80dc7b3a08eda46874ea62d21518 100644 --- a/cdirect/cdirect.c +++ b/cdirect/cdirect.c @@ -19,9 +19,10 @@ * measure (d) of the rectangle, [2..n+1] are the coordinates of the * center (c), and [n+2..2n+1] are the widths of the sides (w). * - * a list of rectangles is just an array of N hyper-rectangles - * stored as an N x L in row-major order. Generally, - * we allocate more than we need, allocating Na hyper-rectangles. + * we store the hyper-rectangles in a red-black tree, sorted by (d,f) + * in lexographic order, to allow us to perform quick convex-hull + * calculations (in the future, we might make this data structure + * more sophisticated based on the dynamic convex-hull literature). * * n > 0 always */