#ifndef __SCIP_OBJCONSHDLR_H__
#define __SCIP_OBJCONSHDLR_H__
#include <cassert>
#include <cstring>
#include <utility>
#include "scip/scip.h"
#include "objscip/objprobcloneable.h"
namespace scip
{
class ObjConshdlr : public ObjProbCloneable
{
public:
SCIP* scip_;
char* scip_name_;
char* scip_desc_;
const int scip_sepapriority_;
const int scip_enfopriority_;
const int scip_checkpriority_;
const int scip_sepafreq_;
const int scip_propfreq_;
const int scip_eagerfreq_;
const int scip_maxprerounds_;
const SCIP_Bool scip_delaysepa_;
const SCIP_Bool scip_delayprop_;
const SCIP_Bool scip_needscons_;
const SCIP_PROPTIMING scip_proptiming_;
const SCIP_PRESOLTIMING scip_presoltiming_;
ObjConshdlr(
SCIP* scip,
const char* name,
const char* desc,
int sepapriority,
int enfopriority,
int checkpriority,
int sepafreq,
int propfreq,
int eagerfreq,
int maxprerounds,
SCIP_Bool delaysepa,
SCIP_Bool delayprop,
SCIP_Bool needscons,
SCIP_PROPTIMING proptiming,
SCIP_PRESOLTIMING presoltiming
)
: scip_(scip),
scip_name_(0),
scip_desc_(0),
scip_sepapriority_(sepapriority),
scip_enfopriority_(enfopriority),
scip_checkpriority_(checkpriority),
scip_sepafreq_(sepafreq),
scip_propfreq_(propfreq),
scip_eagerfreq_(eagerfreq),
scip_maxprerounds_(maxprerounds),
scip_delaysepa_(delaysepa),
scip_delayprop_(delayprop),
scip_needscons_(needscons),
scip_proptiming_(proptiming),
scip_presoltiming_(presoltiming)
{
SCIP_CALL_ABORT( SCIPduplicateMemoryArray(scip_, &scip_name_, name, std::strlen(name)+1) );
SCIP_CALL_ABORT( SCIPduplicateMemoryArray(scip_, &scip_desc_, desc, std::strlen(desc)+1) );
}
ObjConshdlr(const ObjConshdlr& o)
: ObjConshdlr(o.scip_, o.scip_name_, o.scip_desc_, o.scip_sepapriority_, o.scip_enfopriority_,
o.scip_checkpriority_, o.scip_sepafreq_, o.scip_propfreq_, o.scip_eagerfreq_, o.scip_maxprerounds_,
o.scip_delaysepa_, o.scip_delayprop_, o.scip_needscons_, o.scip_proptiming_, o.scip_presoltiming_)
{
}
ObjConshdlr(ObjConshdlr&& o)
: scip_(o.scip_),
scip_name_(0),
scip_desc_(0),
scip_sepapriority_(o.scip_sepapriority_),
scip_enfopriority_(o.scip_enfopriority_),
scip_checkpriority_(o.scip_checkpriority_),
scip_sepafreq_(o.scip_sepafreq_),
scip_propfreq_(o.scip_propfreq_),
scip_eagerfreq_(o.scip_eagerfreq_),
scip_maxprerounds_(o.scip_maxprerounds_),
scip_delaysepa_(o.scip_delaysepa_),
scip_delayprop_(o.scip_delayprop_),
scip_needscons_(o.scip_needscons_),
scip_proptiming_(o.scip_proptiming_),
scip_presoltiming_(o.scip_presoltiming_)
{
std::swap(scip_name_, o.scip_name_);
std::swap(scip_desc_, o.scip_desc_);
}
virtual ~ObjConshdlr()
{
SCIPfreeMemoryArray(scip_, &scip_name_);
SCIPfreeMemoryArray(scip_, &scip_desc_);
}
ObjConshdlr& operator=(const ObjConshdlr& o) = delete;
ObjConshdlr& operator=(ObjConshdlr&& o) = delete;
virtual SCIP_DECL_CONSFREE(scip_free)
{
return SCIP_OKAY;
}
virtual SCIP_DECL_CONSINIT(scip_init)
{
return SCIP_OKAY;
}
virtual SCIP_DECL_CONSEXIT(scip_exit)
{
return SCIP_OKAY;
}
virtual SCIP_DECL_CONSINITPRE(scip_initpre)
{
return SCIP_OKAY;
}
virtual SCIP_DECL_CONSEXITPRE(scip_exitpre)
{
return SCIP_OKAY;
}
virtual SCIP_DECL_CONSINITSOL(scip_initsol)
{
return SCIP_OKAY;
}
virtual SCIP_DECL_CONSEXITSOL(scip_exitsol)
{
return SCIP_OKAY;
}
virtual SCIP_DECL_CONSDELETE(scip_delete)
{
return SCIP_OKAY;
}
virtual SCIP_DECL_CONSTRANS(scip_trans) = 0;
virtual SCIP_DECL_CONSINITLP(scip_initlp)
{
return SCIP_OKAY;
}
virtual SCIP_DECL_CONSSEPALP(scip_sepalp)
{
assert(result != NULL);
*result = SCIP_DIDNOTRUN;
return SCIP_OKAY;
}
virtual SCIP_DECL_CONSSEPASOL(scip_sepasol)
{
assert(result != NULL);
*result = SCIP_DIDNOTRUN;
return SCIP_OKAY;
}
virtual SCIP_DECL_CONSENFOLP(scip_enfolp) = 0;
virtual SCIP_DECL_CONSENFORELAX(scip_enforelax)
{
assert(result != NULL);
*result = SCIP_DIDNOTRUN;
return SCIP_OKAY;
}
virtual SCIP_DECL_CONSENFOPS(scip_enfops) = 0;
virtual SCIP_DECL_CONSCHECK(scip_check) = 0;
virtual SCIP_DECL_CONSPROP(scip_prop)
{
assert(result != NULL);
*result = SCIP_DIDNOTRUN;
return SCIP_OKAY;
}
virtual SCIP_DECL_CONSPRESOL(scip_presol)
{
assert(result != NULL);
*result = SCIP_DIDNOTRUN;
return SCIP_OKAY;
}
virtual SCIP_DECL_CONSRESPROP(scip_resprop)
{
assert(result != NULL);
*result = SCIP_DIDNOTFIND;
return SCIP_OKAY;
}
virtual SCIP_DECL_CONSLOCK(scip_lock) = 0;
virtual SCIP_DECL_CONSACTIVE(scip_active)
{
return SCIP_OKAY;
}
virtual SCIP_DECL_CONSDEACTIVE(scip_deactive)
{
return SCIP_OKAY;
}
virtual SCIP_DECL_CONSENABLE(scip_enable)
{
return SCIP_OKAY;
}
virtual SCIP_DECL_CONSDISABLE(scip_disable)
{
return SCIP_OKAY;
}
virtual SCIP_DECL_CONSDELVARS(scip_delvars)
{
return SCIP_OKAY;
}
virtual SCIP_DECL_CONSPRINT(scip_print)
{
if ( file == NULL )
fprintf(stdout, "constraint handler <%s> does not support printing constraints\n", SCIPconshdlrGetName(conshdlr));
else
fprintf(file, "constraint handler <%s> does not support printing constraints\n", SCIPconshdlrGetName(conshdlr));
return SCIP_OKAY;
}
virtual SCIP_DECL_CONSCOPY(scip_copy)
{
*valid = FALSE;
return SCIP_OKAY;
}
virtual SCIP_DECL_CONSPARSE(scip_parse)
{
return SCIP_OKAY;
}
virtual SCIP_DECL_CONSGETVARS(scip_getvars)
{
(*success) = FALSE;
return SCIP_OKAY;
}
virtual SCIP_DECL_CONSGETNVARS(scip_getnvars)
{
(*nvars) = 0;
(*success) = FALSE;
return SCIP_OKAY;
}
virtual SCIP_DECL_CONSGETDIVEBDCHGS(scip_getdivebdchgs)
{
(*success) = FALSE;
return SCIP_OKAY;
}
};
}
SCIP_EXPORT
SCIP_RETCODE SCIPincludeObjConshdlr(
SCIP* scip,
scip::ObjConshdlr* objconshdlr,
SCIP_Bool deleteobject
);
SCIP_EXPORT
scip::ObjConshdlr* SCIPfindObjConshdlr(
SCIP* scip,
const char* name
);
SCIP_EXPORT
scip::ObjConshdlr* SCIPgetObjConshdlr(
SCIP* scip,
SCIP_CONSHDLR* conshdlr
);
#endif