Skip to content

Commit dcc1d27

Browse files
committed
240430.202701.HKT get back prima_is_success
1 parent 4053ef5 commit dcc1d27

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

c/prima.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33

44
#include "prima/prima_internal.h"
5+
#include <float.h> // This providess DBL_EPSILON, which will be removed once ctol is introduced
56
#include <math.h>
67
#include <stdio.h>
78
#include <stdlib.h>
@@ -240,3 +241,11 @@ prima_rc_t prima_minimize(const prima_algorithm_t algorithm, const prima_problem
240241

241242
return info;
242243
}
244+
245+
246+
// The function that checks whether the result is "successful"
247+
bool prima_is_success(const prima_result_t result)
248+
{
249+
return (result.status == PRIMA_SMALL_TR_RADIUS ||
250+
result.status == PRIMA_FTARGET_ACHIEVED) && (result.cstrv <= sqrt(DBL_EPSILON));
251+
}

0 commit comments

Comments
 (0)