#ifndef __SCIP_OBJBRANCHRULE_H__
#define __SCIP_OBJBRANCHRULE_H__
#include <cassert>
#include <cstring>
#include <utility>
#include "scip/scip.h"
#include "objscip/objcloneable.h"
namespace scip
{
class ObjBranchrule : public ObjCloneable
{
public:
SCIP* scip_;
char* scip_name_;
char* scip_desc_;
const int scip_priority_;
const int scip_maxdepth_;
const SCIP_Real scip_maxbounddist_;
ObjBranchrule(
SCIP* scip,
const char* name,
const char* desc,
int priority,
int maxdepth,
SCIP_Real maxbounddist
)
: scip_(scip),
scip_name_(0),
scip_desc_(0),
scip_priority_(priority),
scip_maxdepth_(maxdepth),
scip_maxbounddist_(maxbounddist)
{
SCIP_CALL_ABORT( SCIPduplicateMemoryArray(scip_, &scip_name_, name, std::strlen(name)+1) );
SCIP_CALL_ABORT( SCIPduplicateMemoryArray(scip_, &scip_desc_, desc, std::strlen(desc)+1) );
}
ObjBranchrule(const ObjBranchrule& o)
: ObjBranchrule(o.scip_, o.scip_name_, o.scip_desc_, o.scip_priority_, o.scip_maxdepth_, o.scip_maxbounddist_)
{
}
ObjBranchrule(ObjBranchrule&& o)
: scip_(o.scip_),
scip_name_(0),
scip_desc_(0),
scip_priority_(o.scip_priority_),
scip_maxdepth_(o.scip_maxdepth_),
scip_maxbounddist_(o.scip_maxbounddist_)
{
std::swap(scip_name_, o.scip_name_);
std::swap(scip_desc_, o.scip_desc_);
}
virtual ~ObjBranchrule()
{
SCIPfreeMemoryArray(scip_, &scip_name_);
SCIPfreeMemoryArray(scip_, &scip_desc_);
}
ObjBranchrule& operator=(const ObjBranchrule& o) = delete;
ObjBranchrule& operator=(ObjBranchrule&& o) = delete;
virtual SCIP_DECL_BRANCHFREE(scip_free)
{
return SCIP_OKAY;
}
virtual SCIP_DECL_BRANCHINIT(scip_init)
{
return SCIP_OKAY;
}
virtual SCIP_DECL_BRANCHEXIT(scip_exit)
{
return SCIP_OKAY;
}
virtual SCIP_DECL_BRANCHINITSOL(scip_initsol)
{
return SCIP_OKAY;
}
virtual SCIP_DECL_BRANCHEXITSOL(scip_exitsol)
{
return SCIP_OKAY;
}
virtual SCIP_DECL_BRANCHEXECLP(scip_execlp)
{
assert(result != NULL);
*result = SCIP_DIDNOTRUN;
return SCIP_OKAY;
}
virtual SCIP_DECL_BRANCHEXECEXT(scip_execext)
{
assert(result != NULL);
*result = SCIP_DIDNOTRUN;
return SCIP_OKAY;
}
virtual SCIP_DECL_BRANCHEXECPS(scip_execps)
{
assert(result != NULL);
*result = SCIP_DIDNOTRUN;
return SCIP_OKAY;
}
};
}
SCIP_EXPORT
SCIP_RETCODE SCIPincludeObjBranchrule(
SCIP* scip,
scip::ObjBranchrule* objbranchrule,
SCIP_Bool deleteobject
);
SCIP_EXPORT
scip::ObjBranchrule* SCIPfindObjBranchrule(
SCIP* scip,
const char* name
);
SCIP_EXPORT
scip::ObjBranchrule* SCIPgetObjBranchrule(
SCIP* scip,
SCIP_BRANCHRULE* branchrule
);
#endif