source: stable/2.6/Cbc/src/CbcCompareDepth.cpp @ 2122

Last change on this file since 2122 was 1432, checked in by bjarni, 10 years ago

Added extra return at end of each source file where needed, to remove possible linefeed conflicts (NightlyBuild? errors)

File size: 1.5 KB
Line 
1//Edwin 11/24/09 carved out of CbcCompareActual
2#if defined(_MSC_VER)
3// Turn off compiler warning about long names
4#  pragma warning(disable:4786)
5#endif
6#include <cassert>
7#include <cstdlib>
8#include <cmath>
9#include <cfloat>
10//#define CBC_DEBUG
11
12#include "CbcMessage.hpp"
13#include "CbcModel.hpp"
14#include "CbcTree.hpp"
15#include "CbcCompareActual.hpp"
16#include "CoinError.hpp"
17#include "CbcCompareDepth.hpp"
18/** Default Constructor
19
20*/
21CbcCompareDepth::CbcCompareDepth ()
22        : CbcCompareBase()
23{
24    test_ = this;
25}
26
27// Copy constructor
28CbcCompareDepth::CbcCompareDepth ( const CbcCompareDepth & rhs)
29        : CbcCompareBase(rhs)
30
31{
32}
33
34// Clone
35CbcCompareBase *
36CbcCompareDepth::clone() const
37{
38    return new CbcCompareDepth(*this);
39}
40
41// Assignment operator
42CbcCompareDepth &
43CbcCompareDepth::operator=( const CbcCompareDepth & rhs)
44{
45    if (this != &rhs) {
46        CbcCompareBase::operator=(rhs);
47    }
48    return *this;
49}
50
51// Destructor
52CbcCompareDepth::~CbcCompareDepth ()
53{
54}
55
56// Returns true if y better than x
57bool
58CbcCompareDepth::test (CbcNode * x, CbcNode * y)
59{
60    int testX = x->depth();
61    int testY = y->depth();
62    if (testX != testY)
63        return testX < testY;
64    else
65        return equalityTest(x, y); // so ties will be broken in consistent manner
66}
67// Create C++ lines to get to current state
68void
69CbcCompareDepth::generateCpp( FILE * fp)
70{
71    fprintf(fp, "0#include \"CbcCompareActual.hpp\"\n");
72    fprintf(fp, "3  CbcCompareDepth compare;\n");
73    fprintf(fp, "3  cbcModel->setNodeComparison(compare);\n");
74}
75
Note: See TracBrowser for help on using the repository browser.