Skip to content

Commit

Permalink
The error changed, now it's not building rust and the test that was n…
Browse files Browse the repository at this point in the history
…ot passing earlier is okay...
  • Loading branch information
lorenzo-consoli committed Nov 22, 2023
1 parent d1fae99 commit 36f4a9d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
7 changes: 6 additions & 1 deletion code-experiments/build/python/src/cocoex/function.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ cdef extern from 'coco.h':
# add a declaration to the generated source files.
cdef extern coco_problem_t *coco_get_bbob_problem(size_t function, size_t
dimension, size_t instance)

cdef extern double coco_problem_get_best_value(coco_problem_t *p)

cdef class BenchmarkFunction:
"""A bare benchmark function from one of the available suites.
Expand Down Expand Up @@ -104,6 +104,11 @@ cdef class BenchmarkFunction:
if self._problem != NULL:
coco_problem_free(self._problem)


def best_value(self):
"""Return the best (lowest) possible function value"""
return coco_problem_get_best_value(self._problem)

def __str__(self):
return self.id

Expand Down
3 changes: 0 additions & 3 deletions code-experiments/build/rust/coco-sys/wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,5 @@
/** Makes the problem returned by coco_suite_get_next_problem owned **/
void coco_suite_forget_current_problem(coco_suite_t *suite);

/** Returns the optimal function value of the problem **/
double coco_problem_get_best_value(const coco_problem_t *problem);

/** Returns the optimal function value + delta of the problem **/
double coco_problem_get_final_target_fvalue1(const coco_problem_t *problem);
8 changes: 0 additions & 8 deletions code-experiments/build/rust/src/problem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,6 @@ impl Problem<'_> {
unsafe { coco_sys::coco_problem_get_final_target_fvalue1(self.inner) }
}

/// Returns the optimal function value of the problem
///
/// To check whether the target has been reached use [[Problem::final_target_value]]
/// or [[Problem::final_target_hit]] instead.
pub fn best_value(&self) -> f64 {
unsafe { coco_sys::coco_problem_get_best_value(self.inner) }
}

/// Returns the best observed value for the first objective.
pub fn best_observed_value(&self) -> f64 {
unsafe { coco_sys::coco_problem_get_best_observed_fvalue1(self.inner) }
Expand Down

0 comments on commit 36f4a9d

Please sign in to comment.