-/* Copyright (c) 2004-2014. The SimGrid Team.
+/* Copyright (c) 2004-2015. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
#ifndef _SURF_MAXMIN_H
#define _SURF_MAXMIN_H
-#include "portable.h"
+#include "src/portable.h"
#include "xbt/misc.h"
#include "xbt/asserts.h"
#include "surf/datatypes.h"
#include <math.h>
-//#include <float.h>
/** @addtogroup SURF_lmm
* @details
- * A linear maxmin solver to resolves inequations systems.
+ * A linear maxmin solver to resolve inequations systems.
*
* Most SimGrid model rely on a "fluid/steady-state" modeling that
- * samount to share resources between actions at relatively
+ * simulate the sharing of resources between actions at relatively
* coarse-grain. Such sharing is generally done by solving a set of
* linear inequations. Let's take an example and assume we have the
* variables \f$x_1\f$, \f$x_2\f$, \f$x_3\f$, and \f$x_4\f$ . Let's
* say that \f$x_1\f$ and \f$x_2\f$ correspond to activities running
- * and the same CPU \f$A\f$ whose capacity is \f$C_A\f$ . In such a
+ * and the same CPU \f$A\f$ whose capacity is \f$C_A\f$. In such a
* case, we need to enforce:
*
* \f[ x_1 + x_2 \leq C_A \f]
* - bound (set)
* - shared (set)
* - usage (computed)
+ *
* Variable:
* - weight (set)
* - bound (set)
* - value (computed)
+ *
* Element:
* - value (set)
*
* var1.weight * var1.value * elem1.value + var2.weight * var2.value * elem2.value <= cons1.bound
* var2.weight * var2.value * elem3.value + var3.weight * var3.value * elem4.value <= cons2.bound
*
- * where `var1.value`, `var2.value` and `var3.value` are the unknown values
+ * where `var1.value`, `var2.value` and `var3.value` are the unknown values.
*
- * if a constraint is not shared the sum is replace by a max
+ * If a constraint is not shared, the sum is replaced by a max.
+ * For example, a third non-shared constraint `cons3` and the associated elements `elem5` and `elem6` could write as:
+ *
+ * max( var1.weight * var1.value * elem5.value , var3.weight * var3.value * elem6.value ) <= cons3.bound
+ *
+ * This is usefull for the sharing of resources for various models.
+ * For instance, for the network model, each link is associated
+ * to a constraint and each communication to a variable.
*
- * Its usefull for the sharing of resources for various models.
- * For instance for the network model the link are associated
- * to consrtaint and the communications to variables.
*/
-extern double sg_maxmin_precision;
-extern double sg_surf_precision;
+XBT_PUBLIC_DATA(double) sg_maxmin_precision;
+XBT_PUBLIC_DATA(double) sg_surf_precision;
static XBT_INLINE void double_update(double *variable, double value, double precision)
{
* @param cnst The constraint to share
* @return 1 if shared, 0 otherwise
*/
-XBT_PUBLIC(int) lmm_constraint_is_shared(lmm_constraint_t cnst);
+XBT_PUBLIC(int) lmm_constraint_sharing_policy(lmm_constraint_t cnst);
/**
* @brief Free a constraint
* @brief Get a var associated to a constraint
* @details Get the first variable of the next variable of elem if elem is not NULL
*
- * @param sys The system associated to the variable (not used)
* @param cnst A constraint
* @param elem A element of constraint of the constraint or NULL
* @param nextelem A element of constraint of the constraint or NULL, the one after elem