| ... | ... |
@@ -1002,835 +1002,835 @@ |
| 1002 | 1002 |
///Add a new empty column (i.e a new variable) to the LP |
| 1003 | 1003 |
Col addCol() { Col c; c._id = _addColId(_addCol()); return c;}
|
| 1004 | 1004 |
|
| 1005 | 1005 |
///\brief Adds several new columns (i.e variables) at once |
| 1006 | 1006 |
/// |
| 1007 | 1007 |
///This magic function takes a container as its argument and fills |
| 1008 | 1008 |
///its elements with new columns (i.e. variables) |
| 1009 | 1009 |
///\param t can be |
| 1010 | 1010 |
///- a standard STL compatible iterable container with |
| 1011 | 1011 |
///\ref Col as its \c values_type like |
| 1012 | 1012 |
///\code |
| 1013 | 1013 |
///std::vector<LpBase::Col> |
| 1014 | 1014 |
///std::list<LpBase::Col> |
| 1015 | 1015 |
///\endcode |
| 1016 | 1016 |
///- a standard STL compatible iterable container with |
| 1017 | 1017 |
///\ref Col as its \c mapped_type like |
| 1018 | 1018 |
///\code |
| 1019 | 1019 |
///std::map<AnyType,LpBase::Col> |
| 1020 | 1020 |
///\endcode |
| 1021 | 1021 |
///- an iterable lemon \ref concepts::WriteMap "write map" like |
| 1022 | 1022 |
///\code |
| 1023 | 1023 |
///ListGraph::NodeMap<LpBase::Col> |
| 1024 | 1024 |
///ListGraph::ArcMap<LpBase::Col> |
| 1025 | 1025 |
///\endcode |
| 1026 | 1026 |
///\return The number of the created column. |
| 1027 | 1027 |
#ifdef DOXYGEN |
| 1028 | 1028 |
template<class T> |
| 1029 | 1029 |
int addColSet(T &t) { return 0;}
|
| 1030 | 1030 |
#else |
| 1031 | 1031 |
template<class T> |
| 1032 | 1032 |
typename enable_if<typename T::value_type::LpCol,int>::type |
| 1033 | 1033 |
addColSet(T &t,dummy<0> = 0) {
|
| 1034 | 1034 |
int s=0; |
| 1035 | 1035 |
for(typename T::iterator i=t.begin();i!=t.end();++i) {*i=addCol();s++;}
|
| 1036 | 1036 |
return s; |
| 1037 | 1037 |
} |
| 1038 | 1038 |
template<class T> |
| 1039 | 1039 |
typename enable_if<typename T::value_type::second_type::LpCol, |
| 1040 | 1040 |
int>::type |
| 1041 | 1041 |
addColSet(T &t,dummy<1> = 1) {
|
| 1042 | 1042 |
int s=0; |
| 1043 | 1043 |
for(typename T::iterator i=t.begin();i!=t.end();++i) {
|
| 1044 | 1044 |
i->second=addCol(); |
| 1045 | 1045 |
s++; |
| 1046 | 1046 |
} |
| 1047 | 1047 |
return s; |
| 1048 | 1048 |
} |
| 1049 | 1049 |
template<class T> |
| 1050 | 1050 |
typename enable_if<typename T::MapIt::Value::LpCol, |
| 1051 | 1051 |
int>::type |
| 1052 | 1052 |
addColSet(T &t,dummy<2> = 2) {
|
| 1053 | 1053 |
int s=0; |
| 1054 | 1054 |
for(typename T::MapIt i(t); i!=INVALID; ++i) |
| 1055 | 1055 |
{
|
| 1056 | 1056 |
i.set(addCol()); |
| 1057 | 1057 |
s++; |
| 1058 | 1058 |
} |
| 1059 | 1059 |
return s; |
| 1060 | 1060 |
} |
| 1061 | 1061 |
#endif |
| 1062 | 1062 |
|
| 1063 | 1063 |
///Set a column (i.e a dual constraint) of the LP |
| 1064 | 1064 |
|
| 1065 | 1065 |
///\param c is the column to be modified |
| 1066 | 1066 |
///\param e is a dual linear expression (see \ref DualExpr) |
| 1067 | 1067 |
///a better one. |
| 1068 | 1068 |
void col(Col c, const DualExpr &e) {
|
| 1069 | 1069 |
e.simplify(); |
| 1070 | 1070 |
_setColCoeffs(cols(id(c)), ExprIterator(e.comps.begin(), rows), |
| 1071 | 1071 |
ExprIterator(e.comps.end(), rows)); |
| 1072 | 1072 |
} |
| 1073 | 1073 |
|
| 1074 | 1074 |
///Get a column (i.e a dual constraint) of the LP |
| 1075 | 1075 |
|
| 1076 | 1076 |
///\param c is the column to get |
| 1077 | 1077 |
///\return the dual expression associated to the column |
| 1078 | 1078 |
DualExpr col(Col c) const {
|
| 1079 | 1079 |
DualExpr e; |
| 1080 | 1080 |
_getColCoeffs(cols(id(c)), InsertIterator(e.comps, rows)); |
| 1081 | 1081 |
return e; |
| 1082 | 1082 |
} |
| 1083 | 1083 |
|
| 1084 | 1084 |
///Add a new column to the LP |
| 1085 | 1085 |
|
| 1086 | 1086 |
///\param e is a dual linear expression (see \ref DualExpr) |
| 1087 | 1087 |
///\param o is the corresponding component of the objective |
| 1088 | 1088 |
///function. It is 0 by default. |
| 1089 | 1089 |
///\return The created column. |
| 1090 | 1090 |
Col addCol(const DualExpr &e, Value o = 0) {
|
| 1091 | 1091 |
Col c=addCol(); |
| 1092 | 1092 |
col(c,e); |
| 1093 | 1093 |
objCoeff(c,o); |
| 1094 | 1094 |
return c; |
| 1095 | 1095 |
} |
| 1096 | 1096 |
|
| 1097 | 1097 |
///Add a new empty row (i.e a new constraint) to the LP |
| 1098 | 1098 |
|
| 1099 | 1099 |
///This function adds a new empty row (i.e a new constraint) to the LP. |
| 1100 | 1100 |
///\return The created row |
| 1101 | 1101 |
Row addRow() { Row r; r._id = _addRowId(_addRow()); return r;}
|
| 1102 | 1102 |
|
| 1103 | 1103 |
///\brief Add several new rows (i.e constraints) at once |
| 1104 | 1104 |
/// |
| 1105 | 1105 |
///This magic function takes a container as its argument and fills |
| 1106 | 1106 |
///its elements with new row (i.e. variables) |
| 1107 | 1107 |
///\param t can be |
| 1108 | 1108 |
///- a standard STL compatible iterable container with |
| 1109 | 1109 |
///\ref Row as its \c values_type like |
| 1110 | 1110 |
///\code |
| 1111 | 1111 |
///std::vector<LpBase::Row> |
| 1112 | 1112 |
///std::list<LpBase::Row> |
| 1113 | 1113 |
///\endcode |
| 1114 | 1114 |
///- a standard STL compatible iterable container with |
| 1115 | 1115 |
///\ref Row as its \c mapped_type like |
| 1116 | 1116 |
///\code |
| 1117 | 1117 |
///std::map<AnyType,LpBase::Row> |
| 1118 | 1118 |
///\endcode |
| 1119 | 1119 |
///- an iterable lemon \ref concepts::WriteMap "write map" like |
| 1120 | 1120 |
///\code |
| 1121 | 1121 |
///ListGraph::NodeMap<LpBase::Row> |
| 1122 | 1122 |
///ListGraph::ArcMap<LpBase::Row> |
| 1123 | 1123 |
///\endcode |
| 1124 | 1124 |
///\return The number of rows created. |
| 1125 | 1125 |
#ifdef DOXYGEN |
| 1126 | 1126 |
template<class T> |
| 1127 | 1127 |
int addRowSet(T &t) { return 0;}
|
| 1128 | 1128 |
#else |
| 1129 | 1129 |
template<class T> |
| 1130 | 1130 |
typename enable_if<typename T::value_type::LpRow,int>::type |
| 1131 | 1131 |
addRowSet(T &t, dummy<0> = 0) {
|
| 1132 | 1132 |
int s=0; |
| 1133 | 1133 |
for(typename T::iterator i=t.begin();i!=t.end();++i) {*i=addRow();s++;}
|
| 1134 | 1134 |
return s; |
| 1135 | 1135 |
} |
| 1136 | 1136 |
template<class T> |
| 1137 | 1137 |
typename enable_if<typename T::value_type::second_type::LpRow, int>::type |
| 1138 | 1138 |
addRowSet(T &t, dummy<1> = 1) {
|
| 1139 | 1139 |
int s=0; |
| 1140 | 1140 |
for(typename T::iterator i=t.begin();i!=t.end();++i) {
|
| 1141 | 1141 |
i->second=addRow(); |
| 1142 | 1142 |
s++; |
| 1143 | 1143 |
} |
| 1144 | 1144 |
return s; |
| 1145 | 1145 |
} |
| 1146 | 1146 |
template<class T> |
| 1147 | 1147 |
typename enable_if<typename T::MapIt::Value::LpRow, int>::type |
| 1148 | 1148 |
addRowSet(T &t, dummy<2> = 2) {
|
| 1149 | 1149 |
int s=0; |
| 1150 | 1150 |
for(typename T::MapIt i(t); i!=INVALID; ++i) |
| 1151 | 1151 |
{
|
| 1152 | 1152 |
i.set(addRow()); |
| 1153 | 1153 |
s++; |
| 1154 | 1154 |
} |
| 1155 | 1155 |
return s; |
| 1156 | 1156 |
} |
| 1157 | 1157 |
#endif |
| 1158 | 1158 |
|
| 1159 | 1159 |
///Set a row (i.e a constraint) of the LP |
| 1160 | 1160 |
|
| 1161 | 1161 |
///\param r is the row to be modified |
| 1162 | 1162 |
///\param l is lower bound (-\ref INF means no bound) |
| 1163 | 1163 |
///\param e is a linear expression (see \ref Expr) |
| 1164 | 1164 |
///\param u is the upper bound (\ref INF means no bound) |
| 1165 | 1165 |
void row(Row r, Value l, const Expr &e, Value u) {
|
| 1166 | 1166 |
e.simplify(); |
| 1167 | 1167 |
_setRowCoeffs(rows(id(r)), ExprIterator(e.comps.begin(), cols), |
| 1168 | 1168 |
ExprIterator(e.comps.end(), cols)); |
| 1169 | 1169 |
_setRowLowerBound(rows(id(r)),l - *e); |
| 1170 | 1170 |
_setRowUpperBound(rows(id(r)),u - *e); |
| 1171 | 1171 |
} |
| 1172 | 1172 |
|
| 1173 | 1173 |
///Set a row (i.e a constraint) of the LP |
| 1174 | 1174 |
|
| 1175 | 1175 |
///\param r is the row to be modified |
| 1176 | 1176 |
///\param c is a linear expression (see \ref Constr) |
| 1177 | 1177 |
void row(Row r, const Constr &c) {
|
| 1178 | 1178 |
row(r, c.lowerBounded()?c.lowerBound():-INF, |
| 1179 | 1179 |
c.expr(), c.upperBounded()?c.upperBound():INF); |
| 1180 | 1180 |
} |
| 1181 | 1181 |
|
| 1182 | 1182 |
|
| 1183 | 1183 |
///Get a row (i.e a constraint) of the LP |
| 1184 | 1184 |
|
| 1185 | 1185 |
///\param r is the row to get |
| 1186 | 1186 |
///\return the expression associated to the row |
| 1187 | 1187 |
Expr row(Row r) const {
|
| 1188 | 1188 |
Expr e; |
| 1189 | 1189 |
_getRowCoeffs(rows(id(r)), InsertIterator(e.comps, cols)); |
| 1190 | 1190 |
return e; |
| 1191 | 1191 |
} |
| 1192 | 1192 |
|
| 1193 | 1193 |
///Add a new row (i.e a new constraint) to the LP |
| 1194 | 1194 |
|
| 1195 | 1195 |
///\param l is the lower bound (-\ref INF means no bound) |
| 1196 | 1196 |
///\param e is a linear expression (see \ref Expr) |
| 1197 | 1197 |
///\param u is the upper bound (\ref INF means no bound) |
| 1198 | 1198 |
///\return The created row. |
| 1199 | 1199 |
Row addRow(Value l,const Expr &e, Value u) {
|
| 1200 | 1200 |
Row r=addRow(); |
| 1201 | 1201 |
row(r,l,e,u); |
| 1202 | 1202 |
return r; |
| 1203 | 1203 |
} |
| 1204 | 1204 |
|
| 1205 | 1205 |
///Add a new row (i.e a new constraint) to the LP |
| 1206 | 1206 |
|
| 1207 | 1207 |
///\param c is a linear expression (see \ref Constr) |
| 1208 | 1208 |
///\return The created row. |
| 1209 | 1209 |
Row addRow(const Constr &c) {
|
| 1210 | 1210 |
Row r=addRow(); |
| 1211 | 1211 |
row(r,c); |
| 1212 | 1212 |
return r; |
| 1213 | 1213 |
} |
| 1214 | 1214 |
///Erase a column (i.e a variable) from the LP |
| 1215 | 1215 |
|
| 1216 | 1216 |
///\param c is the column to be deleted |
| 1217 | 1217 |
void erase(Col c) {
|
| 1218 | 1218 |
_eraseCol(cols(id(c))); |
| 1219 | 1219 |
_eraseColId(cols(id(c))); |
| 1220 | 1220 |
} |
| 1221 | 1221 |
///Erase a row (i.e a constraint) from the LP |
| 1222 | 1222 |
|
| 1223 | 1223 |
///\param r is the row to be deleted |
| 1224 | 1224 |
void erase(Row r) {
|
| 1225 | 1225 |
_eraseRow(rows(id(r))); |
| 1226 | 1226 |
_eraseRowId(rows(id(r))); |
| 1227 | 1227 |
} |
| 1228 | 1228 |
|
| 1229 | 1229 |
/// Get the name of a column |
| 1230 | 1230 |
|
| 1231 | 1231 |
///\param c is the coresponding column |
| 1232 | 1232 |
///\return The name of the colunm |
| 1233 | 1233 |
std::string colName(Col c) const {
|
| 1234 | 1234 |
std::string name; |
| 1235 | 1235 |
_getColName(cols(id(c)), name); |
| 1236 | 1236 |
return name; |
| 1237 | 1237 |
} |
| 1238 | 1238 |
|
| 1239 | 1239 |
/// Set the name of a column |
| 1240 | 1240 |
|
| 1241 | 1241 |
///\param c is the coresponding column |
| 1242 | 1242 |
///\param name The name to be given |
| 1243 | 1243 |
void colName(Col c, const std::string& name) {
|
| 1244 | 1244 |
_setColName(cols(id(c)), name); |
| 1245 | 1245 |
} |
| 1246 | 1246 |
|
| 1247 | 1247 |
/// Get the column by its name |
| 1248 | 1248 |
|
| 1249 | 1249 |
///\param name The name of the column |
| 1250 | 1250 |
///\return the proper column or \c INVALID |
| 1251 | 1251 |
Col colByName(const std::string& name) const {
|
| 1252 | 1252 |
int k = _colByName(name); |
| 1253 | 1253 |
return k != -1 ? Col(cols[k]) : Col(INVALID); |
| 1254 | 1254 |
} |
| 1255 | 1255 |
|
| 1256 | 1256 |
/// Get the name of a row |
| 1257 | 1257 |
|
| 1258 | 1258 |
///\param r is the coresponding row |
| 1259 | 1259 |
///\return The name of the row |
| 1260 | 1260 |
std::string rowName(Row r) const {
|
| 1261 | 1261 |
std::string name; |
| 1262 | 1262 |
_getRowName(rows(id(r)), name); |
| 1263 | 1263 |
return name; |
| 1264 | 1264 |
} |
| 1265 | 1265 |
|
| 1266 | 1266 |
/// Set the name of a row |
| 1267 | 1267 |
|
| 1268 | 1268 |
///\param r is the coresponding row |
| 1269 | 1269 |
///\param name The name to be given |
| 1270 | 1270 |
void rowName(Row r, const std::string& name) {
|
| 1271 | 1271 |
_setRowName(rows(id(r)), name); |
| 1272 | 1272 |
} |
| 1273 | 1273 |
|
| 1274 | 1274 |
/// Get the row by its name |
| 1275 | 1275 |
|
| 1276 | 1276 |
///\param name The name of the row |
| 1277 | 1277 |
///\return the proper row or \c INVALID |
| 1278 | 1278 |
Row rowByName(const std::string& name) const {
|
| 1279 | 1279 |
int k = _rowByName(name); |
| 1280 | 1280 |
return k != -1 ? Row(rows[k]) : Row(INVALID); |
| 1281 | 1281 |
} |
| 1282 | 1282 |
|
| 1283 | 1283 |
/// Set an element of the coefficient matrix of the LP |
| 1284 | 1284 |
|
| 1285 | 1285 |
///\param r is the row of the element to be modified |
| 1286 | 1286 |
///\param c is the column of the element to be modified |
| 1287 | 1287 |
///\param val is the new value of the coefficient |
| 1288 | 1288 |
void coeff(Row r, Col c, Value val) {
|
| 1289 | 1289 |
_setCoeff(rows(id(r)),cols(id(c)), val); |
| 1290 | 1290 |
} |
| 1291 | 1291 |
|
| 1292 | 1292 |
/// Get an element of the coefficient matrix of the LP |
| 1293 | 1293 |
|
| 1294 | 1294 |
///\param r is the row of the element |
| 1295 | 1295 |
///\param c is the column of the element |
| 1296 | 1296 |
///\return the corresponding coefficient |
| 1297 | 1297 |
Value coeff(Row r, Col c) const {
|
| 1298 | 1298 |
return _getCoeff(rows(id(r)),cols(id(c))); |
| 1299 | 1299 |
} |
| 1300 | 1300 |
|
| 1301 | 1301 |
/// Set the lower bound of a column (i.e a variable) |
| 1302 | 1302 |
|
| 1303 | 1303 |
/// The lower bound of a variable (column) has to be given by an |
| 1304 | 1304 |
/// extended number of type Value, i.e. a finite number of type |
| 1305 | 1305 |
/// Value or -\ref INF. |
| 1306 | 1306 |
void colLowerBound(Col c, Value value) {
|
| 1307 | 1307 |
_setColLowerBound(cols(id(c)),value); |
| 1308 | 1308 |
} |
| 1309 | 1309 |
|
| 1310 | 1310 |
/// Get the lower bound of a column (i.e a variable) |
| 1311 | 1311 |
|
| 1312 | 1312 |
/// This function returns the lower bound for column (variable) \c c |
| 1313 | 1313 |
/// (this might be -\ref INF as well). |
| 1314 | 1314 |
///\return The lower bound for column \c c |
| 1315 | 1315 |
Value colLowerBound(Col c) const {
|
| 1316 | 1316 |
return _getColLowerBound(cols(id(c))); |
| 1317 | 1317 |
} |
| 1318 | 1318 |
|
| 1319 | 1319 |
///\brief Set the lower bound of several columns |
| 1320 | 1320 |
///(i.e variables) at once |
| 1321 | 1321 |
/// |
| 1322 | 1322 |
///This magic function takes a container as its argument |
| 1323 | 1323 |
///and applies the function on all of its elements. |
| 1324 | 1324 |
///The lower bound of a variable (column) has to be given by an |
| 1325 | 1325 |
///extended number of type Value, i.e. a finite number of type |
| 1326 | 1326 |
///Value or -\ref INF. |
| 1327 | 1327 |
#ifdef DOXYGEN |
| 1328 | 1328 |
template<class T> |
| 1329 | 1329 |
void colLowerBound(T &t, Value value) { return 0;}
|
| 1330 | 1330 |
#else |
| 1331 | 1331 |
template<class T> |
| 1332 | 1332 |
typename enable_if<typename T::value_type::LpCol,void>::type |
| 1333 | 1333 |
colLowerBound(T &t, Value value,dummy<0> = 0) {
|
| 1334 | 1334 |
for(typename T::iterator i=t.begin();i!=t.end();++i) {
|
| 1335 | 1335 |
colLowerBound(*i, value); |
| 1336 | 1336 |
} |
| 1337 | 1337 |
} |
| 1338 | 1338 |
template<class T> |
| 1339 | 1339 |
typename enable_if<typename T::value_type::second_type::LpCol, |
| 1340 | 1340 |
void>::type |
| 1341 | 1341 |
colLowerBound(T &t, Value value,dummy<1> = 1) {
|
| 1342 | 1342 |
for(typename T::iterator i=t.begin();i!=t.end();++i) {
|
| 1343 | 1343 |
colLowerBound(i->second, value); |
| 1344 | 1344 |
} |
| 1345 | 1345 |
} |
| 1346 | 1346 |
template<class T> |
| 1347 | 1347 |
typename enable_if<typename T::MapIt::Value::LpCol, |
| 1348 | 1348 |
void>::type |
| 1349 | 1349 |
colLowerBound(T &t, Value value,dummy<2> = 2) {
|
| 1350 | 1350 |
for(typename T::MapIt i(t); i!=INVALID; ++i){
|
| 1351 | 1351 |
colLowerBound(*i, value); |
| 1352 | 1352 |
} |
| 1353 | 1353 |
} |
| 1354 | 1354 |
#endif |
| 1355 | 1355 |
|
| 1356 | 1356 |
/// Set the upper bound of a column (i.e a variable) |
| 1357 | 1357 |
|
| 1358 | 1358 |
/// The upper bound of a variable (column) has to be given by an |
| 1359 | 1359 |
/// extended number of type Value, i.e. a finite number of type |
| 1360 | 1360 |
/// Value or \ref INF. |
| 1361 | 1361 |
void colUpperBound(Col c, Value value) {
|
| 1362 | 1362 |
_setColUpperBound(cols(id(c)),value); |
| 1363 | 1363 |
}; |
| 1364 | 1364 |
|
| 1365 | 1365 |
/// Get the upper bound of a column (i.e a variable) |
| 1366 | 1366 |
|
| 1367 | 1367 |
/// This function returns the upper bound for column (variable) \c c |
| 1368 | 1368 |
/// (this might be \ref INF as well). |
| 1369 | 1369 |
/// \return The upper bound for column \c c |
| 1370 | 1370 |
Value colUpperBound(Col c) const {
|
| 1371 | 1371 |
return _getColUpperBound(cols(id(c))); |
| 1372 | 1372 |
} |
| 1373 | 1373 |
|
| 1374 | 1374 |
///\brief Set the upper bound of several columns |
| 1375 | 1375 |
///(i.e variables) at once |
| 1376 | 1376 |
/// |
| 1377 | 1377 |
///This magic function takes a container as its argument |
| 1378 | 1378 |
///and applies the function on all of its elements. |
| 1379 | 1379 |
///The upper bound of a variable (column) has to be given by an |
| 1380 | 1380 |
///extended number of type Value, i.e. a finite number of type |
| 1381 | 1381 |
///Value or \ref INF. |
| 1382 | 1382 |
#ifdef DOXYGEN |
| 1383 | 1383 |
template<class T> |
| 1384 | 1384 |
void colUpperBound(T &t, Value value) { return 0;}
|
| 1385 | 1385 |
#else |
| 1386 |
template<class T> |
|
| 1387 |
typename enable_if<typename T::value_type::LpCol,void>::type |
|
| 1388 |
colUpperBound(T &t, Value value,dummy<0> = 0) {
|
|
| 1389 |
for(typename T::iterator i=t.begin();i!=t.end();++i) {
|
|
| 1386 |
template<class T1> |
|
| 1387 |
typename enable_if<typename T1::value_type::LpCol,void>::type |
|
| 1388 |
colUpperBound(T1 &t, Value value,dummy<0> = 0) {
|
|
| 1389 |
for(typename T1::iterator i=t.begin();i!=t.end();++i) {
|
|
| 1390 | 1390 |
colUpperBound(*i, value); |
| 1391 | 1391 |
} |
| 1392 | 1392 |
} |
| 1393 |
template<class T> |
|
| 1394 |
typename enable_if<typename T::value_type::second_type::LpCol, |
|
| 1393 |
template<class T1> |
|
| 1394 |
typename enable_if<typename T1::value_type::second_type::LpCol, |
|
| 1395 | 1395 |
void>::type |
| 1396 |
colUpperBound(T &t, Value value,dummy<1> = 1) {
|
|
| 1397 |
for(typename T::iterator i=t.begin();i!=t.end();++i) {
|
|
| 1396 |
colUpperBound(T1 &t, Value value,dummy<1> = 1) {
|
|
| 1397 |
for(typename T1::iterator i=t.begin();i!=t.end();++i) {
|
|
| 1398 | 1398 |
colUpperBound(i->second, value); |
| 1399 | 1399 |
} |
| 1400 | 1400 |
} |
| 1401 |
template<class T> |
|
| 1402 |
typename enable_if<typename T::MapIt::Value::LpCol, |
|
| 1401 |
template<class T1> |
|
| 1402 |
typename enable_if<typename T1::MapIt::Value::LpCol, |
|
| 1403 | 1403 |
void>::type |
| 1404 |
colUpperBound(T &t, Value value,dummy<2> = 2) {
|
|
| 1405 |
for(typename T::MapIt i(t); i!=INVALID; ++i){
|
|
| 1404 |
colUpperBound(T1 &t, Value value,dummy<2> = 2) {
|
|
| 1405 |
for(typename T1::MapIt i(t); i!=INVALID; ++i){
|
|
| 1406 | 1406 |
colUpperBound(*i, value); |
| 1407 | 1407 |
} |
| 1408 | 1408 |
} |
| 1409 | 1409 |
#endif |
| 1410 | 1410 |
|
| 1411 | 1411 |
/// Set the lower and the upper bounds of a column (i.e a variable) |
| 1412 | 1412 |
|
| 1413 | 1413 |
/// The lower and the upper bounds of |
| 1414 | 1414 |
/// a variable (column) have to be given by an |
| 1415 | 1415 |
/// extended number of type Value, i.e. a finite number of type |
| 1416 | 1416 |
/// Value, -\ref INF or \ref INF. |
| 1417 | 1417 |
void colBounds(Col c, Value lower, Value upper) {
|
| 1418 | 1418 |
_setColLowerBound(cols(id(c)),lower); |
| 1419 | 1419 |
_setColUpperBound(cols(id(c)),upper); |
| 1420 | 1420 |
} |
| 1421 | 1421 |
|
| 1422 | 1422 |
///\brief Set the lower and the upper bound of several columns |
| 1423 | 1423 |
///(i.e variables) at once |
| 1424 | 1424 |
/// |
| 1425 | 1425 |
///This magic function takes a container as its argument |
| 1426 | 1426 |
///and applies the function on all of its elements. |
| 1427 | 1427 |
/// The lower and the upper bounds of |
| 1428 | 1428 |
/// a variable (column) have to be given by an |
| 1429 | 1429 |
/// extended number of type Value, i.e. a finite number of type |
| 1430 | 1430 |
/// Value, -\ref INF or \ref INF. |
| 1431 | 1431 |
#ifdef DOXYGEN |
| 1432 | 1432 |
template<class T> |
| 1433 | 1433 |
void colBounds(T &t, Value lower, Value upper) { return 0;}
|
| 1434 | 1434 |
#else |
| 1435 |
template<class T> |
|
| 1436 |
typename enable_if<typename T::value_type::LpCol,void>::type |
|
| 1437 |
colBounds(T &t, Value lower, Value upper,dummy<0> = 0) {
|
|
| 1438 |
for(typename T::iterator i=t.begin();i!=t.end();++i) {
|
|
| 1435 |
template<class T2> |
|
| 1436 |
typename enable_if<typename T2::value_type::LpCol,void>::type |
|
| 1437 |
colBounds(T2 &t, Value lower, Value upper,dummy<0> = 0) {
|
|
| 1438 |
for(typename T2::iterator i=t.begin();i!=t.end();++i) {
|
|
| 1439 | 1439 |
colBounds(*i, lower, upper); |
| 1440 | 1440 |
} |
| 1441 | 1441 |
} |
| 1442 |
template<class T> |
|
| 1443 |
typename enable_if<typename T::value_type::second_type::LpCol, void>::type |
|
| 1444 |
colBounds(T &t, Value lower, Value upper,dummy<1> = 1) {
|
|
| 1445 |
for(typename T::iterator i=t.begin();i!=t.end();++i) {
|
|
| 1442 |
template<class T2> |
|
| 1443 |
typename enable_if<typename T2::value_type::second_type::LpCol, void>::type |
|
| 1444 |
colBounds(T2 &t, Value lower, Value upper,dummy<1> = 1) {
|
|
| 1445 |
for(typename T2::iterator i=t.begin();i!=t.end();++i) {
|
|
| 1446 | 1446 |
colBounds(i->second, lower, upper); |
| 1447 | 1447 |
} |
| 1448 | 1448 |
} |
| 1449 |
template<class T> |
|
| 1450 |
typename enable_if<typename T::MapIt::Value::LpCol, void>::type |
|
| 1451 |
colBounds(T &t, Value lower, Value upper,dummy<2> = 2) {
|
|
| 1452 |
for(typename T::MapIt i(t); i!=INVALID; ++i){
|
|
| 1449 |
template<class T2> |
|
| 1450 |
typename enable_if<typename T2::MapIt::Value::LpCol, void>::type |
|
| 1451 |
colBounds(T2 &t, Value lower, Value upper,dummy<2> = 2) {
|
|
| 1452 |
for(typename T2::MapIt i(t); i!=INVALID; ++i){
|
|
| 1453 | 1453 |
colBounds(*i, lower, upper); |
| 1454 | 1454 |
} |
| 1455 | 1455 |
} |
| 1456 | 1456 |
#endif |
| 1457 | 1457 |
|
| 1458 | 1458 |
/// Set the lower bound of a row (i.e a constraint) |
| 1459 | 1459 |
|
| 1460 | 1460 |
/// The lower bound of a constraint (row) has to be given by an |
| 1461 | 1461 |
/// extended number of type Value, i.e. a finite number of type |
| 1462 | 1462 |
/// Value or -\ref INF. |
| 1463 | 1463 |
void rowLowerBound(Row r, Value value) {
|
| 1464 | 1464 |
_setRowLowerBound(rows(id(r)),value); |
| 1465 | 1465 |
} |
| 1466 | 1466 |
|
| 1467 | 1467 |
/// Get the lower bound of a row (i.e a constraint) |
| 1468 | 1468 |
|
| 1469 | 1469 |
/// This function returns the lower bound for row (constraint) \c c |
| 1470 | 1470 |
/// (this might be -\ref INF as well). |
| 1471 | 1471 |
///\return The lower bound for row \c r |
| 1472 | 1472 |
Value rowLowerBound(Row r) const {
|
| 1473 | 1473 |
return _getRowLowerBound(rows(id(r))); |
| 1474 | 1474 |
} |
| 1475 | 1475 |
|
| 1476 | 1476 |
/// Set the upper bound of a row (i.e a constraint) |
| 1477 | 1477 |
|
| 1478 | 1478 |
/// The upper bound of a constraint (row) has to be given by an |
| 1479 | 1479 |
/// extended number of type Value, i.e. a finite number of type |
| 1480 | 1480 |
/// Value or -\ref INF. |
| 1481 | 1481 |
void rowUpperBound(Row r, Value value) {
|
| 1482 | 1482 |
_setRowUpperBound(rows(id(r)),value); |
| 1483 | 1483 |
} |
| 1484 | 1484 |
|
| 1485 | 1485 |
/// Get the upper bound of a row (i.e a constraint) |
| 1486 | 1486 |
|
| 1487 | 1487 |
/// This function returns the upper bound for row (constraint) \c c |
| 1488 | 1488 |
/// (this might be -\ref INF as well). |
| 1489 | 1489 |
///\return The upper bound for row \c r |
| 1490 | 1490 |
Value rowUpperBound(Row r) const {
|
| 1491 | 1491 |
return _getRowUpperBound(rows(id(r))); |
| 1492 | 1492 |
} |
| 1493 | 1493 |
|
| 1494 | 1494 |
///Set an element of the objective function |
| 1495 | 1495 |
void objCoeff(Col c, Value v) {_setObjCoeff(cols(id(c)),v); };
|
| 1496 | 1496 |
|
| 1497 | 1497 |
///Get an element of the objective function |
| 1498 | 1498 |
Value objCoeff(Col c) const { return _getObjCoeff(cols(id(c))); };
|
| 1499 | 1499 |
|
| 1500 | 1500 |
///Set the objective function |
| 1501 | 1501 |
|
| 1502 | 1502 |
///\param e is a linear expression of type \ref Expr. |
| 1503 | 1503 |
/// |
| 1504 | 1504 |
void obj(const Expr& e) {
|
| 1505 | 1505 |
_setObjCoeffs(ExprIterator(e.comps.begin(), cols), |
| 1506 | 1506 |
ExprIterator(e.comps.end(), cols)); |
| 1507 | 1507 |
obj_const_comp = *e; |
| 1508 | 1508 |
} |
| 1509 | 1509 |
|
| 1510 | 1510 |
///Get the objective function |
| 1511 | 1511 |
|
| 1512 | 1512 |
///\return the objective function as a linear expression of type |
| 1513 | 1513 |
///Expr. |
| 1514 | 1514 |
Expr obj() const {
|
| 1515 | 1515 |
Expr e; |
| 1516 | 1516 |
_getObjCoeffs(InsertIterator(e.comps, cols)); |
| 1517 | 1517 |
*e = obj_const_comp; |
| 1518 | 1518 |
return e; |
| 1519 | 1519 |
} |
| 1520 | 1520 |
|
| 1521 | 1521 |
|
| 1522 | 1522 |
///Set the direction of optimization |
| 1523 | 1523 |
void sense(Sense sense) { _setSense(sense); }
|
| 1524 | 1524 |
|
| 1525 | 1525 |
///Query the direction of the optimization |
| 1526 | 1526 |
Sense sense() const {return _getSense(); }
|
| 1527 | 1527 |
|
| 1528 | 1528 |
///Set the sense to maximization |
| 1529 | 1529 |
void max() { _setSense(MAX); }
|
| 1530 | 1530 |
|
| 1531 | 1531 |
///Set the sense to maximization |
| 1532 | 1532 |
void min() { _setSense(MIN); }
|
| 1533 | 1533 |
|
| 1534 | 1534 |
///Clears the problem |
| 1535 | 1535 |
void clear() { _clear(); }
|
| 1536 | 1536 |
|
| 1537 | 1537 |
///@} |
| 1538 | 1538 |
|
| 1539 | 1539 |
}; |
| 1540 | 1540 |
|
| 1541 | 1541 |
/// Addition |
| 1542 | 1542 |
|
| 1543 | 1543 |
///\relates LpBase::Expr |
| 1544 | 1544 |
/// |
| 1545 | 1545 |
inline LpBase::Expr operator+(const LpBase::Expr &a, const LpBase::Expr &b) {
|
| 1546 | 1546 |
LpBase::Expr tmp(a); |
| 1547 | 1547 |
tmp+=b; |
| 1548 | 1548 |
return tmp; |
| 1549 | 1549 |
} |
| 1550 | 1550 |
///Substraction |
| 1551 | 1551 |
|
| 1552 | 1552 |
///\relates LpBase::Expr |
| 1553 | 1553 |
/// |
| 1554 | 1554 |
inline LpBase::Expr operator-(const LpBase::Expr &a, const LpBase::Expr &b) {
|
| 1555 | 1555 |
LpBase::Expr tmp(a); |
| 1556 | 1556 |
tmp-=b; |
| 1557 | 1557 |
return tmp; |
| 1558 | 1558 |
} |
| 1559 | 1559 |
///Multiply with constant |
| 1560 | 1560 |
|
| 1561 | 1561 |
///\relates LpBase::Expr |
| 1562 | 1562 |
/// |
| 1563 | 1563 |
inline LpBase::Expr operator*(const LpBase::Expr &a, const LpBase::Value &b) {
|
| 1564 | 1564 |
LpBase::Expr tmp(a); |
| 1565 | 1565 |
tmp*=b; |
| 1566 | 1566 |
return tmp; |
| 1567 | 1567 |
} |
| 1568 | 1568 |
|
| 1569 | 1569 |
///Multiply with constant |
| 1570 | 1570 |
|
| 1571 | 1571 |
///\relates LpBase::Expr |
| 1572 | 1572 |
/// |
| 1573 | 1573 |
inline LpBase::Expr operator*(const LpBase::Value &a, const LpBase::Expr &b) {
|
| 1574 | 1574 |
LpBase::Expr tmp(b); |
| 1575 | 1575 |
tmp*=a; |
| 1576 | 1576 |
return tmp; |
| 1577 | 1577 |
} |
| 1578 | 1578 |
///Divide with constant |
| 1579 | 1579 |
|
| 1580 | 1580 |
///\relates LpBase::Expr |
| 1581 | 1581 |
/// |
| 1582 | 1582 |
inline LpBase::Expr operator/(const LpBase::Expr &a, const LpBase::Value &b) {
|
| 1583 | 1583 |
LpBase::Expr tmp(a); |
| 1584 | 1584 |
tmp/=b; |
| 1585 | 1585 |
return tmp; |
| 1586 | 1586 |
} |
| 1587 | 1587 |
|
| 1588 | 1588 |
///Create constraint |
| 1589 | 1589 |
|
| 1590 | 1590 |
///\relates LpBase::Constr |
| 1591 | 1591 |
/// |
| 1592 | 1592 |
inline LpBase::Constr operator<=(const LpBase::Expr &e, |
| 1593 | 1593 |
const LpBase::Expr &f) {
|
| 1594 | 1594 |
return LpBase::Constr(0, f - e, LpBase::INF); |
| 1595 | 1595 |
} |
| 1596 | 1596 |
|
| 1597 | 1597 |
///Create constraint |
| 1598 | 1598 |
|
| 1599 | 1599 |
///\relates LpBase::Constr |
| 1600 | 1600 |
/// |
| 1601 | 1601 |
inline LpBase::Constr operator<=(const LpBase::Value &e, |
| 1602 | 1602 |
const LpBase::Expr &f) {
|
| 1603 | 1603 |
return LpBase::Constr(e, f, LpBase::NaN); |
| 1604 | 1604 |
} |
| 1605 | 1605 |
|
| 1606 | 1606 |
///Create constraint |
| 1607 | 1607 |
|
| 1608 | 1608 |
///\relates LpBase::Constr |
| 1609 | 1609 |
/// |
| 1610 | 1610 |
inline LpBase::Constr operator<=(const LpBase::Expr &e, |
| 1611 | 1611 |
const LpBase::Value &f) {
|
| 1612 | 1612 |
return LpBase::Constr(- LpBase::INF, e, f); |
| 1613 | 1613 |
} |
| 1614 | 1614 |
|
| 1615 | 1615 |
///Create constraint |
| 1616 | 1616 |
|
| 1617 | 1617 |
///\relates LpBase::Constr |
| 1618 | 1618 |
/// |
| 1619 | 1619 |
inline LpBase::Constr operator>=(const LpBase::Expr &e, |
| 1620 | 1620 |
const LpBase::Expr &f) {
|
| 1621 | 1621 |
return LpBase::Constr(0, e - f, LpBase::INF); |
| 1622 | 1622 |
} |
| 1623 | 1623 |
|
| 1624 | 1624 |
|
| 1625 | 1625 |
///Create constraint |
| 1626 | 1626 |
|
| 1627 | 1627 |
///\relates LpBase::Constr |
| 1628 | 1628 |
/// |
| 1629 | 1629 |
inline LpBase::Constr operator>=(const LpBase::Value &e, |
| 1630 | 1630 |
const LpBase::Expr &f) {
|
| 1631 | 1631 |
return LpBase::Constr(LpBase::NaN, f, e); |
| 1632 | 1632 |
} |
| 1633 | 1633 |
|
| 1634 | 1634 |
|
| 1635 | 1635 |
///Create constraint |
| 1636 | 1636 |
|
| 1637 | 1637 |
///\relates LpBase::Constr |
| 1638 | 1638 |
/// |
| 1639 | 1639 |
inline LpBase::Constr operator>=(const LpBase::Expr &e, |
| 1640 | 1640 |
const LpBase::Value &f) {
|
| 1641 | 1641 |
return LpBase::Constr(f, e, LpBase::INF); |
| 1642 | 1642 |
} |
| 1643 | 1643 |
|
| 1644 | 1644 |
///Create constraint |
| 1645 | 1645 |
|
| 1646 | 1646 |
///\relates LpBase::Constr |
| 1647 | 1647 |
/// |
| 1648 | 1648 |
inline LpBase::Constr operator==(const LpBase::Expr &e, |
| 1649 | 1649 |
const LpBase::Value &f) {
|
| 1650 | 1650 |
return LpBase::Constr(f, e, f); |
| 1651 | 1651 |
} |
| 1652 | 1652 |
|
| 1653 | 1653 |
///Create constraint |
| 1654 | 1654 |
|
| 1655 | 1655 |
///\relates LpBase::Constr |
| 1656 | 1656 |
/// |
| 1657 | 1657 |
inline LpBase::Constr operator==(const LpBase::Expr &e, |
| 1658 | 1658 |
const LpBase::Expr &f) {
|
| 1659 | 1659 |
return LpBase::Constr(0, f - e, 0); |
| 1660 | 1660 |
} |
| 1661 | 1661 |
|
| 1662 | 1662 |
///Create constraint |
| 1663 | 1663 |
|
| 1664 | 1664 |
///\relates LpBase::Constr |
| 1665 | 1665 |
/// |
| 1666 | 1666 |
inline LpBase::Constr operator<=(const LpBase::Value &n, |
| 1667 | 1667 |
const LpBase::Constr &c) {
|
| 1668 | 1668 |
LpBase::Constr tmp(c); |
| 1669 | 1669 |
LEMON_ASSERT(isNaN(tmp.lowerBound()), "Wrong LP constraint"); |
| 1670 | 1670 |
tmp.lowerBound()=n; |
| 1671 | 1671 |
return tmp; |
| 1672 | 1672 |
} |
| 1673 | 1673 |
///Create constraint |
| 1674 | 1674 |
|
| 1675 | 1675 |
///\relates LpBase::Constr |
| 1676 | 1676 |
/// |
| 1677 | 1677 |
inline LpBase::Constr operator<=(const LpBase::Constr &c, |
| 1678 | 1678 |
const LpBase::Value &n) |
| 1679 | 1679 |
{
|
| 1680 | 1680 |
LpBase::Constr tmp(c); |
| 1681 | 1681 |
LEMON_ASSERT(isNaN(tmp.upperBound()), "Wrong LP constraint"); |
| 1682 | 1682 |
tmp.upperBound()=n; |
| 1683 | 1683 |
return tmp; |
| 1684 | 1684 |
} |
| 1685 | 1685 |
|
| 1686 | 1686 |
///Create constraint |
| 1687 | 1687 |
|
| 1688 | 1688 |
///\relates LpBase::Constr |
| 1689 | 1689 |
/// |
| 1690 | 1690 |
inline LpBase::Constr operator>=(const LpBase::Value &n, |
| 1691 | 1691 |
const LpBase::Constr &c) {
|
| 1692 | 1692 |
LpBase::Constr tmp(c); |
| 1693 | 1693 |
LEMON_ASSERT(isNaN(tmp.upperBound()), "Wrong LP constraint"); |
| 1694 | 1694 |
tmp.upperBound()=n; |
| 1695 | 1695 |
return tmp; |
| 1696 | 1696 |
} |
| 1697 | 1697 |
///Create constraint |
| 1698 | 1698 |
|
| 1699 | 1699 |
///\relates LpBase::Constr |
| 1700 | 1700 |
/// |
| 1701 | 1701 |
inline LpBase::Constr operator>=(const LpBase::Constr &c, |
| 1702 | 1702 |
const LpBase::Value &n) |
| 1703 | 1703 |
{
|
| 1704 | 1704 |
LpBase::Constr tmp(c); |
| 1705 | 1705 |
LEMON_ASSERT(isNaN(tmp.lowerBound()), "Wrong LP constraint"); |
| 1706 | 1706 |
tmp.lowerBound()=n; |
| 1707 | 1707 |
return tmp; |
| 1708 | 1708 |
} |
| 1709 | 1709 |
|
| 1710 | 1710 |
///Addition |
| 1711 | 1711 |
|
| 1712 | 1712 |
///\relates LpBase::DualExpr |
| 1713 | 1713 |
/// |
| 1714 | 1714 |
inline LpBase::DualExpr operator+(const LpBase::DualExpr &a, |
| 1715 | 1715 |
const LpBase::DualExpr &b) {
|
| 1716 | 1716 |
LpBase::DualExpr tmp(a); |
| 1717 | 1717 |
tmp+=b; |
| 1718 | 1718 |
return tmp; |
| 1719 | 1719 |
} |
| 1720 | 1720 |
///Substraction |
| 1721 | 1721 |
|
| 1722 | 1722 |
///\relates LpBase::DualExpr |
| 1723 | 1723 |
/// |
| 1724 | 1724 |
inline LpBase::DualExpr operator-(const LpBase::DualExpr &a, |
| 1725 | 1725 |
const LpBase::DualExpr &b) {
|
| 1726 | 1726 |
LpBase::DualExpr tmp(a); |
| 1727 | 1727 |
tmp-=b; |
| 1728 | 1728 |
return tmp; |
| 1729 | 1729 |
} |
| 1730 | 1730 |
///Multiply with constant |
| 1731 | 1731 |
|
| 1732 | 1732 |
///\relates LpBase::DualExpr |
| 1733 | 1733 |
/// |
| 1734 | 1734 |
inline LpBase::DualExpr operator*(const LpBase::DualExpr &a, |
| 1735 | 1735 |
const LpBase::Value &b) {
|
| 1736 | 1736 |
LpBase::DualExpr tmp(a); |
| 1737 | 1737 |
tmp*=b; |
| 1738 | 1738 |
return tmp; |
| 1739 | 1739 |
} |
| 1740 | 1740 |
|
| 1741 | 1741 |
///Multiply with constant |
| 1742 | 1742 |
|
| 1743 | 1743 |
///\relates LpBase::DualExpr |
| 1744 | 1744 |
/// |
| 1745 | 1745 |
inline LpBase::DualExpr operator*(const LpBase::Value &a, |
| 1746 | 1746 |
const LpBase::DualExpr &b) {
|
| 1747 | 1747 |
LpBase::DualExpr tmp(b); |
| 1748 | 1748 |
tmp*=a; |
| 1749 | 1749 |
return tmp; |
| 1750 | 1750 |
} |
| 1751 | 1751 |
///Divide with constant |
| 1752 | 1752 |
|
| 1753 | 1753 |
///\relates LpBase::DualExpr |
| 1754 | 1754 |
/// |
| 1755 | 1755 |
inline LpBase::DualExpr operator/(const LpBase::DualExpr &a, |
| 1756 | 1756 |
const LpBase::Value &b) {
|
| 1757 | 1757 |
LpBase::DualExpr tmp(a); |
| 1758 | 1758 |
tmp/=b; |
| 1759 | 1759 |
return tmp; |
| 1760 | 1760 |
} |
| 1761 | 1761 |
|
| 1762 | 1762 |
/// \ingroup lp_group |
| 1763 | 1763 |
/// |
| 1764 | 1764 |
/// \brief Common base class for LP solvers |
| 1765 | 1765 |
/// |
| 1766 | 1766 |
/// This class is an abstract base class for LP solvers. This class |
| 1767 | 1767 |
/// provides a full interface for set and modify an LP problem, |
| 1768 | 1768 |
/// solve it and retrieve the solution. You can use one of the |
| 1769 | 1769 |
/// descendants as a concrete implementation, or the \c Lp |
| 1770 | 1770 |
/// default LP solver. However, if you would like to handle LP |
| 1771 | 1771 |
/// solvers as reference or pointer in a generic way, you can use |
| 1772 | 1772 |
/// this class directly. |
| 1773 | 1773 |
class LpSolver : virtual public LpBase {
|
| 1774 | 1774 |
public: |
| 1775 | 1775 |
|
| 1776 | 1776 |
/// The problem types for primal and dual problems |
| 1777 | 1777 |
enum ProblemType {
|
| 1778 | 1778 |
///Feasible solution hasn't been found (but may exist). |
| 1779 | 1779 |
UNDEFINED = 0, |
| 1780 | 1780 |
///The problem has no feasible solution |
| 1781 | 1781 |
INFEASIBLE = 1, |
| 1782 | 1782 |
///Feasible solution found |
| 1783 | 1783 |
FEASIBLE = 2, |
| 1784 | 1784 |
///Optimal solution exists and found |
| 1785 | 1785 |
OPTIMAL = 3, |
| 1786 | 1786 |
///The cost function is unbounded |
| 1787 | 1787 |
UNBOUNDED = 4 |
| 1788 | 1788 |
}; |
| 1789 | 1789 |
|
| 1790 | 1790 |
///The basis status of variables |
| 1791 | 1791 |
enum VarStatus {
|
| 1792 | 1792 |
/// The variable is in the basis |
| 1793 | 1793 |
BASIC, |
| 1794 | 1794 |
/// The variable is free, but not basic |
| 1795 | 1795 |
FREE, |
| 1796 | 1796 |
/// The variable has active lower bound |
| 1797 | 1797 |
LOWER, |
| 1798 | 1798 |
/// The variable has active upper bound |
| 1799 | 1799 |
UPPER, |
| 1800 | 1800 |
/// The variable is non-basic and fixed |
| 1801 | 1801 |
FIXED |
| 1802 | 1802 |
}; |
| 1803 | 1803 |
|
| 1804 | 1804 |
protected: |
| 1805 | 1805 |
|
| 1806 | 1806 |
virtual SolveExitStatus _solve() = 0; |
| 1807 | 1807 |
|
| 1808 | 1808 |
virtual Value _getPrimal(int i) const = 0; |
| 1809 | 1809 |
virtual Value _getDual(int i) const = 0; |
| 1810 | 1810 |
|
| 1811 | 1811 |
virtual Value _getPrimalRay(int i) const = 0; |
| 1812 | 1812 |
virtual Value _getDualRay(int i) const = 0; |
| 1813 | 1813 |
|
| 1814 | 1814 |
virtual Value _getPrimalValue() const = 0; |
| 1815 | 1815 |
|
| 1816 | 1816 |
virtual VarStatus _getColStatus(int i) const = 0; |
| 1817 | 1817 |
virtual VarStatus _getRowStatus(int i) const = 0; |
| 1818 | 1818 |
|
| 1819 | 1819 |
virtual ProblemType _getPrimalType() const = 0; |
| 1820 | 1820 |
virtual ProblemType _getDualType() const = 0; |
| 1821 | 1821 |
|
| 1822 | 1822 |
public: |
| 1823 | 1823 |
|
| 1824 | 1824 |
///\name Solve the LP |
| 1825 | 1825 |
|
| 1826 | 1826 |
///@{
|
| 1827 | 1827 |
|
| 1828 | 1828 |
///\e Solve the LP problem at hand |
| 1829 | 1829 |
/// |
| 1830 | 1830 |
///\return The result of the optimization procedure. Possible |
| 1831 | 1831 |
///values and their meanings can be found in the documentation of |
| 1832 | 1832 |
///\ref SolveExitStatus. |
| 1833 | 1833 |
SolveExitStatus solve() { return _solve(); }
|
| 1834 | 1834 |
|
| 1835 | 1835 |
///@} |
| 1836 | 1836 |
|
0 comments (0 inline)