1 // Copyright (C) 2005, International Business Machines 2 // Corporation and others. All Rights Reserved. 3 // This code is licensed under the terms of the Eclipse Public License (EPL). 4 5 #ifndef CglAllDifferent_H 6 #define CglAllDifferent_H 7 8 #include <string> 9 10 #include "CglCutGenerator.hpp" 11 12 /** AllDifferent Cut Generator Class 13 This has a number of sets. All the members in each set are general integer 14 variables which have to be different from all others in the set. 15 16 At present this only generates column cuts 17 18 At present it is very primitive compared to proper CSP implementations 19 */ 20 class CglAllDifferent : public CglCutGenerator { 21 22 public: 23 24 25 /**@name Generate Cuts */ 26 //@{ 27 /** This fixes (or reduces bounds) on sets of all different variables 28 */ 29 virtual void generateCuts( const OsiSolverInterface & si, OsiCuts & cs, 30 const CglTreeInfo info = CglTreeInfo()); 31 //@} 32 33 34 /**@name Constructors and destructors */ 35 //@{ 36 /// Default constructor 37 CglAllDifferent (); 38 39 /// Useful constructot 40 CglAllDifferent(int numberSets, const int * starts, const int * which); 41 42 /// Copy constructor 43 CglAllDifferent ( 44 const CglAllDifferent &); 45 46 /// Clone 47 virtual CglCutGenerator * clone() const; 48 49 /// Assignment operator 50 CglAllDifferent & 51 operator=( 52 const CglAllDifferent& rhs); 53 54 /// Destructor 55 virtual 56 ~CglAllDifferent (); 57 /// Create C++ lines to get to current state 58 virtual std::string generateCpp( FILE * fp); 59 60 /// This can be used to refresh any inforamtion 61 virtual void refreshSolver(OsiSolverInterface * solver); 62 /** 63 Returns true if may generate Row cuts in tree (rather than root node). 64 Used so know if matrix will change in tree. Really 65 meant so column cut generators can still be active 66 without worrying code. 67 Default is true 68 */ mayGenerateRowCutsInTree() const69 virtual bool mayGenerateRowCutsInTree() const 70 { return false;} 71 //@} 72 /**@name Sets and Gets */ 73 //@{ 74 /// Set log level setLogLevel(int value)75 inline void setLogLevel(int value) 76 { logLevel_=value;} 77 /// Get log level getLogLevel() const78 inline int getLogLevel() const 79 { return logLevel_;} 80 /// Set Maximum number of sets to look at at once setMaxLook(int value)81 inline void setMaxLook(int value) 82 { maxLook_=value;} 83 /// Get Maximum number of sets to look at at once getMaxLook() const84 inline int getMaxLook() const 85 { return maxLook_;} 86 //@} 87 88 private: 89 90 // Private member methods 91 /**@name */ 92 //@{ 93 //@} 94 95 // Private member data 96 97 /**@name Private member data */ 98 //@{ 99 /// Number of sets 100 int numberSets_; 101 /// Total number of variables in all different sets 102 int numberDifferent_; 103 /// Maximum number of sets to look at at once 104 int maxLook_; 105 /// Log level - 0 none, 1 - a bit, 2 - more details 106 int logLevel_; 107 /// Start of each set 108 int * start_; 109 /// Members (0,1,....) not as in original model 110 int * which_; 111 /// Original members 112 int * originalWhich_; 113 //@} 114 }; 115 #endif 116