Skip to content

Commit

Permalink
Fix c89 build
Browse files Browse the repository at this point in the history
  • Loading branch information
jschueller committed Apr 12, 2019
1 parent f52fe16 commit e87fdb6
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ matrix:
- pip install mkdocs python-markdown-math --user
- PATH=$PATH:~/.local/bin mkdocs build
- mkdir build && pushd build
- cmake -DCMAKE_INSTALL_PREFIX=~/.local -DNLOPT_MATLAB=OFF -DNLOPT_FORTRAN=ON -DCMAKE_C_FLAGS='-Wall -Wextra' -DCMAKE_CXX_FLAGS='-Wall -Wextra' ..
- cmake -DCMAKE_INSTALL_PREFIX=~/.local -DNLOPT_MATLAB=OFF -DNLOPT_FORTRAN=ON -DCMAKE_C_FLAGS='-Wall -Wextra -std=c89' -DCMAKE_CXX_FLAGS='-Wall -Wextra' ..
- make install -j2 && ctest -j2 --output-on-failure
- rm -rf * ~/.local
- cmake -DCMAKE_INSTALL_PREFIX=~/.local -DNLOPT_PYTHON=OFF -DNLOPT_OCTAVE=OFF -DNLOPT_GUILE=OFF -DNLOPT_MATLAB=OFF -DNLOPT_FORTRAN=ON -DCMAKE_TOOLCHAIN_FILE=$PWD/../cmake/toolchain-x86_64-w64-mingw32.cmake ..
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ if (NOT DEFINED HAVE_FPCLASSIFY)
message(STATUS "Looking for fpclassify")
file (WRITE ${PROJECT_BINARY_DIR}/fpclassify.c "#include <math.h>\n")
file (APPEND ${PROJECT_BINARY_DIR}/fpclassify.c "int main(void) {\n")
file (APPEND ${PROJECT_BINARY_DIR}/fpclassify.c "if (!fpclassify(3.14159)) fpclassify(2.7183);\n")
file (APPEND ${PROJECT_BINARY_DIR}/fpclassify.c "if (!fpclassify(3.14159)) fpclassify(2.7183); int subn = FP_SUBNORMAL;\n")
file (APPEND ${PROJECT_BINARY_DIR}/fpclassify.c " return 0; }\n")
try_compile (HAVE_FPCLASSIFY
${PROJECT_BINARY_DIR}/build_fpclassify
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ branches:
- master
environment:
matrix:
- CMAKE_PLATFORM: "Visual Studio 10 2010"
- CMAKE_PLATFORM: "Visual Studio 14 2015"
- CMAKE_PLATFORM: "Visual Studio 14 2015 Win64"
install:
- cinstall: python
#- choco install swig
Expand Down
18 changes: 9 additions & 9 deletions src/algs/ags/ags.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@
extern "C" {
#endif

//The algorithm supports 3 types of stop criterions: stop by execution time, stop by value and stop by exceeding limit of iterations.
/* The algorithm supports 3 types of stop criterions: stop by execution time, stop by value and stop by exceeding limit of iterations. */

int ags_minimize(unsigned n, nlopt_func func, void *data, unsigned m, nlopt_constraint *fc,
double *x, double *minf, const double *l, const double *u, nlopt_stopping *stop);

extern double ags_eps; //method tolerance in Holder metric on 1d interval. Less value -- better search precision, less probability of early stop.
extern double ags_r; //reliability parameter. Higher value of r -- slower convergence, higher chance to cache the global minima.
extern double eps_res; // parameter which prevents method from paying too much attention to constraints. Greater values of this parameter speed up convergence,
// but global minima can be lost.
extern unsigned evolvent_density; // density of evolvent. By default density is 2^-12 on hybercube [0,1]^N,
// which means that maximum search accuracyis 2^-12. If search hypercube is large the density can be increased accordingly to achieve better accuracy.
extern int ags_refine_loc; //refine the final optimum using built-in local optimizer
extern int ags_verbose; //print additional info
extern double ags_eps; /* method tolerance in Holder metric on 1d interval. Less value -- better search precision, less probability of early stop. */
extern double ags_r; /* reliability parameter. Higher value of r -- slower convergence, higher chance to cache the global minima. */
extern double eps_res; /* parameter which prevents method from paying too much attention to constraints. Greater values of this parameter speed up convergence, */
/* but global minima can be lost. */
extern unsigned evolvent_density; /* density of evolvent. By default density is 2^-12 on hybercube [0,1]^N, */
/* which means that maximum search accuracyis 2^-12. If search hypercube is large the density can be increased accordingly to achieve better accuracy. */
extern int ags_refine_loc; /* refine the final optimum using built-in local optimizer */
extern int ags_verbose; /* print additional info */

#ifdef __cplusplus
}
Expand Down
1 change: 0 additions & 1 deletion src/algs/cdirect/hybrid.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ static nlopt_result optimize_rect(double *r, params *p)
double minf;
nlopt_stopping *stop = p->stop;
nlopt_result ret;
nlopt_opt opt;

if (stop->maxeval > 0 &&
*(stop->nevals_p) >= stop->maxeval) return NLOPT_MAXEVAL_REACHED;
Expand Down
4 changes: 2 additions & 2 deletions src/util/qsort_r.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
#include "nlopt-util.h"
#include <stdlib.h>

#if defined(_MSC_VER)
#define inline __inline
#if (__STDC_VERSION__ < 199901L)
#define inline
#endif

typedef int cmp_t(void *, const void *, const void *);
Expand Down

0 comments on commit e87fdb6

Please sign in to comment.