amino
Lightweight Robot Utility Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
opt.h
Go to the documentation of this file.
1 /* -*- mode: C; c-basic-offset: 4 -*- */
2 /* ex: set shiftwidth=4 tabstop=4 expandtab: */
3 /*
4  * Copyright (c) 2016, Rice University
5  * All rights reserved.
6  *
7  * Author(s): Neil T. Dantam <ntd@gatech.edu>
8  *
9  * This file is provided under the following "BSD-style" License:
10  *
11  *
12  * Redistribution and use in source and binary forms, with or
13  * without modification, are permitted provided that the following
14  * conditions are met:
15  * * Redistributions of source code must retain the above copyright
16  * notice, this list of conditions and the following disclaimer.
17  * * Redistributions in binary form must reproduce the above
18  * copyright notice, this list of conditions and the following
19  * disclaimer in the documentation and/or other materials provided
20  * with the distribution.
21  * * Neither the name of copyright holder the names of its
22  * contributors may be used to endorse or promote products derived
23  * from this software without specific prior written permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
26  * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
27  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
28  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
29  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
30  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
31  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
32  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
33  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
34  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
36  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37  * POSSIBILITY OF SUCH DAMAGE.
38  *
39  */
40 #ifndef AMINO_OPT_H
41 #define AMINO_OPT_H
42 
53 enum aa_opt_rel_type {
54  AA_OPT_REL_EQ,
55  AA_OPT_REL_LEQ,
56  AA_OPT_REL_GEQ,
57 };
58 
59 
60 enum aa_opt_direction {
61  AA_OPT_MAXIMIZE,
62  AA_OPT_MINIMIZE,
63 };
64 
65 
66 enum aa_opt_type {
67  AA_OPT_CONTINUOUS,
68  AA_OPT_BINARY,
69  AA_OPT_INTEGER
70 };
71 
72 struct aa_opt_cx;
73 
74 
75 AA_API int
76 aa_opt_solve( struct aa_opt_cx *cx, size_t n, double *x );
77 
78 
79 AA_API int
80 aa_opt_destroy( struct aa_opt_cx *cx );
81 
82 AA_API int
83 aa_opt_set_direction( struct aa_opt_cx *cx, enum aa_opt_direction );
84 
85 AA_API int
86 aa_opt_set_quad_obj_crs( struct aa_opt_cx *cx, size_t n,
87  const double *Q_values, int *Q_cols, int *Q_row_ptr );
88 
89 
90 AA_API int
91 aa_opt_set_type( struct aa_opt_cx *cx, size_t i, enum aa_opt_type type );
92 
93 typedef struct aa_opt_cx*
94 aa_opt_gmcreate_fun (
95  size_t m, size_t n,
96  const double *A, size_t ldA,
97  const double *b_lower, const double *b_upper,
98  const double *c,
99  const double *x_lower, const double *x_upper
100  );
101 
102 AA_API struct aa_opt_cx* aa_opt_lpsolve_gmcreate (
103  size_t m, size_t n,
104  const double *A, size_t ldA,
105  const double *b_lower, const double *b_upper,
106  const double *c,
107  const double *x_lower, const double *x_upper
108  );
109 
110 
111 AA_API struct aa_opt_cx* aa_opt_clp_gmcreate (
112  size_t m, size_t n,
113  const double *A, size_t ldA,
114  const double *b_lower, const double *b_upper,
115  const double *c,
116  const double *x_lower, const double *x_upper
117  );
118 
119 
120 AA_API struct aa_opt_cx* aa_opt_glpk_gmcreate (
121  size_t m, size_t n,
122  const double *A, size_t ldA,
123  const double *b_lower, const double *b_upper,
124  const double *c,
125  const double *x_lower, const double *x_upper
126  );
127 
128 AA_API struct aa_opt_cx* aa_opt_lpsolve_crscreate (
129  size_t m, size_t n,
130  const double *A_values, int *A_cols, int *A_row_ptr,
131  const double *b_lower, const double *b_upper,
132  const double *c,
133  const double *x_lower, const double *x_upper );
134 
135 
136 AA_API struct aa_opt_cx* aa_opt_clp_crscreate (
137  size_t m, size_t n,
138  const double *A_values, int *A_cols, int *A_row_ptr,
139  const double *b_lower, const double *b_upper,
140  const double *c,
141  const double *x_lower, const double *x_upper );
142 
143 
144 AA_API struct aa_opt_cx* aa_opt_glpk_crscreate (
145  size_t m, size_t n,
146  const double *A_values, int *A_cols, int *A_row_ptr,
147  const double *b_lower, const double *b_upper,
148  const double *c,
149  const double *x_lower, const double *x_upper );
150 
151 #endif //AMINO_OPT_H
#define AA_API
calling and name mangling convention for functions
Definition: amino.h:95