Closed svigerske closed 5 years ago
Comment by @LouHafer created at 2007-05-31 22:13:10
Well, trac isn't going to let me attach the files. So ... in CglTwomir.hpp, change the declaration of probname_ to read
/// Problem name
mutable std::string probname_
Here's a diff of CglTwomir.cpp.
--- src/CglTwomir/CglTwomir.cpp (revision 451)
+++ src/CglTwomir/CglTwomir.cpp (working copy)
`@``@` -34,10 +34,14 `@``@`
#define a_max data->cparams.a_max
#define max_elements data->cparams.max_elements
-#define talk false // true
+#ifdef CGL_DEBUG
+// Declarations and defines for debug build.
+#define talk true
-const OsiSolverInterface * six;
+namespace {
+ const OsiSolverInterface *six ;
+}
void write_cut( DGG_constraint_t *cut){ //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
printf("2mir_test: cut: !!!!!!!!!!!!!!!!!!!!!!!***********************************\n");
`@``@` -65,16 +69,24 `@``@`
}
}
+#else // CGL_DEBUG
+#define talk false
+
+#endif // CGL_DEBUG
+
+
//-------------------------------------------------------------------
// Generate cuts
//-------------------------------------------------------------------
void CglTwomir::generateCuts(const OsiSolverInterface & si, OsiCuts & cs,
const CglTreeInfo info ) const
{
-
+# ifdef CGL_DEBUG
//!!!!!!!!!!!!!!!!!!
six = &si;
+# endif
+
// Temp - check if free variables
{
const double *colUpper = si.getColUpper();
`@``@` -91,6 +103,8 `@``@`
return;
}
}
+
+ si.getStrParam(OsiProbName,probname_) ;
DGG_list_t cut_list;
DGG_list_init (&cut_list);
`@``@` -116,7 +130,7 `@``@`
info.formulation_rows );
#ifdef CGL_DEBUG
- const OsiRowCutDebugger debugg(si, probname_);// = si.getRowCutDebugger();
+ const OsiRowCutDebugger debugg(si,probname_.c_str()) ;
const OsiRowCutDebugger *debugger = &debugg;
if (debugger&&!debugger->onOptimalPath(si))
debugger = NULL;
`@``@` -158,7 +172,7 `@``@`
//-------------------------------------------------------------------
CglTwomir::CglTwomir () :
CglCutGenerator(),
- probname_(NULL),
+ probname_(),
do_mir_(true), do_2mir_(true), do_tab_(true), do_form_(true),
t_min_(1), t_max_(1), q_min_(1), q_max_(1), a_max_(2),max_elements_(50000),
form_nrows_(0) {}
`@``@` -180,10 +194,7 `@``@`
max_elements_(source.max_elements_),
form_nrows_(source.form_nrows_)
{
- if (source.probname_)
- probname_ = strdup(source.probname_);
- else
- probname_=NULL;
+ probname_ = source.probname_ ;
}
Comment by fmargot created at 2007-05-31 22:25:37
Resolution: fixed
Issue created by migration from Trac.
Original creator: @LouHafer
Original creation time: 2007-05-31 21:59:21
Assignee: somebody
Probname is declared as (char *), is not consistently loaded with a value, and the destructor does not free the space. Attached files convert probname to std::string and clean up the usage just a little bit.