e57fb22bca50669d0d1d5f320bbb11427018f84c
[oweals/gnunet.git] / src / ats / gnunet-service-ats_addresses_mlp.h
1 /*
2      This file is part of GNUnet.
3      (C) 2011 Christian Grothoff (and other contributing authors)
4
5      GNUnet is free software; you can redistribute it and/or modify
6      it under the terms of the GNU General Public License as published
7      by the Free Software Foundation; either version 3, or (at your
8      option) any later version.
9
10      GNUnet is distributed in the hope that it will be useful, but
11      WITHOUT ANY WARRANTY; without even the implied warranty of
12      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13      General Public License for more details.
14
15      You should have received a copy of the GNU General Public License
16      along with GNUnet; see the file COPYING.  If not, write to the
17      Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18      Boston, MA 02111-1307, USA.
19 */
20
21 /**
22  * @file ats/gnunet-service-ats_addresses_mlp.h
23  * @brief ats mlp problem solver
24  * @author Matthias Wachs
25  * @author Christian Grothoff
26  */
27 #include "platform.h"
28
29 #if HAVE_LIBGLPK
30 #include "glpk.h"
31 #endif
32
33 #ifndef GNUNET_SERVICE_ATS_ADDRESSES_MLP_H
34 #define GNUNET_SERVICE_ATS_ADDRESSES_MLP_H
35
36
37 #define MLP_MAX_EXEC_DURATION   GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 3)
38 #define MLP_MAX_ITERATIONS      INT_MAX
39
40 struct GAS_MLP_Handle
41 {
42   /**
43    * GLPK (MLP) problem object
44    */
45 #if HAVE_LIBGLPK
46   glp_prob *prob;
47 #else
48   void *prob;
49 #endif
50
51   /**
52    * GLPK LP control parameter
53    */
54   glp_smcp control_param_lp;
55
56   /**
57    * GLPK LP control parameter
58    */
59   glp_iocp control_param_mlp;
60
61   /**
62    * Maximum execution time per problem solving
63    */
64   struct GNUNET_TIME_Relative max_exec_duration;
65
66   /**
67    * Maximum number of LP iterations per problem solving
68    */
69   unsigned int max_iterations;
70
71 };
72
73 /**
74  * Init the MLP problem solving component
75  * @param max_duration maximum numbers of iterations for the LP/MLP Solver
76  * @param max_iterations maximum time limit for the LP/MLP Solver
77  * @return GNUNET_OK on success, GNUNET_SYSERR on fail
78  */
79 int
80 GAS_mlp_init (struct GNUNET_TIME_Relative max_duration, unsigned int max_iterations);
81
82 /**
83  * Update address in the MLP problem
84  */
85 void
86 GAS_mlp_update (struct ATS_Address *address);
87
88 /**
89  * Shutdown the MLP problem solving component
90  */
91 void
92 GAS_mlp_done ();
93
94 #endif
95 /* end of gnunet-service-ats_addresses_mlp.h */