| 80 | |
| 81 | |
| 82 | Solver::Solver(const QJsonObject& sj) { |
| 83 | json = sj; |
| 84 | name = sj["name"].toString(); |
| 85 | QJsonObject extraInfo = sj["extraInfo"].toObject(); |
| 86 | executable_resolved = extraInfo["executable"].toString(""); |
| 87 | mznlib_resolved = extraInfo["mznlib"].toString(""); |
| 88 | configFile = extraInfo["configFile"].toString(""); |
| 89 | if (extraInfo["defaultFlags"].isArray()) { |
| 90 | QJsonArray ei = extraInfo["defaultFlags"].toArray(); |
| 91 | for (auto df : ei) { |
| 92 | defaultFlags.push_back(df.toString()); |
| 93 | } |
| 94 | } |
| 95 | isDefaultSolver = (extraInfo["isDefault"].isBool() && extraInfo["isDefault"].toBool()); |
| 96 | contact = sj["contact"].toString(""); |
| 97 | website = sj["website"].toString(""); |
| 98 | if (sj["inputType"].isString()) { |
| 99 | auto t = sj["inputType"].toString(); |
| 100 | if (t == "FZN") { |
| 101 | inputType = SolverInputType::I_FZN; |
| 102 | } else if (t == "MZN") { |
| 103 | inputType = SolverInputType::I_MZN; |
| 104 | } else if (t == "NL") { |
| 105 | inputType = SolverInputType::I_NL; |
| 106 | } else if (t == "JSON") { |
| 107 | inputType = SolverInputType::I_JSON; |
| 108 | } else { |
| 109 | inputType = SolverInputType::I_UNKNOWN; |
| 110 | } |
| 111 | } else if (sj["supportsMzn"].toBool()) { |
| 112 | inputType = SolverInputType::I_MZN; |
| 113 | } else if (sj["supportsFzn"].toBool(true)) { |
| 114 | inputType = SolverInputType::I_FZN; |
| 115 | } else { |
| 116 | inputType = SolverInputType::I_UNKNOWN; |
| 117 | } |
| 118 | |
| 119 | if (sj["requiredFlags"].isArray()) { |
| 120 | QJsonArray rfs = sj["requiredFlags"].toArray(); |
| 121 | for (auto rf : rfs) { |
| 122 | requiredFlags.push_back(rf.toString()); |
| 123 | } |
| 124 | } |
| 125 | if (sj["stdFlags"].isArray()) { |
| 126 | QJsonArray sfs = sj["stdFlags"].toArray(); |
| 127 | for (auto sf : sfs) { |
| 128 | stdFlags.push_back(sf.toString()); |
| 129 | } |
| 130 | } |
| 131 | if (sj["extraFlags"].isArray()) { |
| 132 | QJsonArray sfs = sj["extraFlags"].toArray(); |
| 133 | for (auto sf : sfs) { |
| 134 | if (sf.isArray()) { |
| 135 | QJsonArray extraFlagA = sf.toArray(); |
| 136 | if (extraFlagA.size()==4) { |
| 137 | SolverFlag extraFlag; |
| 138 | extraFlag.min=1.0; |
| 139 | extraFlag.max=0.0; |