COIN-OR::LEMON - Graph Library

Ticket #199: 03ce6078f568.patch

File 03ce6078f568.patch, 3.1 KB (added by Alpar Juttner, 15 years ago)
  • new file lemon/bits/isnan.h

    # HG changeset patch
    # User Alpar Juttner <alpar@cs.elte.hu>
    # Date 1231781058 0
    # Node ID 03ce6078f568f2189fa1e0d90f32248a572ca3d9
    # Parent  04c0631fd33241997b26542eec78715709d11003
    Own support for isnan
    
    diff --git a/lemon/bits/isnan.h b/lemon/bits/isnan.h
    new file mode 100644
    - +  
     1/* -*- mode: C++; indent-tabs-mode: nil; -*-
     2 *
     3 * This file is a part of LEMON, a generic C++ optimization library.
     4 *
     5 * Copyright (C) 2003-2009
     6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     7 * (Egervary Research Group on Combinatorial Optimization, EGRES).
     8 *
     9 * Permission to use, modify and distribute this software is granted
     10 * provided that this copyright notice appears in all copies. For
     11 * precise terms see the accompanying LICENSE file.
     12 *
     13 * This software is provided "AS IS" with no warranty of any kind,
     14 * express or implied, and with no claim as to its suitability for any
     15 * purpose.
     16 *
     17 */
     18
     19#ifndef LEMON_BITS_ISNAN_H
     20#define LEMON_BITS_ISNAN_H
     21
     22namespace lemon
     23{
     24  inline bool isnan(double v)
     25    {
     26      return v!=v;
     27    }
     28}
     29
     30#endif
  • lemon/lp_base.h

    diff --git a/lemon/lp_base.h b/lemon/lp_base.h
    a b  
    3030
    3131#include<lemon/core.h>
    3232#include<lemon/bits/solver_bits.h>
     33#include<lemon/bits/isnan.h>
    3334
    3435///\file
    3536///\brief The interface of the LP solver interface.
     
    597598      const Value &upperBound() const { return _ub; }
    598599      ///Is the constraint lower bounded?
    599600      bool lowerBounded() const {
    600         return _lb != -INF && !std::isnan(_lb);
     601        return _lb != -INF && !isnan(_lb);
    601602      }
    602603      ///Is the constraint upper bounded?
    603604      bool upperBounded() const {
    604         return _ub != INF && !std::isnan(_ub);
     605        return _ub != INF && !isnan(_ub);
    605606      }
    606607
    607608    };
     
    16661667  inline LpBase::Constr operator<=(const LpBase::Value &n,
    16671668                                   const LpBase::Constr &c) {
    16681669    LpBase::Constr tmp(c);
    1669     LEMON_ASSERT(std::isnan(tmp.lowerBound()), "Wrong LP constraint");
     1670    LEMON_ASSERT(isnan(tmp.lowerBound()), "Wrong LP constraint");
    16701671    tmp.lowerBound()=n;
    16711672    return tmp;
    16721673  }
     
    16781679                                   const LpBase::Value &n)
    16791680  {
    16801681    LpBase::Constr tmp(c);
    1681     LEMON_ASSERT(std::isnan(tmp.upperBound()), "Wrong LP constraint");
     1682    LEMON_ASSERT(isnan(tmp.upperBound()), "Wrong LP constraint");
    16821683    tmp.upperBound()=n;
    16831684    return tmp;
    16841685  }
     
    16901691  inline LpBase::Constr operator>=(const LpBase::Value &n,
    16911692                                   const LpBase::Constr &c) {
    16921693    LpBase::Constr tmp(c);
    1693     LEMON_ASSERT(std::isnan(tmp.upperBound()), "Wrong LP constraint");
     1694    LEMON_ASSERT(isnan(tmp.upperBound()), "Wrong LP constraint");
    16941695    tmp.upperBound()=n;
    16951696    return tmp;
    16961697  }
     
    17021703                                   const LpBase::Value &n)
    17031704  {
    17041705    LpBase::Constr tmp(c);
    1705     LEMON_ASSERT(std::isnan(tmp.lowerBound()), "Wrong LP constraint");
     1706    LEMON_ASSERT(isnan(tmp.lowerBound()), "Wrong LP constraint");
    17061707    tmp.lowerBound()=n;
    17071708    return tmp;
    17081709  }