From: stevenj Date: Mon, 5 Apr 2010 19:17:49 +0000 (-0400) Subject: put a few more functions into the C++ API X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=2d72a896cc9aa55facca1991f62c0ecbff66e198;p=nlopt.git put a few more functions into the C++ API darcs-hash:20100405191749-c8de0-2bb5cb5b80befa74a8a666be82866d91817a9153.gz --- diff --git a/api/nlopt-in.hpp b/api/nlopt-in.hpp index cc09c44..5187afb 100644 --- a/api/nlopt-in.hpp +++ b/api/nlopt-in.hpp @@ -119,6 +119,10 @@ namespace nlopt { if (!o) throw std::runtime_error("uninitialized nlopt::opt"); return algorithm(nlopt_get_algorithm(o)); } + const char *get_algorithm_name() const { + if (!o) throw std::runtime_error("uninitialized nlopt::opt"); + return nlopt_algorithm_name(nlopt_get_algorithm(o)); + } unsigned get_dimension() const { if (!o) throw std::runtime_error("uninitialized nlopt::opt"); return nlopt_get_dimension(o); @@ -262,4 +266,18 @@ namespace nlopt { ////////////////////////////////////////////////////////////////////// + inline void srand(unsigned long seed) { nlopt_srand(seed); } + inline void srand_time(void) { nlopt_srand_time(); } + inline void version(int &major, int &minor, int &bugfix) { + nlopt_version(&major, &minor, &bugfix); + } + inline const char *algorithm_name(nlopt_algorithm a) { + return nlopt_algorithm_name(a); + } + inline const char *algorithm_name(algorithm a) { + return algorithm_name(nlopt_algorithm(a)); + } + + ////////////////////////////////////////////////////////////////////// + } // namespace nlopt