diff -r 615aca7091d2 -r 4405b6be83bb src/work/marci/lp/lp_solver_wrapper.h --- a/src/work/marci/lp/lp_solver_wrapper.h Tue Aug 17 13:20:46 2004 +0000 +++ b/src/work/marci/lp/lp_solver_wrapper.h Thu Aug 19 11:31:40 2004 +0000 @@ -2,6 +2,10 @@ #ifndef HUGO_LP_SOLVER_WRAPPER_H #define HUGO_LP_SOLVER_WRAPPER +///\ingroup misc +///\file +///\brief Dijkstra algorithm. + // #include #include // #include @@ -31,6 +35,10 @@ namespace hugo { + + /// \addtogroup misc + /// @{ + /// \brief A partitioned vector with iterable classes. /// /// This class implements a container in which the data is stored in an @@ -119,6 +127,7 @@ T& operator[](ClassIt it) { return nodes[it.i].data; } /// Returns the data pointed by \c it. const T& operator[](ClassIt it) const { return nodes[it.i].data; } + ///. class ClassIt { friend class IterablePartition; protected: @@ -184,17 +193,25 @@ // }; public: + ///. LPX* lp; + ///. typedef IterablePartition::ClassIt RowIt; + ///. IterablePartition row_iter_map; + ///. typedef IterablePartition::ClassIt ColIt; + ///. IterablePartition col_iter_map; //std::vector row_id_to_lp_row_id; //std::vector col_id_to_lp_col_id; + ///. const int VALID_ID; + ///. const int INVALID_ID; public: + ///. LPSolverWrapper() : lp(lpx_create_prob()), row_iter_map(2), col_iter_map(2), @@ -202,15 +219,19 @@ VALID_ID(0), INVALID_ID(1) { lpx_set_int_parm(lp, LPX_K_DUAL, 1); } + ///. ~LPSolverWrapper() { lpx_delete_prob(lp); } + ///. void setMinimize() { lpx_set_obj_dir(lp, LPX_MIN); } + ///. void setMaximize() { lpx_set_obj_dir(lp, LPX_MAX); } + ///. ColIt addCol() { int i=lpx_add_cols(lp, 1); ColIt col_it; @@ -229,6 +250,7 @@ // lpx_set_obj_coef(lp, i, cost[e]); return col_it; } + ///. RowIt addRow() { int i=lpx_add_rows(lp, 1); RowIt row_it; @@ -242,6 +264,7 @@ return row_it; } //pair-bol kell megadni egy std range-et + ///. template void setColCoeffs(const ColIt& col_it, Begin begin, End end) { @@ -259,6 +282,7 @@ delete [] doubles; } //pair-bol kell megadni egy std range-et + ///. template void setRowCoeffs(const RowIt& row_it, Begin begin, End end) { @@ -275,6 +299,7 @@ delete [] indices; delete [] doubles; } + ///. void eraseCol(const ColIt& col_it) { col_iter_map.set(col_it, VALID_ID, INVALID_ID); int cols[2]; @@ -287,6 +312,7 @@ if (col_iter_map[it]>cols[1]) --col_iter_map[it]; } } + ///. void eraseRow(const RowIt& row_it) { row_iter_map.set(row_it, VALID_ID, INVALID_ID); int rows[2]; @@ -299,13 +325,16 @@ if (row_iter_map[it]>rows[1]) --row_iter_map[it]; } } + ///. void setColBounds(const ColIt& col_it, int bound_type, double lo, double up) { lpx_set_col_bnds(lp, col_iter_map[col_it], bound_type, lo, up); } + ///. void setObjCoef(const ColIt& col_it, double obj_coef) { lpx_set_obj_coef(lp, col_iter_map[col_it], obj_coef); } + ///. void setRowBounds(const RowIt& row_it, int bound_type, double lo, double up) { lpx_set_row_bnds(lp, row_iter_map[row_it], bound_type, lo, up); @@ -313,16 +342,25 @@ // void setObjCoef(const RowIt& row_it, double obj_coef) { // lpx_set_obj_coef(lp, row_iter_map[row_it], obj_coef); // } + ///. void solveSimplex() { lpx_simplex(lp); } + ///. void solvePrimalSimplex() { lpx_simplex(lp); } + ///. void solveDualSimplex() { lpx_simplex(lp); } + ///. double getPrimal(const ColIt& col_it) { return lpx_get_col_prim(lp, col_iter_map[col_it]); } + ///. double getObjVal() { return lpx_get_obj_val(lp); } + ///. int rowNum() const { return lpx_get_num_rows(lp); } + ///. int colNum() const { return lpx_get_num_cols(lp); } + ///. int warmUp() { return lpx_warm_up(lp); } + ///. void printWarmUpStatus(int i) { switch (i) { case LPX_E_OK: cout << "LPX_E_OK" << endl; break; @@ -331,7 +369,9 @@ case LPX_E_SING: cout << "LPX_E_SING" << endl; break; } } + ///. int getPrimalStatus() { return lpx_get_prim_stat(lp); } + ///. void printPrimalStatus(int i) { switch (i) { case LPX_P_UNDEF: cout << "LPX_P_UNDEF" << endl; break; @@ -340,7 +380,9 @@ case LPX_P_NOFEAS: cout << "LPX_P_NOFEAS" << endl; break; } } + ///. int getDualStatus() { return lpx_get_dual_stat(lp); } + ///. void printDualStatus(int i) { switch (i) { case LPX_D_UNDEF: cout << "LPX_D_UNDEF" << endl; break; @@ -353,6 +395,7 @@ int getRowStat(const RowIt& row_it) { return lpx_get_row_stat(lp, row_iter_map[row_it]); } + ///. void printRowStatus(int i) { switch (i) { case LPX_BS: cout << "LPX_BS" << endl; break; @@ -366,6 +409,7 @@ int getColStat(const ColIt& col_it) { return lpx_get_col_stat(lp, col_iter_map[col_it]); } + ///. void printColStatus(int i) { switch (i) { case LPX_BS: cout << "LPX_BS" << endl; break; @@ -376,6 +420,8 @@ } } }; + + /// @} } //namespace hugo