17 using namespace Couenne;
22 std::map <int, CouNumber> &indices) {
25 printf (
"flatten %d ---> ", mul -> code ()); mul ->
print ();
33 int ind = (aux) ? aux -> Index () : mul -> Index ();
35 std::map <int, CouNumber>::iterator
36 where = indices.find (ind);
38 if (where == indices.end ())
39 indices.insert (std::pair <int, CouNumber> (ind, 1));
40 else ++ (where -> second);
45 int nargs = mul -> nArgs ();
49 for (
int i=0; i < nargs; i++) {
53 *simpl = arg -> simplify ();
59 printf (
" flatten arg %d ---> ", arg -> code ());
64 switch (arg -> code ()) {
68 coe *= arg -> Value ();
78 std::map <int, CouNumber>::iterator
79 where = indices.find (arg -> Index ());
81 if (where == indices.end ())
82 indices.insert (std::pair <int, CouNumber> (arg -> Index (), 1));
83 else ++ (where -> second);
90 if (arg -> Argument () -> Type () ==
N_ARY) {
93 }
else arg = arg -> Argument ();
100 *base = arg -> ArgList () [0],
101 *exponent = arg -> ArgList () [1];
103 if (exponent -> Type () ==
CONST) {
105 double expnum = exponent -> Value ();
112 std::map <int, CouNumber>::iterator
113 where = indices.find (aux -> Index ());
115 if (where == indices.end ())
116 indices.insert (std::pair <int, CouNumber> (aux -> Index (), expnum));
117 else (where -> second += expnum);
126 (arg -> nArgs () == 1)) {
137 int ind = (aux) ? aux -> Index () : arg -> Index ();
139 std::map <int, CouNumber>::iterator
140 where = indices.find (ind);
142 if (where == indices.end ())
143 indices.insert (std::pair <int, CouNumber> (ind, 1));
144 else ++ (where -> second);
void print(std::ostream &=std::cout)
Display current representation of problem: objective, linear and nonlinear constraints, and auxiliary variables.
const Ipopt::EJournalCategory J_REFORMULATE(Ipopt::J_USER7)
bool standardize()
Break problem's nonlinear constraints in simple expressions to be convexified later.
void flattenMul(expression *mul, CouNumber &coe, std::map< int, CouNumber > &indices)
re-organizes multiplication and stores indices (and exponents) of its variables
double CouNumber
main number type in Couenne
JnlstPtr jnlst_
SmartPointer to the Journalist.