| 232 | /// by default. For more information, see \ref PivotRule. |
| 233 | template <typename GR, typename V = int, typename C = V, typename ArcsType = int64_t> |
| 234 | class NetworkSimplexSimple |
| 235 | { |
| 236 | public: |
| 237 | |
| 238 | /// \brief Constructor. |
| 239 | /// |
| 240 | /// The constructor of the class. |
| 241 | /// |
| 242 | /// \param graph The digraph the algorithm runs on. |
| 243 | /// \param arc_mixing Indicate if the arcs have to be stored in a |
| 244 | /// mixed order in the internal data structure. |
| 245 | /// In special cases, it could lead to better overall performance, |
| 246 | /// but it is usually slower. Therefore it is disabled by default. |
| 247 | NetworkSimplexSimple(const GR& graph, bool arc_mixing, int nbnodes, ArcsType nb_arcs, uint64_t maxiters = 0, int numThreads=-1) : |
| 248 | _graph(graph), //_arc_id(graph), |
| 249 | _arc_mixing(arc_mixing), _init_nb_nodes(nbnodes), _init_nb_arcs(nb_arcs), |
| 250 | MAX(std::numeric_limits<Value>::max()), |
| 251 | INF(std::numeric_limits<Value>::has_infinity ? |
| 252 | std::numeric_limits<Value>::infinity() : MAX) |
| 253 | { |
| 254 | // Reset data structures |
| 255 | reset(); |
| 256 | max_iter = maxiters; |
| 257 | #ifdef _OPENMP |
| 258 | if (max_threads < 0) { |
| 259 | max_threads = omp_get_max_threads(); |
| 260 | } |
| 261 | if (numThreads > 0 && numThreads<=max_threads){ |
| 262 | num_threads = numThreads; |
| 263 | } else if (numThreads == -1 || numThreads>max_threads) { |
| 264 | num_threads = max_threads; |
| 265 | } else { |
| 266 | num_threads = 1; |
| 267 | } |
| 268 | omp_set_num_threads(num_threads); |
| 269 | #else |
| 270 | num_threads = 1; |
| 271 | #endif |
| 272 | } |
| 273 | |
| 274 | /// The type of the flow amounts, capacity bounds and supply values |
| 275 | typedef V Value; |
| 276 | /// The type of the arc costs |
| 277 | typedef C Cost; |
| 278 | |
| 279 | public: |
| 280 | /// \brief Problem type constants for the \c run() function. |
| 281 | /// |
| 282 | /// Enum type containing the problem type constants that can be |
| 283 | /// returned by the \ref run() function of the algorithm. |
| 284 | enum ProblemType { |
| 285 | /// The problem has no feasible solution (flow). |
| 286 | INFEASIBLE, |
| 287 | /// The problem has optimal solution (i.e. it is feasible and |
| 288 | /// bounded), and the algorithm has found optimal flow and node |
| 289 | /// potentials (primal and dual solutions). |
| 290 | OPTIMAL, |
| 291 | /// The objective function of the problem is unbounded, i.e. |