Changeset 2321:e23a610bed51 in lemon0.x for lemon
 Timestamp:
 12/04/06 14:13:14 (13 years ago)
 Branch:
 default
 Phase:
 public
 Convert:
 svn:c9d7d8f590d60310b91f818b3a526b0e/lemon/trunk@3097
 Location:
 lemon
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

lemon/lp_glpk.cc
r2312 r2321 32 32 } 33 33 34 LpGlpk::LpGlpk(const LpGlpk &glp) : Parent(glp), 35 lp(lpx_create_prob()) { 36 ///\todo constrol function for this: 37 lpx_set_int_parm(lp, LPX_K_DUAL, 1); 38 messageLevel(0); 39 //Coefficient matrix, row bounds 40 lpx_add_rows(lp, lpx_get_num_rows(glp.lp)); 41 lpx_add_cols(lp, lpx_get_num_cols(glp.lp)); 42 int len; 43 int ind[1+lpx_get_num_cols(glp.lp)]; 44 Value val[1+lpx_get_num_cols(glp.lp)]; 45 for (int i=1;i<=lpx_get_num_rows(glp.lp);++i) 46 { 47 len=lpx_get_mat_row(glp.lp,i,ind,val); 48 lpx_set_mat_row(lp, i,len,ind,val); 49 lpx_set_row_bnds(lp,i,lpx_get_row_type(glp.lp,i), 50 lpx_get_row_lb(glp.lp,i),lpx_get_row_ub(glp.lp,i)); 51 } 52 53 //Objective function, coloumn bounds 54 lpx_set_obj_dir(lp, lpx_get_obj_dir(glp.lp)); 55 //Objectif function's constant term treated separately 56 lpx_set_obj_coef(lp,0,lpx_get_obj_coef(glp.lp,0)); 57 for (int i=1;i<=lpx_get_num_cols(glp.lp);++i) 58 { 59 lpx_set_obj_coef(lp,i,lpx_get_obj_coef(glp.lp,i)); 60 lpx_set_col_bnds(lp,i,lpx_get_col_type(glp.lp,i), 61 lpx_get_col_lb(glp.lp,i),lpx_get_col_ub(glp.lp,i)); 62 } 63 } 64 34 65 LpGlpk::~LpGlpk() { 35 66 lpx_delete_prob(lp); … … 48 79 LpSolverBase &LpGlpk::_newLp() 49 80 { 50 LpGlpk* newlp=new LpGlpk ();81 LpGlpk* newlp=new LpGlpk; 51 82 return *newlp; 52 83 } … … 56 87 LpSolverBase &LpGlpk::_copyLp() 57 88 { 58 LpGlpk* newlp=new LpGlpk(); 59 60 //Coefficient matrix, row bounds 61 lpx_add_rows(newlp>lp, lpx_get_num_rows(lp)); 62 lpx_add_cols(newlp>lp, lpx_get_num_cols(lp)); 63 int len; 64 int ind[1+lpx_get_num_cols(lp)]; 65 Value val[1+lpx_get_num_cols(lp)]; 66 for (int i=1;i<=lpx_get_num_rows(lp);++i){ 67 len=lpx_get_mat_row(lp,i,ind,val); 68 lpx_set_mat_row(newlp>lp, i,len,ind,val); 69 lpx_set_row_bnds(newlp>lp,i,lpx_get_row_type(lp,i), 70 lpx_get_row_lb(lp,i),lpx_get_row_ub(lp,i)); 71 } 72 73 //Objective function, coloumn bounds 74 lpx_set_obj_dir(newlp>lp, lpx_get_obj_dir(lp)); 75 //Objectif function's constant term treated separately 76 lpx_set_obj_coef(newlp>lp,0,lpx_get_obj_coef(lp,0)); 77 for (int i=1;i<=lpx_get_num_cols(lp);++i){ 78 lpx_set_obj_coef(newlp>lp,i,lpx_get_obj_coef(lp,i)); 79 lpx_set_col_bnds(newlp>lp,i,lpx_get_col_type(lp,i), 80 lpx_get_col_lb(lp,i),lpx_get_col_ub(lp,i)); 81 82 83 } 84 89 LpGlpk* newlp=new LpGlpk(*this); 85 90 return *newlp; 86 91 } 
lemon/lp_glpk.h
r2312 r2321 45 45 46 46 LpGlpk(); 47 LpGlpk(const LpGlpk &); 47 48 ~LpGlpk(); 48 49 … … 109 110 ///The presolver is off by default. 110 111 void presolver(bool b); 111 112 113 LPX *lpx() {return lp;} 112 114 }; 113 115 } //END OF NAMESPACE LEMON
Note: See TracChangeset
for help on using the changeset viewer.