From 93c5de8ce11404c12fa1fbdc2d95b4d7f82f8874 Mon Sep 17 00:00:00 2001 From: Hassan Date: Wed, 27 Sep 2023 10:22:05 -0600 Subject: [PATCH] fixed get_rel_solution --- src/GurobiProgram.cpp | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/src/GurobiProgram.cpp b/src/GurobiProgram.cpp index da64bbee..bea67fd7 100755 --- a/src/GurobiProgram.cpp +++ b/src/GurobiProgram.cpp @@ -14,6 +14,24 @@ class cuts: public GRBCallback int soc_viol=0, soc_found=0,soc_added=0,det_viol=0, det_found=0, det_added=0; int soc_viol_user=0, soc_found_user=0,soc_added_user=0,det_viol_user=0, det_found_user=0, det_added_user=0; + + void update_rel_solution(){ + size_t vid, vid_inst; + GRBVar gvar; + param_* v; + for(auto& v_p: m->_vars) + { + v = v_p.second.get(); + auto idx = v->get_id(); + auto dim = v->_dim[0]; + for (auto i = 0; i < dim; i++) { + auto vid = idx + v->get_id_inst(i); + gvar = vars.at(vid); + v->set_double_val(i,getNodeRel(gvar)); + } + } + } + void update_solution(){ size_t vid, vid_inst; GRBVar gvar; @@ -163,7 +181,7 @@ class cuts: public GRBCallback if(nc%1==0){ add_bag_iteration=add_bag; add_full_iteration=add_full; - update_solution(); + update_rel_solution(); // m->compute_funcs(); if(add_soc){ auto res= m->cutting_planes_soc(1e-9, soc_found, soc_added); @@ -584,7 +602,7 @@ bool GurobiProgram::solve(bool relax, double mipgap, double time_limit){ if(add_soc){ - auto res= _model->cutting_planes_soc(1e-6, soc_found, soc_added); + auto res= _model->cutting_planes_soc(1e-9, soc_found, soc_added); if(res.size()>=1){ add_cut=true; for(auto i=0;icutting_planes_threed(1e-6, soc_found, soc_added); + auto res= _model->cutting_planes_threed(1e-9, soc_found, soc_added); if(res.size()>=1){ add_cut=true; for(auto i=0;icuts_eigen_bags(1e-6); + auto res=_model->cuts_eigen_bags(1e-9); if(res.size()>=1){ add_cut=true; for(auto i=0;icuts_eigen_full(1e-6); + auto res2=_model->cuts_eigen_full(1e-9); if(res2.size()>=1){ add_cut=true; for(auto i=0;i