amino  1.0-beta2
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 
60 };
61 
62 
69 };
70 
78 };
79 
80 struct aa_opt_cx;
81 
85 AA_API int
86 aa_opt_solve( struct aa_opt_cx *cx, size_t n, double *x );
87 
88 
92 AA_API int
93 aa_opt_destroy( struct aa_opt_cx *cx );
94 
98 AA_API int
99 aa_opt_set_direction( struct aa_opt_cx *cx, enum aa_opt_direction );
100 
105 AA_API int
106 aa_opt_set_quad_obj_crs( struct aa_opt_cx *cx, size_t n,
107  const double *Q_values, int *Q_cols, int *Q_row_ptr );
108 
112 AA_API int
113 aa_opt_set_type( struct aa_opt_cx *cx, size_t i, enum aa_opt_type type );
114 
118 typedef struct aa_opt_cx*
120  size_t m, size_t n,
121  const double *A, size_t ldA,
122  const double *b_lower, const double *b_upper,
123  const double *c,
124  const double *x_lower, const double *x_upper
125  );
126 
130 AA_API struct aa_opt_cx* aa_opt_lpsolve_gmcreate (
131  size_t m, size_t n,
132  const double *A, size_t ldA,
133  const double *b_lower, const double *b_upper,
134  const double *c,
135  const double *x_lower, const double *x_upper
136  );
137 
138 
142 AA_API struct aa_opt_cx* aa_opt_clp_gmcreate (
143  size_t m, size_t n,
144  const double *A, size_t ldA,
145  const double *b_lower, const double *b_upper,
146  const double *c,
147  const double *x_lower, const double *x_upper
148  );
149 
153 AA_API struct aa_opt_cx* aa_opt_glpk_gmcreate (
154  size_t m, size_t n,
155  const double *A, size_t ldA,
156  const double *b_lower, const double *b_upper,
157  const double *c,
158  const double *x_lower, const double *x_upper
159  );
160 
164 AA_API struct aa_opt_cx* aa_opt_lpsolve_crscreate (
165  size_t m, size_t n,
166  const double *A_values, int *A_cols, int *A_row_ptr,
167  const double *b_lower, const double *b_upper,
168  const double *c,
169  const double *x_lower, const double *x_upper );
170 
171 
175 AA_API struct aa_opt_cx* aa_opt_clp_crscreate (
176  size_t m, size_t n,
177  const double *A_values, int *A_cols, int *A_row_ptr,
178  const double *b_lower, const double *b_upper,
179  const double *c,
180  const double *x_lower, const double *x_upper );
181 
182 
186 AA_API struct aa_opt_cx* aa_opt_glpk_crscreate (
187  size_t m, size_t n,
188  const double *A_values, int *A_cols, int *A_row_ptr,
189  const double *b_lower, const double *b_upper,
190  const double *c,
191  const double *x_lower, const double *x_upper );
192 
193 #endif //AMINO_OPT_H
equality constraint
Definition: opt.h:57
minimize objective function
Definition: opt.h:68
Less-than or equal constraint.
Definition: opt.h:58
AA_API int aa_opt_destroy(struct aa_opt_cx *cx)
Destroy the optimization context.
AA_API struct aa_opt_cx * aa_opt_lpsolve_gmcreate(size_t m, size_t n, const double *A, size_t ldA, const double *b_lower, const double *b_upper, const double *c, const double *x_lower, const double *x_upper)
Create an optimization context for LP-Solve.
AA_API int aa_opt_set_type(struct aa_opt_cx *cx, size_t i, enum aa_opt_type type)
Destroy the optimization variable type.
integer variable
Definition: opt.h:77
AA_API int aa_opt_set_direction(struct aa_opt_cx *cx, enum aa_opt_direction)
Destroy the optimization direction.
AA_API struct aa_opt_cx * aa_opt_glpk_gmcreate(size_t m, size_t n, const double *A, size_t ldA, const double *b_lower, const double *b_upper, const double *c, const double *x_lower, const double *x_upper)
Create an optimization context for GLPK.
maximize objective function
Definition: opt.h:67
AA_API struct aa_opt_cx * aa_opt_glpk_crscreate(size_t m, size_t n, const double *A_values, int *A_cols, int *A_row_ptr, const double *b_lower, const double *b_upper, const double *c, const double *x_lower, const double *x_upper)
Create an optimization context for GLPK.
Greater-than or equal constraint.
Definition: opt.h:59
aa_opt_direction
Optimization direction.
Definition: opt.h:66
AA_API struct aa_opt_cx * aa_opt_lpsolve_crscreate(size_t m, size_t n, const double *A_values, int *A_cols, int *A_row_ptr, const double *b_lower, const double *b_upper, const double *c, const double *x_lower, const double *x_upper)
Create an optimization context for LP-Solve.
aa_opt_type
Type of optiziation variable.
Definition: opt.h:74
#define AA_API
calling and name mangling convention for functions
Definition: amino.h:95
struct aa_opt_cx * aa_opt_gmcreate_fun(size_t m, size_t n, const double *A, size_t ldA, const double *b_lower, const double *b_upper, const double *c, const double *x_lower, const double *x_upper)
Optimization context constructor from general matrix format.
Definition: opt.h:119
AA_API struct aa_opt_cx * aa_opt_clp_crscreate(size_t m, size_t n, const double *A_values, int *A_cols, int *A_row_ptr, const double *b_lower, const double *b_upper, const double *c, const double *x_lower, const double *x_upper)
Create an optimization context for CLP.
AA_API int aa_opt_solve(struct aa_opt_cx *cx, size_t n, double *x)
Solve the optimization problem.
binary variable
Definition: opt.h:76
AA_API struct aa_opt_cx * aa_opt_clp_gmcreate(size_t m, size_t n, const double *A, size_t ldA, const double *b_lower, const double *b_upper, const double *c, const double *x_lower, const double *x_upper)
Create an optimization context for CLP.
continuous (float) variable
Definition: opt.h:75
AA_API int aa_opt_set_quad_obj_crs(struct aa_opt_cx *cx, size_t n, const double *Q_values, int *Q_cols, int *Q_row_ptr)
Destroy the quadratic objective function via compressed-row-storage format.
aa_opt_rel_type
Optimization constraint type.
Definition: opt.h:56