00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef COUENNE_EXPRCOPY_HPP
00012 #define COUENNE_EXPRCOPY_HPP
00013
00014 #include <iostream>
00015
00016 #include "CouenneTypes.hpp"
00017 #include "expression.hpp"
00018
00019 class CouenneObject;
00020
00021
00022
00023 class exprCopy: public expression {
00024
00025 protected:
00026
00028 expression *copy_;
00029
00031 CouNumber value_;
00032
00033 public:
00034
00036 inline enum nodeType Type () const
00037 {return copy_ -> Type ();}
00038
00040
00041
00043 exprCopy (expression *copy):
00044
00045 copy_ (copy),
00046 value_ (0.) {}
00047
00049 exprCopy (const exprCopy &e, Domain *d = NULL);
00050
00053 virtual ~exprCopy () {
00054 if (copy_)
00055 delete copy_;
00056 }
00057
00059 virtual inline expression *clone (Domain *d = NULL) const
00060 {return new exprCopy (*this, d);}
00061
00065 inline const expression *Original () const
00066 {return copy_ -> Original ();}
00067
00070 inline bool isaCopy () const
00071 {return true;}
00072
00074 inline expression *Copy () const
00075 {return (copy_ -> isaCopy ()) ? copy_ -> Copy () : copy_;}
00076
00078 inline expression *Image () const
00079 {return copy_ -> Image ();}
00080
00082 inline int Index () const
00083 {return copy_ -> Index ();}
00084
00086 inline int nArgs () const
00087 {return copy_ -> nArgs ();}
00088
00090 inline expression **ArgList () const
00091 {return copy_ -> ArgList ();}
00092
00094 inline void ArgList (expression **al)
00095 {copy_ -> ArgList (al);}
00096
00098 inline expression *Argument () const
00099 {return copy_ -> Argument ();}
00100
00102 inline expression **ArgPtr ()
00103 {return copy_ -> ArgPtr ();}
00104
00106 virtual void print (std::ostream &out = std::cout,
00107 bool descend = false) const
00108 {copy_ -> Original () -> print (out, descend);}
00109
00110
00112 virtual inline CouNumber Value () const
00113 {return value_;}
00114
00116 virtual inline CouNumber operator () ()
00117 {return (value_ = (*copy_) ());}
00118
00119
00120
00122 inline CouNumber gradientNorm (const double *x)
00123 {return copy_ -> gradientNorm (x);}
00124
00126 inline expression *differentiate (int index)
00127 {return copy_ -> differentiate (index);}
00128
00131 inline int DepList (std::set <int> &deplist,
00132 enum dig_type type = ORIG_ONLY)
00133 {return copy_ -> DepList (deplist, type);}
00134
00136 inline expression *simplify ()
00137 {return copy_ -> simplify ();}
00138
00140 inline int Linearity ()
00141 {return copy_ -> Linearity ();}
00142
00143 inline bool isInteger ()
00144 {return copy_ -> isInteger ();}
00145
00147 inline void getBounds (expression *&lower, expression *&upper)
00148 {copy_ -> getBounds (lower, upper);}
00149
00151 inline void getBounds (CouNumber &lower, CouNumber &upper)
00152 {copy_ -> getBounds (lower, upper);}
00153
00154
00156 inline exprAux *standardize (CouenneProblem *p, bool addAux = true)
00157 {return copy_ -> standardize (p, addAux);}
00158
00160 inline void generateCuts (expression *w, const OsiSolverInterface &si,
00161 OsiCuts &cs, const CouenneCutGenerator *cg,
00162 t_chg_bounds *chg = NULL, int wind= -1,
00163 CouNumber lb = -COUENNE_INFINITY,
00164 CouNumber ub = COUENNE_INFINITY)
00165
00166 {copy_ -> generateCuts (w, si, cs, cg, chg, wind, lb, ub);}
00167
00169 inline enum expr_type code ()
00170 {return copy_ -> code ();}
00171
00173 inline enum convexity convexity () const
00174 {return copy_ -> convexity ();}
00175
00177 int compare (expression &e)
00178 {return copy_ -> compare (e);}
00179
00181 inline int rank ()
00182 {return copy_ -> rank ();}
00183
00185 inline bool impliedBound (int wind, CouNumber *l, CouNumber *u, t_chg_bounds *chg)
00186 {return copy_ -> impliedBound (wind, l, u, chg);}
00187
00190 inline int Multiplicity ()
00191 {return copy_ -> Multiplicity ();}
00192
00195 inline CouNumber selectBranch (const CouenneObject *obj,
00196 const OsiBranchingInformation *info,
00197 expression * &var,
00198 double * &brpts,
00199 double * &brDist,
00200
00201 int &way)
00202
00203 {return copy_ -> selectBranch (obj, info, var, brpts, brDist, way);}
00204
00206 void replace (exprVar *, exprVar *);
00207
00209 inline void fillDepSet (std::set <DepNode *, compNode> *dep, DepGraph *g)
00210 {copy_ -> fillDepSet (dep, g);}
00211
00213 void realign (const CouenneProblem *p);
00214
00215
00217 bool isBijective() const
00218 {return copy_ -> isBijective ();}
00219
00221 CouNumber inverse (expression *vardep) const
00222 {return copy_ -> inverse (vardep);}
00223
00225 void closestFeasible (expression *varind, expression *vardep,
00226 CouNumber& left, CouNumber& right) const
00227 {copy_ -> closestFeasible (varind, vardep, left, right);}
00228
00231 bool isCuttable (CouenneProblem *problem, int index) const
00232 {return copy_ -> isCuttable (problem, index);}
00233 };
00234
00235 #endif