Couenne  0.5.7
CouenneSdpCuts.hpp
Go to the documentation of this file.
1 /* $Id: CouenneSdpCuts.hpp 945 2013-04-06 20:25:21Z stefan $
2  *
3  * Name: CouenneSdpCuts.hpp
4  * Authors: Pietro Belotti
5  * Andrea Qualizza
6  * Purpose: wrapper for Couenne to insert sdpcuts
7  *
8  * This file is licensed under the Eclipse Public License (EPL)
9  */
10 
11 #ifndef CouenneSdpCuts_hpp
12 #define CouenneSdpCuts_hpp
13 
14 #include "CglConfig.h"
15 #include "CglCutGenerator.hpp"
16 #include "BonRegisteredOptions.hpp"
17 #include "IpOptionsList.hpp"
18 #include "CouenneJournalist.hpp"
19 
20 namespace Couenne {
21 
22  class CouenneProblem;
23  class CouenneExprMatrix;
24 
42 
44 
45  protected:
46 
48 
49  bool doNotUse_;
50 
53  std::vector <CouenneExprMatrix *> minors_;
54 
55  int numEigVec_;
56 
57  bool onlyNegEV_;
58 
59  bool useSparsity_;
60 
62 
66  public:
67 
70 
71  ~CouenneSdpCuts ();
73  CouenneSdpCuts (const CouenneSdpCuts &);
74  virtual CglCutGenerator *clone () const;
75 
76  const bool doNotUse () const {return doNotUse_;}
77 
79  virtual void generateCuts (const OsiSolverInterface &,
80  OsiCuts &,
81  const CglTreeInfo = CglTreeInfo ())
82 #if CGL_VERSION_MAJOR == 0 && CGL_VERSION_MINOR <= 57
83  const
84 #endif
85  ;
86 
89 
90  // -----------------------------------------------------------------------------------------------------
91 
92  void updateSol();
93 
94  private:
95 
96  void genCutSingle (CouenneExprMatrix * const &,
97  const OsiSolverInterface &, OsiCuts &,
98  const CglTreeInfo = CglTreeInfo ()) const;
99 
100  void compareSparsify (const OsiSolverInterface &si,
101  int n, int m, const double *sol,
102  double *z, double *w,FILE *out) const;
103 
104 
105  void sparsify2 (const int n,
106  const double *A, double **sparse_v_mat,
107  int *card_v_mat, int min_nz, int *evdec_num) const;
108 
109  void genSDPcut (const OsiSolverInterface &si,
110  OsiCuts &cs,
111  CouenneExprMatrix *XX,
112  double *v1, double *v2,
113  int **) const; // contains indices
114 
115  void additionalSDPcuts (const OsiSolverInterface &si,
116  OsiCuts &cs,
117  CouenneExprMatrix *minor,
118  int np, const double *A,
119  const double *vector, int **) const; // indices of matrix X'
120 
121  enum zero_type {POS_DELTA, SELECTED, VALID_DELTA};
122 
123  void zero_comp (const int ind_i, const double delta,
124  const int np, const int *selected,
125  int *loc_selected,
126  int *ploc_card_selected, int *ploc_card_new_selected,
127  double *ploc_lhs,
128  double *locmargin, double *locmat,
129  double *locv,
130  const int evidx, bool wise,
131  int *evdec_num,
132  double *recomp_gap,
133  double *threshold) const;
134 
135  void zero_unified (enum zero_type type,
136  const int np, const int *order,
137  const int * selected,
138  const int min_card_new_selected,
139  const double min_delta, const int start_point,
140  const int curr_i,
141  int *loc_selected,
142  int *ploc_card_selected,
143  int *ploc_card_new_selected,
144  double *ploc_lhs,
145  double *locmargin, double *locmat,
146  int *pnchanged,
147  double *locv,
148  const int evidx, bool wise,double *recomp_gap, double *threshold,
149  int *evdec_num) const;
150 
151  void add_v_cut(const int np,
152  const int *loc_selected,
153  const int loc_card_selected,
154  const double *locv,
155  const int init_card_selected, int *has_init_vect,
156  int *selected, int *pcard_selected,
157  int *pnew_selected,
158  double **sparse_v_mat,
159  int *pcard_v_mat) const;
160 
161  void update_sparsify_structures(const int np,
162  double *v, double* margin,
163  double *A, double *lhs, const int *zeroed,
164  int evidx, bool decompose, int *evdec_num) const;
165 
166  void sparsify (bool sparsify_new,
167  const int evidx, const double eigen_val,
168  const double *v, const int n,
169  const double *sol, double **sparse_v_mat,
170  int *card_v_mat,
171  int *evdec_num) const;
172  };
173 }
174 
175 #endif
virtual CglCutGenerator * clone() const
Cloning constructor.
CouenneSdpCuts & operator=(const CouenneSdpCuts &)
Assignment.
int numEigVec_
number of eigenvectors to be used (default: n)
bool onlyNegEV_
only use negative eigenvalues (default: yes)
virtual void generateCuts(const OsiSolverInterface &, OsiCuts &, const CglTreeInfo=CglTreeInfo()) const
The main CglCutGenerator.
CouenneProblem * problem_
pointer to problem info
static void registerOptions(Ipopt::SmartPtr< Bonmin::RegisteredOptions > roptions)
Add list of options to be read from file.
bool doNotUse_
after construction, true if there are enough product terms to justify application.
These are cuts of the form.
std::vector< CouenneExprMatrix * > minors_
minors on which to apply cuts
Class for MINLP problems with symbolic information.
CouenneSdpCuts(CouenneProblem *, JnlstPtr, const Ipopt::SmartPtr< Ipopt::OptionsList >)
Constructor.
bool fillMissingTerms_
If minor not fully dense, create fictitious auxiliary variables that will be used in sdp cuts only (t...
~CouenneSdpCuts()
Destructor.
bool useSparsity_
Sparsify eigenvalues before writing inequality (default: no)
general include file for different compilers
const bool doNotUse() const