24 using namespace Couenne;
26 #define MIN_DENSITY 0.5
35 if (qmap.
Map().size () == 0)
return;
42 unsigned int nsquares = 0;
44 for (std::map <std::pair <int,int>,
CouNumber>::iterator i = qmap.
Map().begin ();
45 i != qmap.
Map().end (); ++i) {
48 first = i -> first.first,
49 second = i -> first.second;
51 if (occur.find (first) == occur.end ())
54 if (first != second) {
55 if (occur.find (second) == occur.end ())
56 occur.insert (second);
61 printf (
"qmap has %d element, occur has %d, md*s*(s+1)/2 = %g\n",
64 MIN_DENSITY * (double) (occur.size ()) * ((
double) (occur.size ()) + 1.) / 2);
67 int nterms = occur.size ();
73 || (nsquares >= occur.size ()))
80 for (std::map <std::pair <int,int>,
CouNumber>::iterator i = qmap.
Map().begin ();
81 i != qmap.
Map().end (); ++i) {
83 int indI = i -> first.first,
84 indJ = i -> first.second;
96 lmap.
insert (aux -> Index (), i -> second);
99 if (qmap.
Map().size () == 1) {
105 qmap.
Map().erase (qmap.
Map().begin (), qmap.
Map().end ());
Power of an expression (binary operator), with constant.
exprAux * addAuxiliary(expression *)
Add auxiliary variable and associate it with expression given as argument (used in standardization) ...
void insert(int index, CouNumber coe)
insert a pair <int,CouNumber> into a map for linear terms
expression clone (points to another expression)
const Ipopt::EJournalCategory J_REFORMULATE(Ipopt::J_USER7)
exprVar * Var(int i) const
Return pointer to i-th variable.
double CouNumber
main number type in Couenne
bool useQuadratic_
Use quadratic expressions?
std::map< std::pair< int, int >, CouNumber > & Map()
public access
JnlstPtr jnlst_
SmartPointer to the Journalist.
void analyzeSparsity(CouNumber, LinMap &, QuadMap &)
analyze sparsity of potential exprQuad/exprGroup and change linear/quadratic maps accordingly...
class for multiplications,