Skip to content

Commit

Permalink
240430.202701.HKT get back prima_is_success
Browse files Browse the repository at this point in the history
  • Loading branch information
zaikunzhang committed Apr 30, 2024
1 parent 4053ef5 commit dcc1d27
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions c/prima.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@


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

return info;
}


// The function that checks whether the result is "successful"
bool prima_is_success(const prima_result_t result)
{
return (result.status == PRIMA_SMALL_TR_RADIUS ||
result.status == PRIMA_FTARGET_ACHIEVED) && (result.cstrv <= sqrt(DBL_EPSILON));
}

0 comments on commit dcc1d27

Please sign in to comment.