Changeset 765:4405b6be83bb in lemon-0.x for src
- Timestamp:
- 08/19/04 13:31:40 (20 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1027
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/work/marci/lp/lp_solver_wrapper.h
r764 r765 2 2 #ifndef HUGO_LP_SOLVER_WRAPPER_H 3 3 #define HUGO_LP_SOLVER_WRAPPER 4 5 ///\ingroup misc 6 ///\file 7 ///\brief Dijkstra algorithm. 4 8 5 9 // #include <stdio.h> … … 31 35 32 36 namespace hugo { 37 38 39 /// \addtogroup misc 40 /// @{ 33 41 34 42 /// \brief A partitioned vector with iterable classes. … … 120 128 /// Returns the data pointed by \c it. 121 129 const T& operator[](ClassIt it) const { return nodes[it.i].data; } 130 ///. 122 131 class ClassIt { 123 132 friend class IterablePartition; … … 185 194 186 195 public: 196 ///. 187 197 LPX* lp; 198 ///. 188 199 typedef IterablePartition<int>::ClassIt RowIt; 200 ///. 189 201 IterablePartition<int> row_iter_map; 202 ///. 190 203 typedef IterablePartition<int>::ClassIt ColIt; 204 ///. 191 205 IterablePartition<int> col_iter_map; 192 206 //std::vector<int> row_id_to_lp_row_id; 193 207 //std::vector<int> col_id_to_lp_col_id; 208 ///. 194 209 const int VALID_ID; 210 ///. 195 211 const int INVALID_ID; 196 212 197 213 public: 214 ///. 198 215 LPSolverWrapper() : lp(lpx_create_prob()), 199 216 row_iter_map(2), … … 203 220 lpx_set_int_parm(lp, LPX_K_DUAL, 1); 204 221 } 222 ///. 205 223 ~LPSolverWrapper() { 206 224 lpx_delete_prob(lp); 207 225 } 226 ///. 208 227 void setMinimize() { 209 228 lpx_set_obj_dir(lp, LPX_MIN); 210 229 } 230 ///. 211 231 void setMaximize() { 212 232 lpx_set_obj_dir(lp, LPX_MAX); 213 233 } 234 ///. 214 235 ColIt addCol() { 215 236 int i=lpx_add_cols(lp, 1); … … 230 251 return col_it; 231 252 } 253 ///. 232 254 RowIt addRow() { 233 255 int i=lpx_add_rows(lp, 1); … … 243 265 } 244 266 //pair<RowIt, double>-bol kell megadni egy std range-et 267 ///. 245 268 template <typename Begin, typename End> 246 269 void setColCoeffs(const ColIt& col_it, … … 260 283 } 261 284 //pair<ColIt, double>-bol kell megadni egy std range-et 285 ///. 262 286 template <typename Begin, typename End> 263 287 void setRowCoeffs(const RowIt& row_it, … … 276 300 delete [] doubles; 277 301 } 302 ///. 278 303 void eraseCol(const ColIt& col_it) { 279 304 col_iter_map.set(col_it, VALID_ID, INVALID_ID); … … 288 313 } 289 314 } 315 ///. 290 316 void eraseRow(const RowIt& row_it) { 291 317 row_iter_map.set(row_it, VALID_ID, INVALID_ID); … … 300 326 } 301 327 } 328 ///. 302 329 void setColBounds(const ColIt& col_it, int bound_type, 303 330 double lo, double up) { 304 331 lpx_set_col_bnds(lp, col_iter_map[col_it], bound_type, lo, up); 305 332 } 333 ///. 306 334 void setObjCoef(const ColIt& col_it, double obj_coef) { 307 335 lpx_set_obj_coef(lp, col_iter_map[col_it], obj_coef); 308 336 } 337 ///. 309 338 void setRowBounds(const RowIt& row_it, int bound_type, 310 339 double lo, double up) { … … 314 343 // lpx_set_obj_coef(lp, row_iter_map[row_it], obj_coef); 315 344 // } 345 ///. 316 346 void solveSimplex() { lpx_simplex(lp); } 347 ///. 317 348 void solvePrimalSimplex() { lpx_simplex(lp); } 349 ///. 318 350 void solveDualSimplex() { lpx_simplex(lp); } 351 ///. 319 352 double getPrimal(const ColIt& col_it) { 320 353 return lpx_get_col_prim(lp, col_iter_map[col_it]); 321 354 } 355 ///. 322 356 double getObjVal() { return lpx_get_obj_val(lp); } 357 ///. 323 358 int rowNum() const { return lpx_get_num_rows(lp); } 359 ///. 324 360 int colNum() const { return lpx_get_num_cols(lp); } 361 ///. 325 362 int warmUp() { return lpx_warm_up(lp); } 363 ///. 326 364 void printWarmUpStatus(int i) { 327 365 switch (i) { … … 332 370 } 333 371 } 372 ///. 334 373 int getPrimalStatus() { return lpx_get_prim_stat(lp); } 374 ///. 335 375 void printPrimalStatus(int i) { 336 376 switch (i) { … … 341 381 } 342 382 } 383 ///. 343 384 int getDualStatus() { return lpx_get_dual_stat(lp); } 385 ///. 344 386 void printDualStatus(int i) { 345 387 switch (i) { … … 354 396 return lpx_get_row_stat(lp, row_iter_map[row_it]); 355 397 } 398 ///. 356 399 void printRowStatus(int i) { 357 400 switch (i) { … … 367 410 return lpx_get_col_stat(lp, col_iter_map[col_it]); 368 411 } 412 ///. 369 413 void printColStatus(int i) { 370 414 switch (i) { … … 377 421 } 378 422 }; 423 424 /// @} 379 425 380 426 } //namespace hugo
Note: See TracChangeset
for help on using the changeset viewer.