nlopt 0.8.1

Wrapper for the nlopt library
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
/* automatically generated by rust-bindgen 0.60.1 */

pub type size_t = ::std::os::raw::c_ulong;
pub type wchar_t = ::std::os::raw::c_int;
pub type max_align_t = f64;
pub type nlopt_func = ::std::option::Option<
    unsafe extern "C" fn(
        n: ::std::os::raw::c_uint,
        x: *const f64,
        gradient: *mut f64,
        func_data: *mut ::std::os::raw::c_void,
    ) -> f64,
>;
pub type nlopt_mfunc = ::std::option::Option<
    unsafe extern "C" fn(
        m: ::std::os::raw::c_uint,
        result: *mut f64,
        n: ::std::os::raw::c_uint,
        x: *const f64,
        gradient: *mut f64,
        func_data: *mut ::std::os::raw::c_void,
    ),
>;
pub type nlopt_precond = ::std::option::Option<
    unsafe extern "C" fn(
        n: ::std::os::raw::c_uint,
        x: *const f64,
        v: *const f64,
        vpre: *mut f64,
        data: *mut ::std::os::raw::c_void,
    ),
>;
pub const nlopt_algorithm_NLOPT_GN_DIRECT: nlopt_algorithm = 0;
pub const nlopt_algorithm_NLOPT_GN_DIRECT_L: nlopt_algorithm = 1;
pub const nlopt_algorithm_NLOPT_GN_DIRECT_L_RAND: nlopt_algorithm = 2;
pub const nlopt_algorithm_NLOPT_GN_DIRECT_NOSCAL: nlopt_algorithm = 3;
pub const nlopt_algorithm_NLOPT_GN_DIRECT_L_NOSCAL: nlopt_algorithm = 4;
pub const nlopt_algorithm_NLOPT_GN_DIRECT_L_RAND_NOSCAL: nlopt_algorithm = 5;
pub const nlopt_algorithm_NLOPT_GN_ORIG_DIRECT: nlopt_algorithm = 6;
pub const nlopt_algorithm_NLOPT_GN_ORIG_DIRECT_L: nlopt_algorithm = 7;
pub const nlopt_algorithm_NLOPT_GD_STOGO: nlopt_algorithm = 8;
pub const nlopt_algorithm_NLOPT_GD_STOGO_RAND: nlopt_algorithm = 9;
pub const nlopt_algorithm_NLOPT_LD_LBFGS: nlopt_algorithm = 10;
pub const nlopt_algorithm_NLOPT_LN_PRAXIS: nlopt_algorithm = 11;
pub const nlopt_algorithm_NLOPT_LD_VAR1: nlopt_algorithm = 12;
pub const nlopt_algorithm_NLOPT_LD_VAR2: nlopt_algorithm = 13;
pub const nlopt_algorithm_NLOPT_LD_TNEWTON: nlopt_algorithm = 14;
pub const nlopt_algorithm_NLOPT_LD_TNEWTON_RESTART: nlopt_algorithm = 15;
pub const nlopt_algorithm_NLOPT_LD_TNEWTON_PRECOND: nlopt_algorithm = 16;
pub const nlopt_algorithm_NLOPT_LD_TNEWTON_PRECOND_RESTART: nlopt_algorithm = 17;
pub const nlopt_algorithm_NLOPT_GN_CRS2_LM: nlopt_algorithm = 18;
pub const nlopt_algorithm_NLOPT_GN_MLSL: nlopt_algorithm = 19;
pub const nlopt_algorithm_NLOPT_GD_MLSL: nlopt_algorithm = 20;
pub const nlopt_algorithm_NLOPT_GN_MLSL_LDS: nlopt_algorithm = 21;
pub const nlopt_algorithm_NLOPT_GD_MLSL_LDS: nlopt_algorithm = 22;
pub const nlopt_algorithm_NLOPT_LD_MMA: nlopt_algorithm = 23;
pub const nlopt_algorithm_NLOPT_LN_COBYLA: nlopt_algorithm = 24;
pub const nlopt_algorithm_NLOPT_LN_NEWUOA: nlopt_algorithm = 25;
pub const nlopt_algorithm_NLOPT_LN_NEWUOA_BOUND: nlopt_algorithm = 26;
pub const nlopt_algorithm_NLOPT_LN_NELDERMEAD: nlopt_algorithm = 27;
pub const nlopt_algorithm_NLOPT_LN_SBPLX: nlopt_algorithm = 28;
pub const nlopt_algorithm_NLOPT_LN_AUGLAG: nlopt_algorithm = 29;
pub const nlopt_algorithm_NLOPT_LD_AUGLAG: nlopt_algorithm = 30;
pub const nlopt_algorithm_NLOPT_LN_AUGLAG_EQ: nlopt_algorithm = 31;
pub const nlopt_algorithm_NLOPT_LD_AUGLAG_EQ: nlopt_algorithm = 32;
pub const nlopt_algorithm_NLOPT_LN_BOBYQA: nlopt_algorithm = 33;
pub const nlopt_algorithm_NLOPT_GN_ISRES: nlopt_algorithm = 34;
pub const nlopt_algorithm_NLOPT_AUGLAG: nlopt_algorithm = 35;
pub const nlopt_algorithm_NLOPT_AUGLAG_EQ: nlopt_algorithm = 36;
pub const nlopt_algorithm_NLOPT_G_MLSL: nlopt_algorithm = 37;
pub const nlopt_algorithm_NLOPT_G_MLSL_LDS: nlopt_algorithm = 38;
pub const nlopt_algorithm_NLOPT_LD_SLSQP: nlopt_algorithm = 39;
pub const nlopt_algorithm_NLOPT_LD_CCSAQ: nlopt_algorithm = 40;
pub const nlopt_algorithm_NLOPT_GN_ESCH: nlopt_algorithm = 41;
pub const nlopt_algorithm_NLOPT_GN_AGS: nlopt_algorithm = 42;
pub const nlopt_algorithm_NLOPT_NUM_ALGORITHMS: nlopt_algorithm = 43;
pub type nlopt_algorithm = ::std::os::raw::c_uint;
extern "C" {
    pub fn nlopt_algorithm_name(a: nlopt_algorithm) -> *const ::std::os::raw::c_char;
}
extern "C" {
    pub fn nlopt_algorithm_to_string(algorithm: nlopt_algorithm) -> *const ::std::os::raw::c_char;
}
extern "C" {
    pub fn nlopt_algorithm_from_string(name: *const ::std::os::raw::c_char) -> nlopt_algorithm;
}
pub const nlopt_result_NLOPT_FAILURE: nlopt_result = -1;
pub const nlopt_result_NLOPT_INVALID_ARGS: nlopt_result = -2;
pub const nlopt_result_NLOPT_OUT_OF_MEMORY: nlopt_result = -3;
pub const nlopt_result_NLOPT_ROUNDOFF_LIMITED: nlopt_result = -4;
pub const nlopt_result_NLOPT_FORCED_STOP: nlopt_result = -5;
pub const nlopt_result_NLOPT_NUM_FAILURES: nlopt_result = -6;
pub const nlopt_result_NLOPT_SUCCESS: nlopt_result = 1;
pub const nlopt_result_NLOPT_STOPVAL_REACHED: nlopt_result = 2;
pub const nlopt_result_NLOPT_FTOL_REACHED: nlopt_result = 3;
pub const nlopt_result_NLOPT_XTOL_REACHED: nlopt_result = 4;
pub const nlopt_result_NLOPT_MAXEVAL_REACHED: nlopt_result = 5;
pub const nlopt_result_NLOPT_MAXTIME_REACHED: nlopt_result = 6;
pub const nlopt_result_NLOPT_NUM_RESULTS: nlopt_result = 7;
pub type nlopt_result = ::std::os::raw::c_int;
extern "C" {
    pub fn nlopt_result_to_string(algorithm: nlopt_result) -> *const ::std::os::raw::c_char;
}
extern "C" {
    pub fn nlopt_result_from_string(name: *const ::std::os::raw::c_char) -> nlopt_result;
}
extern "C" {
    pub fn nlopt_srand(seed: ::std::os::raw::c_ulong);
}
extern "C" {
    pub fn nlopt_srand_time();
}
extern "C" {
    pub fn nlopt_version(
        major: *mut ::std::os::raw::c_int,
        minor: *mut ::std::os::raw::c_int,
        bugfix: *mut ::std::os::raw::c_int,
    );
}
#[doc = " OBJECT-ORIENTED API"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct nlopt_opt_s {
    _unused: [u8; 0],
}
pub type nlopt_opt = *mut nlopt_opt_s;
extern "C" {
    pub fn nlopt_create(algorithm: nlopt_algorithm, n: ::std::os::raw::c_uint) -> nlopt_opt;
}
extern "C" {
    pub fn nlopt_destroy(opt: nlopt_opt);
}
extern "C" {
    pub fn nlopt_copy(opt: nlopt_opt) -> nlopt_opt;
}
extern "C" {
    pub fn nlopt_optimize(opt: nlopt_opt, x: *mut f64, opt_f: *mut f64) -> nlopt_result;
}
extern "C" {
    pub fn nlopt_set_min_objective(
        opt: nlopt_opt,
        f: nlopt_func,
        f_data: *mut ::std::os::raw::c_void,
    ) -> nlopt_result;
}
extern "C" {
    pub fn nlopt_set_max_objective(
        opt: nlopt_opt,
        f: nlopt_func,
        f_data: *mut ::std::os::raw::c_void,
    ) -> nlopt_result;
}
extern "C" {
    pub fn nlopt_set_precond_min_objective(
        opt: nlopt_opt,
        f: nlopt_func,
        pre: nlopt_precond,
        f_data: *mut ::std::os::raw::c_void,
    ) -> nlopt_result;
}
extern "C" {
    pub fn nlopt_set_precond_max_objective(
        opt: nlopt_opt,
        f: nlopt_func,
        pre: nlopt_precond,
        f_data: *mut ::std::os::raw::c_void,
    ) -> nlopt_result;
}
extern "C" {
    pub fn nlopt_get_algorithm(opt: nlopt_opt) -> nlopt_algorithm;
}
extern "C" {
    pub fn nlopt_get_dimension(opt: nlopt_opt) -> ::std::os::raw::c_uint;
}
extern "C" {
    pub fn nlopt_get_errmsg(opt: nlopt_opt) -> *const ::std::os::raw::c_char;
}
extern "C" {
    pub fn nlopt_set_param(
        opt: nlopt_opt,
        name: *const ::std::os::raw::c_char,
        val: f64,
    ) -> nlopt_result;
}
extern "C" {
    pub fn nlopt_get_param(
        opt: nlopt_opt,
        name: *const ::std::os::raw::c_char,
        defaultval: f64,
    ) -> f64;
}
extern "C" {
    pub fn nlopt_has_param(
        opt: nlopt_opt,
        name: *const ::std::os::raw::c_char,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn nlopt_num_params(opt: nlopt_opt) -> ::std::os::raw::c_uint;
}
extern "C" {
    pub fn nlopt_nth_param(
        opt: nlopt_opt,
        n: ::std::os::raw::c_uint,
    ) -> *const ::std::os::raw::c_char;
}
extern "C" {
    pub fn nlopt_set_lower_bounds(opt: nlopt_opt, lb: *const f64) -> nlopt_result;
}
extern "C" {
    pub fn nlopt_set_lower_bounds1(opt: nlopt_opt, lb: f64) -> nlopt_result;
}
extern "C" {
    pub fn nlopt_set_lower_bound(opt: nlopt_opt, i: ::std::os::raw::c_int, lb: f64)
        -> nlopt_result;
}
extern "C" {
    pub fn nlopt_get_lower_bounds(opt: nlopt_opt, lb: *mut f64) -> nlopt_result;
}
extern "C" {
    pub fn nlopt_set_upper_bounds(opt: nlopt_opt, ub: *const f64) -> nlopt_result;
}
extern "C" {
    pub fn nlopt_set_upper_bounds1(opt: nlopt_opt, ub: f64) -> nlopt_result;
}
extern "C" {
    pub fn nlopt_set_upper_bound(opt: nlopt_opt, i: ::std::os::raw::c_int, ub: f64)
        -> nlopt_result;
}
extern "C" {
    pub fn nlopt_get_upper_bounds(opt: nlopt_opt, ub: *mut f64) -> nlopt_result;
}
extern "C" {
    pub fn nlopt_remove_inequality_constraints(opt: nlopt_opt) -> nlopt_result;
}
extern "C" {
    pub fn nlopt_add_inequality_constraint(
        opt: nlopt_opt,
        fc: nlopt_func,
        fc_data: *mut ::std::os::raw::c_void,
        tol: f64,
    ) -> nlopt_result;
}
extern "C" {
    pub fn nlopt_add_precond_inequality_constraint(
        opt: nlopt_opt,
        fc: nlopt_func,
        pre: nlopt_precond,
        fc_data: *mut ::std::os::raw::c_void,
        tol: f64,
    ) -> nlopt_result;
}
extern "C" {
    pub fn nlopt_add_inequality_mconstraint(
        opt: nlopt_opt,
        m: ::std::os::raw::c_uint,
        fc: nlopt_mfunc,
        fc_data: *mut ::std::os::raw::c_void,
        tol: *const f64,
    ) -> nlopt_result;
}
extern "C" {
    pub fn nlopt_remove_equality_constraints(opt: nlopt_opt) -> nlopt_result;
}
extern "C" {
    pub fn nlopt_add_equality_constraint(
        opt: nlopt_opt,
        h: nlopt_func,
        h_data: *mut ::std::os::raw::c_void,
        tol: f64,
    ) -> nlopt_result;
}
extern "C" {
    pub fn nlopt_add_precond_equality_constraint(
        opt: nlopt_opt,
        h: nlopt_func,
        pre: nlopt_precond,
        h_data: *mut ::std::os::raw::c_void,
        tol: f64,
    ) -> nlopt_result;
}
extern "C" {
    pub fn nlopt_add_equality_mconstraint(
        opt: nlopt_opt,
        m: ::std::os::raw::c_uint,
        h: nlopt_mfunc,
        h_data: *mut ::std::os::raw::c_void,
        tol: *const f64,
    ) -> nlopt_result;
}
extern "C" {
    pub fn nlopt_set_stopval(opt: nlopt_opt, stopval: f64) -> nlopt_result;
}
extern "C" {
    pub fn nlopt_get_stopval(opt: nlopt_opt) -> f64;
}
extern "C" {
    pub fn nlopt_set_ftol_rel(opt: nlopt_opt, tol: f64) -> nlopt_result;
}
extern "C" {
    pub fn nlopt_get_ftol_rel(opt: nlopt_opt) -> f64;
}
extern "C" {
    pub fn nlopt_set_ftol_abs(opt: nlopt_opt, tol: f64) -> nlopt_result;
}
extern "C" {
    pub fn nlopt_get_ftol_abs(opt: nlopt_opt) -> f64;
}
extern "C" {
    pub fn nlopt_set_xtol_rel(opt: nlopt_opt, tol: f64) -> nlopt_result;
}
extern "C" {
    pub fn nlopt_get_xtol_rel(opt: nlopt_opt) -> f64;
}
extern "C" {
    pub fn nlopt_set_xtol_abs1(opt: nlopt_opt, tol: f64) -> nlopt_result;
}
extern "C" {
    pub fn nlopt_set_xtol_abs(opt: nlopt_opt, tol: *const f64) -> nlopt_result;
}
extern "C" {
    pub fn nlopt_get_xtol_abs(opt: nlopt_opt, tol: *mut f64) -> nlopt_result;
}
extern "C" {
    pub fn nlopt_set_x_weights1(opt: nlopt_opt, w: f64) -> nlopt_result;
}
extern "C" {
    pub fn nlopt_set_x_weights(opt: nlopt_opt, w: *const f64) -> nlopt_result;
}
extern "C" {
    pub fn nlopt_get_x_weights(opt: nlopt_opt, w: *mut f64) -> nlopt_result;
}
extern "C" {
    pub fn nlopt_set_maxeval(opt: nlopt_opt, maxeval: ::std::os::raw::c_int) -> nlopt_result;
}
extern "C" {
    pub fn nlopt_get_maxeval(opt: nlopt_opt) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn nlopt_get_numevals(opt: nlopt_opt) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn nlopt_set_maxtime(opt: nlopt_opt, maxtime: f64) -> nlopt_result;
}
extern "C" {
    pub fn nlopt_get_maxtime(opt: nlopt_opt) -> f64;
}
extern "C" {
    pub fn nlopt_force_stop(opt: nlopt_opt) -> nlopt_result;
}
extern "C" {
    pub fn nlopt_set_force_stop(opt: nlopt_opt, val: ::std::os::raw::c_int) -> nlopt_result;
}
extern "C" {
    pub fn nlopt_get_force_stop(opt: nlopt_opt) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn nlopt_set_local_optimizer(opt: nlopt_opt, local_opt: nlopt_opt) -> nlopt_result;
}
extern "C" {
    pub fn nlopt_set_population(opt: nlopt_opt, pop: ::std::os::raw::c_uint) -> nlopt_result;
}
extern "C" {
    pub fn nlopt_get_population(opt: nlopt_opt) -> ::std::os::raw::c_uint;
}
extern "C" {
    pub fn nlopt_set_vector_storage(opt: nlopt_opt, dim: ::std::os::raw::c_uint) -> nlopt_result;
}
extern "C" {
    pub fn nlopt_get_vector_storage(opt: nlopt_opt) -> ::std::os::raw::c_uint;
}
extern "C" {
    pub fn nlopt_set_default_initial_step(opt: nlopt_opt, x: *const f64) -> nlopt_result;
}
extern "C" {
    pub fn nlopt_set_initial_step(opt: nlopt_opt, dx: *const f64) -> nlopt_result;
}
extern "C" {
    pub fn nlopt_set_initial_step1(opt: nlopt_opt, dx: f64) -> nlopt_result;
}
extern "C" {
    pub fn nlopt_get_initial_step(opt: nlopt_opt, x: *const f64, dx: *mut f64) -> nlopt_result;
}
pub type nlopt_munge = ::std::option::Option<
    unsafe extern "C" fn(p: *mut ::std::os::raw::c_void) -> *mut ::std::os::raw::c_void,
>;
extern "C" {
    pub fn nlopt_set_munge(
        opt: nlopt_opt,
        munge_on_destroy: nlopt_munge,
        munge_on_copy: nlopt_munge,
    );
}
pub type nlopt_munge2 = ::std::option::Option<
    unsafe extern "C" fn(
        p: *mut ::std::os::raw::c_void,
        data: *mut ::std::os::raw::c_void,
    ) -> *mut ::std::os::raw::c_void,
>;
extern "C" {
    pub fn nlopt_munge_data(opt: nlopt_opt, munge: nlopt_munge2, data: *mut ::std::os::raw::c_void);
}
pub type nlopt_func_old = ::std::option::Option<
    unsafe extern "C" fn(
        n: ::std::os::raw::c_int,
        x: *const f64,
        gradient: *mut f64,
        func_data: *mut ::std::os::raw::c_void,
    ) -> f64,
>;
extern "C" {
    pub fn nlopt_minimize(
        algorithm: nlopt_algorithm,
        n: ::std::os::raw::c_int,
        f: nlopt_func_old,
        f_data: *mut ::std::os::raw::c_void,
        lb: *const f64,
        ub: *const f64,
        x: *mut f64,
        minf: *mut f64,
        minf_max: f64,
        ftol_rel: f64,
        ftol_abs: f64,
        xtol_rel: f64,
        xtol_abs: *const f64,
        maxeval: ::std::os::raw::c_int,
        maxtime: f64,
    ) -> nlopt_result;
}
extern "C" {
    pub fn nlopt_minimize_constrained(
        algorithm: nlopt_algorithm,
        n: ::std::os::raw::c_int,
        f: nlopt_func_old,
        f_data: *mut ::std::os::raw::c_void,
        m: ::std::os::raw::c_int,
        fc: nlopt_func_old,
        fc_data: *mut ::std::os::raw::c_void,
        fc_datum_size: isize,
        lb: *const f64,
        ub: *const f64,
        x: *mut f64,
        minf: *mut f64,
        minf_max: f64,
        ftol_rel: f64,
        ftol_abs: f64,
        xtol_rel: f64,
        xtol_abs: *const f64,
        maxeval: ::std::os::raw::c_int,
        maxtime: f64,
    ) -> nlopt_result;
}
extern "C" {
    pub fn nlopt_minimize_econstrained(
        algorithm: nlopt_algorithm,
        n: ::std::os::raw::c_int,
        f: nlopt_func_old,
        f_data: *mut ::std::os::raw::c_void,
        m: ::std::os::raw::c_int,
        fc: nlopt_func_old,
        fc_data: *mut ::std::os::raw::c_void,
        fc_datum_size: isize,
        p: ::std::os::raw::c_int,
        h: nlopt_func_old,
        h_data: *mut ::std::os::raw::c_void,
        h_datum_size: isize,
        lb: *const f64,
        ub: *const f64,
        x: *mut f64,
        minf: *mut f64,
        minf_max: f64,
        ftol_rel: f64,
        ftol_abs: f64,
        xtol_rel: f64,
        xtol_abs: *const f64,
        htol_rel: f64,
        htol_abs: f64,
        maxeval: ::std::os::raw::c_int,
        maxtime: f64,
    ) -> nlopt_result;
}
extern "C" {
    pub fn nlopt_get_local_search_algorithm(
        deriv: *mut nlopt_algorithm,
        nonderiv: *mut nlopt_algorithm,
        maxeval: *mut ::std::os::raw::c_int,
    );
}
extern "C" {
    pub fn nlopt_set_local_search_algorithm(
        deriv: nlopt_algorithm,
        nonderiv: nlopt_algorithm,
        maxeval: ::std::os::raw::c_int,
    );
}
extern "C" {
    pub fn nlopt_get_stochastic_population() -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn nlopt_set_stochastic_population(pop: ::std::os::raw::c_int);
}