edit multidim_knapsack to print assigned items + formatting the code

This commit is contained in:
Driss Lahlou
2016-11-16 18:20:16 +01:00
parent ca094af0e0
commit bd0ecc2d06
13 changed files with 105 additions and 68 deletions

View File

@@ -40,7 +40,8 @@ void VariableParser::Parse() {
std::vector<std::string> lines;
ParseFileByLines(filename_, &lines);
for (const std::string& line : lines) {
std::vector<std::string> tokens = strings::Split(line, " ", strings::SkipEmpty());
std::vector<std::string> tokens =
strings::Split(line, " ", strings::SkipEmpty());
if (tokens.empty()) {
continue;
}
@@ -66,7 +67,8 @@ void DomainParser::Parse() {
std::vector<std::string> lines;
ParseFileByLines(filename_, &lines);
for (const std::string& line : lines) {
std::vector<std::string> tokens = strings::Split(line, " ", strings::SkipEmpty());
std::vector<std::string> tokens =
strings::Split(line, " ", strings::SkipEmpty());
if (tokens.empty()) {
continue;
}
@@ -96,7 +98,8 @@ void ConstraintParser::Parse() {
std::vector<std::string> lines;
ParseFileByLines(filename_, &lines);
for (const std::string& line : lines) {
std::vector<std::string> tokens = strings::Split(line, " ", strings::SkipEmpty());
std::vector<std::string> tokens =
strings::Split(line, " ", strings::SkipEmpty());
if (tokens.empty()) {
continue;
}
@@ -154,7 +157,8 @@ void ParametersParser::Parse() {
constraint_coefficient_no_ + variable_coefficient_no_);
objective = false;
if (line.find("=") != std::string::npos) {
std::vector<std::string> tokens = strings::Split(line, " ", strings::SkipEmpty());
std::vector<std::string> tokens =
strings::Split(line, " ", strings::SkipEmpty());
CHECK_GE(tokens.size(), 3);
coefficients.push_back(atoi32(tokens[2].c_str()));
}