- improved error logging
[oweals/gnunet.git] / src / ats / gnunet-service-ats_addresses_mlp.h
index 2555846ff0ea535e3b08ecd3b7e6474057a7dec9..4b4b933196c44f74d71b4515378fa312c208f707 100644 (file)
@@ -95,6 +95,12 @@ struct GAS_MLP_Handle
 
   /* statistics */
 
+  /**
+   * Time of last execution
+   */
+  struct GNUNET_TIME_Absolute last_execution;
+
+
   /**
    * How often was the LP problem solved
    */
@@ -114,27 +120,113 @@ struct GAS_MLP_Handle
    * total duration of all mlp solver executions
    */
   uint64_t mlp_total_duration;
+
+  /* Information about the problem */
+
+
+  /* column index Diversity (D) column */
+  int c_d;
+  double co_D;
+
+  /* column index Utilization (U) column */
+  int c_u;
+  double co_U;
+
+  /* column index Proportionality (R) column */
+  int c_r;
+  double co_R;
+
+  /* ATS Quality metrics
+   * array with GNUNET_ATS_QualityPropertiesCount elements
+   * contains mapping to GNUNET_ATS_Property*/
+  int q[GNUNET_ATS_QualityPropertiesCount];
+
+  /* column index quality metrics  */
+  int c_q[GNUNET_ATS_QualityPropertiesCount];
+
+  /* quality metric coefficients*/
+  double co_Q[GNUNET_ATS_QualityPropertiesCount];
+
+  /* number of quality metrics */
+  int m;
+
+  /* minimum bandwidth assigned to an address */
+  unsigned int b_min;
+
+  /* minimum number of addresses with bandwidth assigned */
+  unsigned int n_min;
+};
+
+
+/**
+ * Address specific MLP information
+ */
+struct MLP_information
+{
+  /* bandwidth column index */
+  signed int c_b;
+
+  /* address usage column */
+  signed int c_n;
 };
 
 
 /**
  * Init the MLP problem solving component
  *
+ * @param cfg configuration handle
  * @param stats the GNUNET_STATISTICS handle
  * @param max_duration maximum numbers of iterations for the LP/MLP Solver
  * @param max_iterations maximum time limit for the LP/MLP Solver
- * @return GNUNET_OK on success, GNUNET_SYSERR on fail
+ * @return struct GAS_MLP_Handle * on success, NULL on fail
  */
-int
-GAS_mlp_init (const struct GNUNET_STATISTICS_Handle *stats,
+struct GAS_MLP_Handle *
+GAS_mlp_init (const struct GNUNET_CONFIGURATION_Handle *cfg,
+              const struct GNUNET_STATISTICS_Handle *stats,
               struct GNUNET_TIME_Relative max_duration,
               unsigned int max_iterations);
 
+
+/**
+ * Updates a single address in the MLP problem
+ *
+ * If the address did not exist before in the problem:
+ * The MLP problem has to be recreated and the problem has to be resolved
+ *
+ * Otherwise the addresses' values can be updated and the existing base can
+ * be reused
+ *
+ * @param mlp the MLP Handle
+ * @param addresses the address hashmap
+ * @param address the address to update
+ */
+void
+GAS_mlp_address_update (struct GAS_MLP_Handle *mlp, struct GNUNET_CONTAINER_MultiHashMap * addresses, struct ATS_Address *address);
+
+
+/**
+ * Deletes a single address in the MLP problem
+ *
+ * The MLP problem has to be recreated and the problem has to be resolved
+ *
+ * @param mlp the MLP Handle
+ * @param addresses the address hashmap
+ * @param address the address to delete
+ */
+void
+GAS_mlp_address_delete (struct GAS_MLP_Handle *mlp, struct GNUNET_CONTAINER_MultiHashMap * addresses, struct ATS_Address *address);
+
+
 /**
- * Update address in the MLP problem
+ * Deletes a single address in the MLP problem
+ *
+ * @param mlp the MLP Handle
+ * @param addresses the address hashmap
+ * @param address the address to change the preference
  */
 void
-GAS_mlp_update (struct ATS_Address *address);
+GAS_mlp_address_change_preference (struct GAS_MLP_Handle *mlp, struct GNUNET_CONTAINER_MultiHashMap * addresses, struct ATS_Address *address);
+
 
 /**
  * Shutdown the MLP problem solving component