本文整理汇总了C++中JNISCIP_CALL函数的典型用法代码示例。如果您正苦于以下问题:C++ JNISCIP_CALL函数的具体用法?C++ JNISCIP_CALL怎么用?C++ JNISCIP_CALL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了JNISCIP_CALL函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: JNISCIPCONSLINEAR
/** creates and captures a linear constraint
* in its most basic version, i. e., all constraint flags are set to their basic value as explained for the
* method SCIPcreateConsLinear(); all flags can be set via SCIPsetConsFLAGNAME-methods in scip.h
*
* @see SCIPcreateConsLinear() for information about the basic constraint flag configuration
*
* @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
*/
JNIEXPORT
jlong JNISCIPCONSLINEAR(createConsBasicLinear)(
JNIEnv* env, /**< JNI environment variable */
jobject jobj, /**< JNI class pointer */
jlong jscip, /**< SCIP data structure */
jstring jname, /**< name of constraint */
jint jnvars, /**< number of nonzeros in the constraint */
jlongArray jvars, /**< array with variables of constraint entries */
jdoubleArray jvals, /**< array with coefficients of constraint entries */
jdouble jlhs, /**< left hand side of constraint */
jdouble jrhs /**< right hand side of constraint */
)
{
SCIP* scip;
SCIP_CONS* cons;
const char* name;
int nvars;
/* convert JNI pointer into C pointer */
scip = (SCIP*) (size_t) jscip;
assert(scip != NULL);
/* convert JNI string into C const char* */
name = (*env)->GetStringUTFChars(env, jname, NULL);
if( name == NULL )
SCIPABORT();
/* create linear constraint with zero variables */
JNISCIP_CALL( SCIPcreateConsBasicLinear(scip, &cons, name, 0, NULL, NULL, (SCIP_Real) jlhs, (SCIP_Real) jrhs) );
/* convert JNI integer into integer */
nvars = (int)jnvars;
if( nvars > 0 )
{
jlong* vars;
jdouble* vals;
int v;
JNISCIP_CALL( SCIPallocBufferArray(scip, &vars, nvars) );
JNISCIP_CALL( SCIPallocBufferArray(scip, &vals, nvars) );
(*env)->GetLongArrayRegion(env, jvars, 0, nvars, vars);
(*env)->GetDoubleArrayRegion(env, jvals, 0, nvars, vals);
for( v = 0; v < nvars; ++v )
{
JNISCIP_CALL( SCIPaddCoefLinear(scip, cons, (SCIP_VAR*)(size_t)vars[v], (SCIP_Real)vals[v]));
}
SCIPfreeBufferArray(scip, &vals);
SCIPfreeBufferArray(scip, &vars);
}
/* relase string object */
(*env)->ReleaseStringUTFChars(env, jname, name);
return (jlong)(size_t)cons;
}
示例2: JNISCIPREADERPIP
/** writes problem to file */
JNIEXPORT
jint JNISCIPREADERPIP(writePip)(
JNIEnv* env, /**< JNI environment variable */
jobject jobj, /**< JNI class pointer */
jlong jscip, /**< SCIP data structure */
jlong jfile, /**< output file, or NULL if standard output should be used */
jstring jname, /**< problem name */
jboolean jtransformed, /**< TRUE iff problem is the transformed problem */
jint jobjsense, /**< objective sense */
jdouble jobjscale, /**< scalar applied to objective function; external objective value is
* extobj = objsense * objscale * (intobj + objoffset) */
jdouble jobjoffset, /**< objective offset from bound shifting and fixing */
jlongArray jvars, /**< array with active variables ordered binary, integer, implicit, continuous */
jint jnvars, /**< number of mutable variables in the problem */
jint jnbinvars, /**< number of binary variables */
jint jnintvars, /**< number of general integer variables */
jint jnimplvars, /**< number of implicit integer variables */
jint jncontvars, /**< number of continuous variables */
jlongArray jconss, /**< array with constraints of the problem */
jint jnconss /**< number of constraints in the problem */
)
{
SCIP* scip;
const char* name;
SCIP_VAR** vars;
SCIP_CONS** conss;
SCIP_RESULT result;
jboolean iscopy;
/* convert JNI pointer into C pointer */
scip = (SCIP*) (size_t) jscip;
assert(scip != NULL);
JNISCIP_CALL( SCIPallocBufferArray(scip, &vars, (int)jnvars) );
JNISCIP_CALL( SCIPallocBufferArray(scip, &conss, (int)jnconss) );
(*env)->GetLongArrayRegion(env, jvars, 0, jnvars, (jlong*)(*vars));
(*env)->GetLongArrayRegion(env, jconss, 0, jnconss, (jlong*)(*conss));
/* convert JNI string into C const char* */
name = (*env)->GetStringUTFChars(env, jname, &iscopy);
if( name == NULL )
SCIPABORT();
assert(iscopy);
JNISCIP_CALL( SCIPwritePip(scip, (FILE*)(size_t) jfile, name, (SCIP_Bool)jtransformed, (SCIP_OBJSENSE)jobjsense, (SCIP_Real)jobjscale, (SCIP_Real)jobjoffset, vars, (int)jnvars, (int)jnbinvars, (int)jnintvars, (jint)jnimplvars, (int)jncontvars, conss, (int)jnconss, &result) );
SCIPfreeBufferArray(scip, &vars);
SCIPfreeBufferArray(scip, &conss);
(*env)->ReleaseStringUTFChars(env, jname, name);
return (jint) result;
}
示例3: JNISCIPCUTPOOL
/** gets array of cuts in the cut pool */
JNIEXPORT
jlongArray JNISCIPCUTPOOL(cutpoolGetCuts)(
JNIEnv* env, /**< JNI environment variable */
jobject jobj, /**< JNI class pointer */
jlong jcutpool /**< cut */
)
{
SCIP_CUTPOOL* cutpool;
jlongArray jcuts;
int size;
SCIP_CUT** cuts;
/* convert JNI pointer into C pointer */
cutpool = (SCIP_CUTPOOL*) (size_t) jcutpool;
assert(cutpool != NULL);
size = SCIPcutpoolGetNCuts(cutpool);
jcuts = (*env)->NewLongArray(env, size);
if (jcuts == NULL) {
SCIPerrorMessage("Out of Memory\n");
JNISCIP_CALL( SCIP_ERROR );
return 0;
}
cuts = SCIPcutpoolGetCuts(cutpool);
(*env)->SetLongArrayRegion(env, jcuts, 0, size, (jlong*)(*cuts));
return jcuts;
}
示例4: SCIP_DECL_EVENTINIT
/** initialization method of event handler (called after problem was transformed) */
static
SCIP_DECL_EVENTINIT(eventhdlrInitJava)
{ /*lint --e{715}*/
SCIP_EVENTHDLRDATA* eventhdlrdata;
JNIEnv* env;
jobject jobj;
jlong jscip;
jlong jeventhdlr;
eventhdlrdata = SCIPeventhdlrGetData(eventhdlr);
assert(eventhdlrdata != NULL);
assert(eventhdlrdata->javaeventhdlr != NULL);
assert(eventhdlrdata->scip_init != NULL);
jscip = (jlong) (size_t) scip;
jeventhdlr = (jlong) (size_t) eventhdlr;
env = eventhdlrdata->env;
jobj = eventhdlrdata->jobj;
/* call virtual method of eventhdlr object */
JNISCIP_CALL( (*env)->CallIntMethod(env, jobj, eventhdlrdata->scip_init, jscip, jeventhdlr) );
return SCIP_OKAY;
}
示例5: JNISCIPCONSINDICATOR
/** adds additional globally valid row that is not connected by an indicator constraint, but can be used for separation */
JNIEXPORT
void JNISCIPCONSINDICATOR(addRowIndicator)(
JNIEnv* env, /**< JNI environment variable */
jobject jobj, /**< JNI class pointer */
jlong jscip, /**< SCIP data structure */
jlong jconshdlr, /**< indicator constraint handler */
jlong jrow /**< row to add */
)
{
SCIP* scip;
SCIP_CONSHDLR* conshdlr;
SCIP_ROW* row;
/* convert JNI pointer into C pointer */
scip = (SCIP*) (size_t) jscip;
assert(scip != NULL);
conshdlr = (SCIP_CONSHDLR*) (size_t) jconshdlr;
assert(conshdlr != NULL);
row = (SCIP_ROW*) (size_t) jrow;
assert(row != NULL);
JNISCIP_CALL( SCIPaddRowIndicator(scip, conshdlr, row) );
}
示例6: JNISCIPCONSQUADRATIC
/** Adds the constraint to an NLPI problem. */
JNIEXPORT
void JNISCIPCONSQUADRATIC(addToNlpiProblemQuadratic)(
JNIEnv* env, /**< JNI environment variable */
jobject jobj, /**< JNI class pointer */
jlong jscip, /**< SCIP data structure */
jlong jcons, /**< constraint */
jlong jnlpi, /**< interface to NLP solver */
jlong jnlpiprob, /**< NLPI problem where to add constraint */
jlong jscipvar2nlpivar, /**< mapping from SCIP variables to variable indices in NLPI */
jboolean jnames /**< whether to pass constraint names to NLPI */
)
{
SCIP* scip;
SCIP_CONS* cons;
SCIP_NLPI* nlpi;
SCIP_NLPIPROBLEM* nlpiprob;
SCIP_HASHMAP* scipvar2nlpivar;
/* convert JNI pointer into C pointer */
scip = (SCIP*) (size_t) jscip;
cons = (SCIP_CONS*) (size_t) jcons;
nlpi = (SCIP_NLPI*) (size_t) jnlpi;
nlpiprob = (SCIP_NLPIPROBLEM*) (size_t) jnlpiprob;
scipvar2nlpivar = (SCIP_HASHMAP*) (size_t) jscipvar2nlpivar;
assert(scip != NULL);
assert(cons != NULL);
assert(nlpi != NULL);
assert(nlpiprob != NULL);
assert(scipvar2nlpivar != NULL);
JNISCIP_CALL( SCIPaddToNlpiProblemQuadratic(scip, cons, nlpi, nlpiprob, scipvar2nlpivar, (SCIP_Bool)jnames) );
}
示例7: JNISCIPREADERCCG
/** writes problem to file */
JNIEXPORT
jint JNISCIPREADERCCG(writeCcg)(
JNIEnv* env, /**< JNI environment variable */
jobject jobj, /**< JNI class pointer */
jlong jscip, /**< SCIP data structure */
jlong jfile, /**< output file, or NULL if standard output should be used */
jstring jname, /**< problem name */
jboolean jtransformed, /**< TRUE iff problem is the transformed problem */
jlongArray jvars, /**< array with active variables ordered binary, integer, implicit, continuous */
jint jnvars, /**< number of mutable variables in the problem */
jlongArray jconss, /**< array with constraints of the problem */
jint jnconss /**< number of constraints in the problem */
)
{
SCIP* scip;
const char* name;
SCIP_VAR** vars;
SCIP_CONS** conss;
SCIP_RESULT result;
jboolean iscopy;
/* convert JNI pointer into C pointer */
scip = (SCIP*) (size_t) jscip;
assert(scip != NULL);
JNISCIP_CALL( SCIPallocBufferArray(scip, &vars, (int)jnvars) );
JNISCIP_CALL( SCIPallocBufferArray(scip, &conss, (int)jnconss) );
(*env)->GetLongArrayRegion(env, jvars, 0, jnvars, (jlong*)(*vars));
(*env)->GetLongArrayRegion(env, jconss, 0, jnconss, (jlong*)(*conss));
/* convert JNI string into C const char* */
name = (*env)->GetStringUTFChars(env, jname, &iscopy);
if( name == NULL )
SCIPABORT();
assert(iscopy);
JNISCIP_CALL( SCIPwriteCcg(scip, (FILE*)(size_t)jfile, name, (SCIP_Bool)jtransformed, vars, (int)jnvars, conss, (int)jnconss, &result) );
SCIPfreeBufferArray(scip, &vars);
SCIPfreeBufferArray(scip, &conss);
(*env)->ReleaseStringUTFChars(env, jname, name);
return (jint) result;
}
示例8: JNISCIPHEURZEROOBJ
/** main procedure of the zeroobj heuristic, creates and solves a sub-SCIP */
JNIEXPORT
void JNISCIPHEURZEROOBJ(applyZeroobj)(
JNIEnv* env, /**< JNI environment variable */
jobject jobj, /**< JNI class pointer */
jlong jscip, /**< SCIP data structure */
jlong jheur, /**< heuristic data structure */
jintArray jresult, /**< result data structure */
jdouble jminimprove, /**< factor by which zeroobj should at least improve the incumben */
jlong jnnodes /**< node limit for the subproblem */
)
{
SCIPerrorMessage("method applyZeroobj is not implemented yet (deprecated)\n");
JNISCIP_CALL( SCIP_ERROR );
}
示例9: JNISCIPHEURVECLENDIVING
/** creates the veclendiving heuristic and includes it in SCIP */
JNIEXPORT
void JNISCIPHEURVECLENDIVING(includeHeurVeclendiving)(
JNIEnv* env, /**< JNI environment variable */
jobject jobj, /**< JNI class pointer */
jlong jscip /**< SCIP data structure */
)
{
SCIP* scip;
/* convert JNI pointer into C pointer */
scip = (SCIP*) (size_t) jscip;
assert(scip != NULL);
JNISCIP_CALL( SCIPincludeHeurVeclendiving(scip) );
}
示例10: JNISCIPSEPAGOMORY
/** creates the Gomory MIR cut separator and includes it in SCIP */
JNIEXPORT
void JNISCIPSEPAGOMORY(includeSepaGomory)(
JNIEnv* env, /**< JNI environment variable */
jobject jobj, /**< JNI class pointer */
jlong jscip /**< SCIP data structure */
)
{
SCIP* scip;
/* convert JNI pointer into C pointer */
scip = (SCIP*) (size_t) jscip;
assert(scip != NULL);
JNISCIP_CALL( SCIPincludeSepaGomory(scip) );
}
示例11: JNISCIPPRESOLTRIVIAL
/** creates the trivial presolver and includes it in SCIP */
JNIEXPORT
void JNISCIPPRESOLTRIVIAL(includePresolTrivial)(
JNIEnv* env, /**< JNI environment variable */
jobject jobj, /**< JNI class pointer */
jlong jscip /**< SCIP data structure */
)
{
SCIP* scip;
/* convert JNI pointer into C pointer */
scip = (SCIP*) (size_t) jscip;
assert(scip != NULL);
JNISCIP_CALL( SCIPincludePresolTrivial(scip) );
}
示例12: JNISCIPDISPDEFAULT
/** gets user data of display column */
JNIEXPORT
void JNISCIPDISPDEFAULT(includeDispDefault)(
JNIEnv* env, /**< JNI environment variable */
jobject jobj, /**< JNI class pointer */
jlong jscip /**< display column */
)
{
SCIP* scip;
/* convert JNI pointer into C pointer */
scip = (SCIP*) (size_t) jscip;
assert(scip != NULL);
JNISCIP_CALL( SCIPincludeDispDefault(scip) );
}
示例13: JNISCIPNODESELRESTARTDFS
/** creates the node selector for restarting depth first search and includes it in SCIP */
JNIEXPORT
void JNISCIPNODESELRESTARTDFS(includeNodeselRestartdfs)(
JNIEnv* env, /**< JNI environment variable */
jobject jobj, /**< JNI class pointer */
jlong jscip /**< SCIP data structure */
)
{
SCIP* scip;
/* convert JNI pointer into C pointer */
scip = (SCIP*) (size_t) jscip;
assert(scip != NULL);
JNISCIP_CALL( SCIPincludeNodeselRestartdfs(scip) );
}
示例14: JNISCIPREADERZPL
/** includes the zpl file reader into SCIP */
JNIEXPORT
void JNISCIPREADERZPL(includeReaderZpl)(
JNIEnv* env, /**< JNI environment variable */
jobject jobj, /**< JNI class pointer */
jlong jscip /**< SCIP data structure */
)
{
SCIP* scip;
/* convert JNI pointer into C pointer */
scip = (SCIP*) (size_t) jscip;
assert(scip != NULL);
JNISCIP_CALL( SCIPincludeReaderZpl(scip) );
}
示例15: JNISCIPSEPARAPIDLEARNING
/** creates the rapidlearning separator and includes it in SCIP */
JNIEXPORT
void JNISCIPSEPARAPIDLEARNING(includeSepaRapidlearning)(
JNIEnv* env, /**< JNI environment variable */
jobject jobj, /**< JNI class pointer */
jlong jscip /**< SCIP data structure */
)
{
SCIP* scip;
/* convert JNI pointer into C pointer */
scip = (SCIP*) (size_t) jscip;
assert(scip != NULL);
JNISCIP_CALL( SCIPincludeSepaRapidlearning(scip) );
}