lemon/concept_check.h
author Peter Kovacs <kpeter@inf.elte.hu>
Thu, 12 Nov 2009 23:26:13 +0100
changeset 806 fa6f37d7a25b
parent 285 d8dc5acf739b
child 997 761fe0846f49
permissions -rw-r--r--
Entirely rework CapacityScaling (#180)

- Use the new interface similarly to NetworkSimplex.
- Rework the implementation using an efficient internal structure
for handling the residual network. This improvement made the
code much faster (up to 2-5 times faster on large graphs).
- Handle GEQ supply type (LEQ is not supported).
- Handle negative costs for arcs of finite capacity.
(Note that this algorithm cannot handle arcs of negative cost
and infinite upper bound, thus it returns UNBOUNDED if such
an arc exists.)
- Extend the documentation.
alpar@209
     1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
alpar@25
     2
 *
alpar@209
     3
 * This file is a part of LEMON, a generic C++ optimization library.
alpar@25
     4
 *
alpar@440
     5
 * Copyright (C) 2003-2009
alpar@25
     6
 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
alpar@25
     7
 * (Egervary Research Group on Combinatorial Optimization, EGRES).
alpar@25
     8
 *
alpar@25
     9
 * Permission to use, modify and distribute this software is granted
alpar@25
    10
 * provided that this copyright notice appears in all copies. For
alpar@25
    11
 * precise terms see the accompanying LICENSE file.
alpar@25
    12
 *
alpar@25
    13
 * This software is provided "AS IS" with no warranty of any kind,
alpar@25
    14
 * express or implied, and with no claim as to its suitability for any
alpar@25
    15
 * purpose.
alpar@25
    16
 *
alpar@25
    17
 */
alpar@25
    18
alpar@285
    19
// The contents of this file was inspired by the concept checking
alpar@285
    20
// utility of the BOOST library (http://www.boost.org).
alpar@25
    21
kpeter@53
    22
///\file
kpeter@53
    23
///\brief Basic utilities for concept checking.
kpeter@53
    24
///
kpeter@53
    25
kpeter@53
    26
#ifndef LEMON_CONCEPT_CHECK_H
kpeter@53
    27
#define LEMON_CONCEPT_CHECK_H
alpar@25
    28
alpar@25
    29
namespace lemon {
alpar@25
    30
alpar@25
    31
  /*
alpar@25
    32
    "inline" is used for ignore_unused_variable_warning()
alpar@25
    33
    and function_requires() to make sure there is no
alpar@25
    34
    overtarget with g++.
alpar@25
    35
  */
alpar@25
    36
alpar@25
    37
  template <class T> inline void ignore_unused_variable_warning(const T&) { }
alpar@25
    38
kpeter@53
    39
  ///\e
alpar@25
    40
  template <class Concept>
alpar@25
    41
  inline void function_requires()
alpar@25
    42
  {
alpar@25
    43
#if !defined(NDEBUG)
alpar@25
    44
    void (Concept::*x)() = & Concept::constraints;
alpar@25
    45
    ignore_unused_variable_warning(x);
alpar@25
    46
#endif
alpar@25
    47
  }
alpar@25
    48
kpeter@53
    49
  ///\e
alpar@25
    50
  template <typename Concept, typename Type>
alpar@25
    51
  inline void checkConcept() {
alpar@25
    52
#if !defined(NDEBUG)
alpar@25
    53
    typedef typename Concept::template Constraints<Type> ConceptCheck;
alpar@25
    54
    void (ConceptCheck::*x)() = & ConceptCheck::constraints;
alpar@25
    55
    ignore_unused_variable_warning(x);
alpar@25
    56
#endif
alpar@25
    57
  }
alpar@25
    58
alpar@25
    59
} // namespace lemon
alpar@25
    60
kpeter@53
    61
#endif // LEMON_CONCEPT_CHECK_H