bool LinFeasPump::shouldFP_() { ConstConstraintPtr c; if (env_->getOptions()->findInt("LinFPump")->getValue()<0) { return false; } if (p_->getSize()->ints > 0) { logger_->msgStream(LogInfo) << me_ << "skipping because of integer " "variables" << std::endl; return false; } if (p_->getSize()->bins < 31 && 0==env_->getOptions()->findInt("LinFPump")->getValue()) { logger_->msgStream(LogInfo) << me_ << "skipping because of too few binary " "variables" << std::endl; return false; } for (ConstraintConstIterator c_it=p_->consBegin(); c_it!=p_->consEnd(); ++c_it) { c = *c_it; if (c->getFunctionType() != Linear) { if (c->getLb() > -INFINITY && c->getUb() < INFINITY) { logger_->msgStream(LogInfo) << me_ << "skipping because of nonlinear " << "equality or range constraint" << std::endl; return false; } } } return true; }
void Transformer::copyLinear_(ConstProblemPtr p, ProblemPtr newp) { FunctionPtr f; LinearFunctionPtr newlf; ConstConstraintPtr c; ConstraintPtr newc; ObjectivePtr obj; // copy linear constraints. for (ConstraintConstIterator it=p->consBegin(); it!=p->consEnd(); ++it) { c = *it; if (Linear==c->getFunction()->getType()) { // create a clone of this linear function. newlf = c->getLinearFunction()->cloneWithVars(newp->varsBegin()); f = (FunctionPtr) new Function(newlf); newc = newp->newConstraint(f, c->getLb(), c->getUb()); lHandler_->addConstraint(newc); } } // copy linear objective. obj = p->getObjective(); if (!obj) { f.reset(); newp_->newObjective(f, 0.0, Minimize); } else { switch (obj->getFunctionType()) { case (Constant): f = FunctionPtr(); // NULL newp->newObjective(f, obj->getConstant(), obj->getObjectiveType(), obj->getName()); break; case (Linear): newlf = obj->getFunction()->getLinearFunction()-> cloneWithVars(newp->varsBegin()); f = (FunctionPtr) new Function(newlf); newp->newObjective(f, obj->getConstant(), obj->getObjectiveType(), obj->getName()); break; default: break; } } }