Skip to content
Snippets Groups Projects
Commit 862dc8a2 authored by Sullivan, Brendan T's avatar Sullivan, Brendan T
Browse files

Re #20634 clang-format

parent 8e4a6cea
No related branches found
No related tags found
No related merge requests found
......@@ -485,26 +485,29 @@ void IFunction::addConstraints(const std::string &str, bool isDefault) {
list.toList();
for (auto it = list.begin(); it != list.end(); ++it) {
auto expr = (*it);
if(expr.terms()[0].str().compare("penalty") == 0){
if (expr.terms()[0].str().compare("penalty") == 0) {
continue;
}
if((it+1) != list.end()){
auto next_expr = *(it+1);
if(next_expr.terms()[0].str().compare("penalty") == 0) {
auto c = std::unique_ptr<IConstraint>(
ConstraintFactory::Instance().createInitialized(this, expr, isDefault));
double penalty_factor = std::stof(next_expr.terms()[1].str(), NULL);
c->setPenaltyFactor(penalty_factor);
this->addConstraint(std::move(c));
if ((it + 1) != list.end()) {
auto next_expr = *(it + 1);
if (next_expr.terms()[0].str().compare("penalty") == 0) {
auto c = std::unique_ptr<IConstraint>(
ConstraintFactory::Instance().createInitialized(this, expr,
isDefault));
double penalty_factor = std::stof(next_expr.terms()[1].str(), NULL);
c->setPenaltyFactor(penalty_factor);
this->addConstraint(std::move(c));
} else {
auto c = std::unique_ptr<IConstraint>(
ConstraintFactory::Instance().createInitialized(this, expr, isDefault));
this->addConstraint(std::move(c));
}
} else {
auto c = std::unique_ptr<IConstraint>(
ConstraintFactory::Instance().createInitialized(this, expr, isDefault));
ConstraintFactory::Instance().createInitialized(this, expr,
isDefault));
this->addConstraint(std::move(c));
}
} else {
auto c = std::unique_ptr<IConstraint>(
ConstraintFactory::Instance().createInitialized(this, expr,
isDefault));
this->addConstraint(std::move(c));
}
}
}
......
......@@ -220,7 +220,7 @@ public:
}
void testSetConstraintPenaltyFactor1() {
std::string fnString =
std::string fnString =
"name=FunctionFactoryConstraintTest_FunctA,a0=0.1,a1=15.1,"
"constraints=(0<a0<0.2,a1>10,penalty=12.)";
......@@ -237,7 +237,7 @@ public:
TS_ASSERT(c1);
TS_ASSERT_EQUALS(c1->check(), 0);
TS_ASSERT_EQUALS(c1->getPenaltyFactor(), 12.);
TS_ASSERT_EQUALS(funa->asString(),
"name=FunctionFactoryConstraintTest_FunctA,a0=0.1,"
"a1=15.1,constraints=(0<a0<0.2,10<a1,penalty=12)");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment