summaryrefslogtreecommitdiff
path: root/thirdparty/windows/include/coin/CglAllDifferent.hpp
blob: ed369d1c193ec7b7f9f120b37e6eedc80c8ba8fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
// Copyright (C) 2005, International Business Machines
// Corporation and others.  All Rights Reserved.
// This code is licensed under the terms of the Eclipse Public License (EPL).

#ifndef CglAllDifferent_H
#define CglAllDifferent_H

#include <string>

#include "CglCutGenerator.hpp"

/** AllDifferent Cut Generator Class 
    This has a number of sets.  All the members in each set are general integer
    variables which have to be different from all others in the set.

    At present this only generates column cuts

    At present it is very primitive compared to proper CSP implementations
 */
class CglAllDifferent : public CglCutGenerator {
 
public:
    
  
  /**@name Generate Cuts */
  //@{
  /** This fixes (or reduces bounds) on sets of all different variables
  */
  virtual void generateCuts( const OsiSolverInterface & si, OsiCuts & cs,
			     const CglTreeInfo info = CglTreeInfo());
  //@}


  /**@name Constructors and destructors */
  //@{
  /// Default constructor 
  CglAllDifferent ();

  /// Useful constructot
  CglAllDifferent(int numberSets, const int * starts, const int * which);
 
  /// Copy constructor 
  CglAllDifferent (
    const CglAllDifferent &);

  /// Clone
  virtual CglCutGenerator * clone() const;

  /// Assignment operator 
  CglAllDifferent &
    operator=(
    const CglAllDifferent& rhs);
  
  /// Destructor 
  virtual
    ~CglAllDifferent ();
  /// Create C++ lines to get to current state
  virtual std::string generateCpp( FILE * fp);

  /// This can be used to refresh any inforamtion
  virtual void refreshSolver(OsiSolverInterface * solver);
  /**
     Returns true if may generate Row cuts in tree (rather than root node).
     Used so know if matrix will change in tree.  Really
     meant so column cut generators can still be active
     without worrying code.
     Default is true
  */
  virtual bool mayGenerateRowCutsInTree() const
  { return false;}
  //@}
  /**@name Sets and Gets */
  //@{
  /// Set log level
  inline void setLogLevel(int value)
  { logLevel_=value;}
  /// Get log level
  inline int getLogLevel() const
  { return logLevel_;}
  /// Set Maximum number of sets to look at at once
  inline void setMaxLook(int value)
  { maxLook_=value;}
  /// Get Maximum number of sets to look at at once
  inline int getMaxLook() const
  { return maxLook_;}
  //@}
      
private:
  
 // Private member methods
  /**@name  */
  //@{
  //@}

  // Private member data

  /**@name Private member data */
  //@{
  /// Number of sets
  int numberSets_;
  /// Total number of variables in all different sets
  int numberDifferent_;
  /// Maximum number of sets to look at at once
  int maxLook_;
  /// Log level - 0 none, 1 - a bit, 2 - more details
  int logLevel_;
  /// Start of each set
  int * start_;
  /// Members (0,1,....) not as in original model
  int * which_;
  /// Original members
  int * originalWhich_;
  //@}
};
#endif