21 using namespace Couenne;
 
   28 void cleanZeros (std::vector <std::pair <exprVar *, CouNumber> > &lcoeff) {
 
   30   std::vector <std::pair <exprVar *, CouNumber> >::iterator i = lcoeff.begin ();
 
   33   size_t size = lcoeff.size ();
 
   36     if (i -> second ==  0.) { 
 
   38       i = lcoeff.begin () + ind;
 
   51                                      std::vector <std::pair <exprVar *, CouNumber> > &lcoeff, 
 
   54   size_t nl = 
lcoeff.size ();
 
   60   if ((n==0) && (nl==0))
 
   63   else if ((n==0) && (fabs (c0) < 
COUENNE_EPS) && (nl==1)) { 
 
   77                       std::vector <std::pair <exprVar *, CouNumber> > &lcoeff, 
 
   90   exprSum   (src.clonearglist (d), src.nargs_),
 
   93   for (lincoeff::iterator i = src.
lcoeff_.begin (); i != src.
lcoeff_.end (); ++i)
 
   95     lcoeff_ . push_back (std::pair <exprVar *, CouNumber> 
 
  104   for (lincoeff::iterator i = 
lcoeff_.begin (); i != 
lcoeff_.end (); ++i) {
 
  127   if      (
c0_ >   0.) {
if (nzNL) out << 
'+'; out << 
c0_;}
 
  128   else if (
c0_ < - 0.)                        out << 
c0_;
 
  130   for (
size_t n = 
lcoeff_.size (), i=0; 
n--; i++) {
 
  134     if      (coeff >   0.) { 
if (i || (c0_ != 0.) || nzNL) out << 
'+'; 
if (coeff !=  1.) out <<  coeff << 
"*";}
 
  135     else if (coeff < - 0.) {                               out << 
'-'; 
if (coeff != -1.) out << -coeff << 
"*";}
 
  155   for (lincoeff::iterator el = 
lcoeff_.begin (); el != 
lcoeff_.end (); ++el)
 
  156     if (el -> first -> 
Index () == index)
 
  157       totlin += el -> second;
 
  162     arglist [nargs++] = 
new exprConst (totlin);
 
  164   for (
int i = 0; i < 
nargs_; i++) 
 
  173   else return new exprSum (arglist, nargs);
 
  182     llin  = (
lcoeff_.size () == 0) ?  
 
  186   return (llin > nllin) ? llin : nllin;
 
  206   for (lincoeff::iterator 
 
  213       ind1 = el1 -> first -> 
Index (),
 
  214       ind2 = el2 -> first -> 
Index ();
 
  217       coe1 = el1 -> second,
 
  218       coe2 = el2 -> second;
 
  220     if (ind1 < ind2) 
return -1;
 
  221     if (ind1 > ind2) 
return  1;
 
  240   for (lincoeff::iterator el = 
lcoeff_.begin (); el != 
lcoeff_.end (); ++el) {
 
  242     int r = el -> first -> 
rank ();
 
  256   for (lincoeff::iterator el = 
lcoeff_.begin (); el != 
lcoeff_.end (); ++el)
 
  257     dep -> insert (g -> lookup (el -> first -> 
Index ()));
 
  268   for (lincoeff::iterator el = 
lcoeff_.begin (); el != 
lcoeff_.end (); ++el) {
 
  276     deps += el -> first -> 
DepList (deplist, type);
 
  295   for (lincoeff::iterator el = 
lcoeff_.begin (); el != 
lcoeff_.end (); ++el) {
 
  303     if (intCoe && intVar)
 
  307       lb = el -> first -> lb (), 
 
  308       ub = el -> first -> ub ();
 
  329     xind = x -> 
Index (),
 
  330     wind = w -> 
Index ();
 
  334   lincoeff::iterator x_occur = 
lcoeff_.begin ();
 
  338   while ((x_occur != 
lcoeff_.end ()) && 
 
  339          (x_occur -> first -> 
Index () != xind))
 
  346     x_occur -> first = 
w;
 
  349     lincoeff::iterator w_occur = 
lcoeff_.begin ();
 
  353     while ((w_occur != 
lcoeff_.end ()) &&
 
  354            (w_occur -> first -> 
Index () != wind))
 
  358       x_occur -> first = w;
 
  360                 if ((w_occur -> second += x_occur -> second) == 0.) { 
 
  364         for( x_occur = 
lcoeff_.begin (); x_occur -> first -> 
Index () != xind; ++x_occur )
 
  379   for (lincoeff::iterator el = 
lcoeff_.begin (); el != 
lcoeff_.end (); ++el)
 
  380     retval += el -> second * el -> second;
 
  382   return sqrt (retval);
 
  389   for (lincoeff::iterator el = 
lcoeff_.begin (); el != 
lcoeff_.end (); ++el) {
 
  393     if (((var -> 
Type () == 
VAR) ||  
 
  398       el -> first = p -> Var (var -> 
Index ());
 
virtual int DepList(std::set< int > &deplist, enum dig_type type=ORIG_ONLY)
fill in the set with all indices of variables appearing in the expression 
 
virtual void print(std::ostream &out=std::cout, bool=false) const 
I/O. 
 
virtual int dependsOn(int *ind, int n, enum dig_type type=STOP_AT_AUX)
dependence on variable set: return cardinality of subset of the set of indices in first argument whic...
 
virtual ~exprGroup()
Destructor – needed to clear bounds. 
 
virtual void fillDepSet(std::set< DepNode *, compNode > *, DepGraph *)
update dependence set with index of this variable 
 
virtual int Linearity()
get a measure of "how linear" the expression is: 
 
class Group, with constant, linear and nonlinear terms:  
 
virtual CouNumber gradientNorm(const double *x)
return l-2 norm of gradient at given point 
 
virtual bool isInteger()
is this expression integer? 
 
virtual void print(std::ostream &=std::cout, bool=false) const 
Print expression to iostream. 
 
virtual bool isInteger()
is this expression integer? 
 
virtual void replace(exprVar *x, exprVar *w)
replace variable x with new (aux) w 
 
exprSum(expression **=NULL, int=0)
Constructors, destructor. 
 
lincoeff & lcoeff() const 
return linear term coefficients 
 
CouNumber c0_
constant term 
 
virtual expression * simplify()
simplification 
 
virtual int rank()
used in rank-based branching variable choice 
 
void cleanZeros(std::vector< std::pair< exprVar *, CouNumber > > &lcoeff)
 
virtual int DepList(std::set< int > &deplist, enum dig_type type=ORIG_ONLY)
fill in the set with all indices of variables appearing in the expression 
 
static expression * genExprGroup(CouNumber, lincoeff &, expression **=NULL, int=0)
Generalized (static) constructor: check parameters and return a constant, a single variable...
 
exprGroup(CouNumber, lincoeff &, expression **=NULL, int=0)
Constructor. 
 
virtual enum expr_type code()
code for comparisons 
 
void fint fint fint real fint real real real real real real real real real * e
 
virtual int rank()
used in rank-based branching variable choice 
 
virtual enum nodeType Type() const 
Node type. 
 
virtual int Index() const 
Return index of variable (only valid for exprVar and exprAux) 
 
lincoeff lcoeff_
coefficients and indices of the linear term 
 
Class for MINLP problems with symbolic information. 
 
expression clone (points to another expression) 
 
void fint fint fint real fint real real real real real real real * r
 
virtual expression * simplify()
simplification 
 
expression ** arglist_
argument list is an array of pointers to other expressions 
 
double CouNumber
main number type in Couenne 
 
int nargs_
number of arguments (cardinality of arglist) 
 
virtual int compare(exprGroup &)
only compare with people of the same kind 
 
dig_type
type of digging when filling the dependence list 
 
expr_type
code returned by the method expression::code() 
 
void fint fint fint real fint real real real real real real * g
 
virtual expression * differentiate(int index)
differentiation 
 
virtual void replace(exprVar *, exprVar *)
replace variable with other 
 
virtual void fillDepSet(std::set< DepNode *, compNode > *dep, DepGraph *g)
fill in dependence structure update dependence set with index of this variable 
 
void fint fint fint real fint real real real real real real real real * w
 
virtual void realign(const CouenneProblem *p)
redirect variables to proper variable vector 
 
virtual CouNumber Value() const 
value (empty) 
 
virtual const expression * Original() const 
If this is an exprClone of a exprClone of an expr???, point to the original expr??? instead of an exprClone – improve computing efficiency. 
 
virtual int Linearity()
Get a measure of "how linear" the expression is: 
 
Define a dynamic point+bounds, with a way to save and restore previous points+bounds through a LIFO s...
 
void fint fint fint real fint real * x
 
class for multiplications,