11 #include "CoinHelperFunctions.hpp"
24 using namespace Couenne;
40 if (p -> Jnlst () -> ProduceOutput (Ipopt::J_ALL,
J_REFORMULATE)) {
41 printf (
"Reformulating constraint: ");
print ();
42 printf (
" ["); fflush (stdout);
lb_ ->
print ();
43 printf (
","); fflush (stdout);
ub_ ->
print (); fflush (stdout);
64 p -> bonBase () -> options () -> GetStringValue (
"use_auxcons", use_auxcons,
"couenne.");
65 p -> bonBase () -> options () -> GetStringValue (
"use_semiaux", use_semiaux,
"couenne.");
67 if (( use_auxcons ==
"yes") &&
68 (((use_semiaux ==
"yes") &&
85 int wind = p -> splitAux (rhs,
body_, rest, p -> Commuted (), aSign);
109 if (aSign !=
expression::AUX_LEQ && constRHS > p -> Var (wind) -> lb ()) p -> Var (wind) -> lb () = constRHS;
110 if (aSign !=
expression::AUX_GEQ && constRHS < p -> Var (wind) -> ub ()) p -> Var (wind) -> ub () = constRHS;
120 p -> Commuted () [wind] =
true;
122 if (p -> Jnlst () -> ProduceOutput (Ipopt::J_ALL,
J_REFORMULATE)) {
123 printf (
"---> %d & ", wind); fflush (stdout);
124 rest ->
print (); printf (
"[sign: %d]\n", aSign);
127 assert (p -> Var (wind) -> Type () ==
VAR);
129 int xind = rest -> Index ();
140 p -> domain (), aSign);
141 p -> auxiliarize (w);
146 p -> auxiliarize (p -> Var (wind), p -> Var (xind));
156 p -> domain (), aSign);
158 if (p -> Jnlst () -> ProduceOutput (Ipopt::J_ALL,
J_REFORMULATE)) {
159 printf (
"AuxSet:\n");
160 for (std::set <exprAux *, compExpr>::iterator i = p -> AuxSet () -> begin ();
161 i != p -> AuxSet () ->
end (); ++i)
162 if ((*i) -> Image () == NULL) {
163 (*i) ->
print (); printf (
" does not have an image!!!\n");
165 printf (
"-- "); (*i) ->
print (); printf (
" := ");
166 (*i) -> Image () ->
print (); printf (
"\n");
170 std::set <exprAux *, compExpr>::iterator i = p -> AuxSet () ->
end ();
173 i = p -> AuxSet () -> find (w);
178 p -> AuxSet () -> insert (w);
179 p -> getDepGraph () -> insert (w);
181 if (p -> Jnlst () -> ProduceOutput (Ipopt::J_ALL,
J_REFORMULATE)) {
182 printf (
"now replacing x [%d] with ", wind); fflush (stdout);
183 w ->
print (); printf (
" := ");
184 w -> Image () ->
print (); printf (
"\n");
189 p -> auxiliarize (w);
194 if (p -> Jnlst () -> ProduceOutput (Ipopt::J_ALL,
J_REFORMULATE)) {
195 printf (
"found aux occurrence of "); fflush (stdout);
196 w ->
print (); printf (
" := ");
197 w -> Image () ->
print (); printf (
" ... ");
198 (*i) ->
print (); printf (
" := ");
199 (*i) -> Image () ->
print (); printf (
"\n");
209 int xind = (*i) -> Index (), iMax, iMin;
221 p -> auxiliarize (p -> Var (iMax), p -> Var (iMin));
222 p -> Var (iMax) -> zeroMult ();
223 p -> auxiliarize (w);
231 if (p -> Jnlst () -> ProduceOutput (Ipopt::J_ALL,
J_REFORMULATE))
232 printf (
"\nnormal\n-----------------\n");
251 varStays -> lb () = varLeaves -> lb () = CoinMax (varStays -> lb (), varLeaves -> lb ());
252 varStays -> ub () = varLeaves -> ub () = CoinMin (varStays -> ub (), varLeaves -> ub ());
257 varStays -> lb () = ceil (varStays -> lb ());
258 varStays -> ub () = floor (varStays -> ub ());
260 if (varStays -> Type () ==
AUX)
261 varStays -> setInteger (
true);
265 p -> auxiliarize (varStays);
void replace(CouenneProblem *p, int wind, int xind)
virtual void print(std::ostream &=std::cout)
print constraint
virtual exprAux * standardize(CouenneProblem *)
decompose body of constraint through auxiliary variables
auxSign
"sign" of the constraint defining an auxiliary.
expression * ub_
Upper bound (expression)
Class for MINLP problems with symbolic information.
expression clone (points to another expression)
const Ipopt::EJournalCategory J_REFORMULATE(Ipopt::J_USER7)
expression * lb_
Lower bound (expression)
double CouNumber
main number type in Couenne
expression * Simplified(expression *complicated)
Macro to return already simplified expression without having to do the if part every time simplify ()...
expression * body_
Body of constraint.
The in-memory representation of the variables element.
void fint fint fint real fint real real real real real real real real * w
bool isInteger(CouNumber x)
is this number integer?