Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ set(SWIG_JAVA_SOURCES
${PROJECT_SOURCE_DIR}/java/jscip/SCIP_Retcode.java
${PROJECT_SOURCE_DIR}/java/jscip/SCIP_Vartype.java
${PROJECT_SOURCE_DIR}/java/jscip/SCIP_BoundType.java
${PROJECT_SOURCE_DIR}/java/jscip/SCIP_ParamSetting.java
${PROJECT_SOURCE_DIR}/java/jscip/SCIP_ParamEmphasis.java
${PROJECT_SOURCE_DIR}/java/jscip/SCIP_Objsense.java
${PROJECT_SOURCE_DIR}/java/jscip/SCIP_OrbitopeType.java
Expand Down
20 changes: 20 additions & 0 deletions java/jscip/SCIPJNI.java
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,14 @@ public static SCIP_Retcode SCIPsetStringParam(SWIGTYPE_p_SCIP scip, String name,
return SCIP_Retcode.swigToEnum(SCIPJNIJNI.SCIPsetStringParam(SWIGTYPE_p_SCIP.getCPtr(scip), name, value));
}

public static SCIP_Retcode SCIPsetPresolving(SWIGTYPE_p_SCIP scip, SCIP_ParamSetting paramsetting, long quiet) {
return SCIP_Retcode.swigToEnum(SCIPJNIJNI.SCIPsetPresolving(SWIGTYPE_p_SCIP.getCPtr(scip), paramsetting.swigValue(), quiet));
}

public static SCIP_Retcode SCIPsetHeuristics(SWIGTYPE_p_SCIP scip, SCIP_ParamSetting paramsetting, long quiet) {
return SCIP_Retcode.swigToEnum(SCIPJNIJNI.SCIPsetHeuristics(SWIGTYPE_p_SCIP.getCPtr(scip), paramsetting.swigValue(), quiet));
}

public static SCIP_Retcode SCIPsetEmphasis(SWIGTYPE_p_SCIP scip, SCIP_ParamEmphasis paramemphasis, long quiet) {
return SCIP_Retcode.swigToEnum(SCIPJNIJNI.SCIPsetEmphasis(SWIGTYPE_p_SCIP.getCPtr(scip), paramemphasis.swigValue(), quiet));
}
Expand Down Expand Up @@ -502,6 +510,18 @@ public static String SCIPconsGetName(SWIGTYPE_p_SCIP_CONS cons) {
return SCIPJNIJNI.SCIPconsGetName(SWIGTYPE_p_SCIP_CONS.getCPtr(cons));
}

public static SCIP_Retcode SCIPgetDualSolVal(SWIGTYPE_p_SCIP scip, SWIGTYPE_p_SCIP_CONS cons, SWIGTYPE_p_double dualsolval, SWIGTYPE_p_unsigned_int boundconstraint) {
return SCIP_Retcode.swigToEnum(SCIPJNIJNI.SCIPgetDualSolVal(SWIGTYPE_p_SCIP.getCPtr(scip), SWIGTYPE_p_SCIP_CONS.getCPtr(cons), SWIGTYPE_p_double.getCPtr(dualsolval), SWIGTYPE_p_unsigned_int.getCPtr(boundconstraint)));
}

public static double SCIPgetDualsolLinear(SWIGTYPE_p_SCIP scip, SWIGTYPE_p_SCIP_CONS cons) {
return SCIPJNIJNI.SCIPgetDualsolLinear(SWIGTYPE_p_SCIP.getCPtr(scip), SWIGTYPE_p_SCIP_CONS.getCPtr(cons));
}

public static double SCIPgetDualfarkasLinear(SWIGTYPE_p_SCIP scip, SWIGTYPE_p_SCIP_CONS cons) {
return SCIPJNIJNI.SCIPgetDualfarkasLinear(SWIGTYPE_p_SCIP.getCPtr(scip), SWIGTYPE_p_SCIP_CONS.getCPtr(cons));
}

public static ObjMessagehdlr SCIPgetObjMessagehdlr(SWIGTYPE_p_SCIP_Messagehdlr messagehdlr) {
long cPtr = SCIPJNIJNI.SCIPgetObjMessagehdlr(SWIGTYPE_p_SCIP_Messagehdlr.getCPtr(messagehdlr));
return (cPtr == 0) ? null : new ObjMessagehdlr(cPtr, false);
Expand Down
9 changes: 9 additions & 0 deletions java/jscip/SCIPJNIJNI.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ public class SCIPJNIJNI {
public final static native int SCIP_ORBITOPETYPE_FULL_get();
public final static native int SCIP_ORBITOPETYPE_PARTITIONING_get();
public final static native int SCIP_ORBITOPETYPE_PACKING_get();
public final static native int SCIP_PARAMSETTING_DEFAULT_get();
public final static native int SCIP_PARAMSETTING_AGGRESSIVE_get();
public final static native int SCIP_PARAMSETTING_FAST_get();
public final static native int SCIP_PARAMSETTING_OFF_get();
public final static native int SCIP_PARAMEMPHASIS_DEFAULT_get();
public final static native int SCIP_PARAMEMPHASIS_CPSOLVER_get();
public final static native int SCIP_PARAMEMPHASIS_EASYCIP_get();
Expand Down Expand Up @@ -176,6 +180,8 @@ public class SCIPJNIJNI {
public final static native int SCIPsetRealParam(long jarg1, String jarg2, double jarg3);
public final static native int SCIPsetCharParam(long jarg1, String jarg2, char jarg3);
public final static native int SCIPsetStringParam(long jarg1, String jarg2, String jarg3);
public final static native int SCIPsetPresolving(long jarg1, int jarg2, long jarg3);
public final static native int SCIPsetHeuristics(long jarg1, int jarg2, long jarg3);
public final static native int SCIPsetEmphasis(long jarg1, int jarg2, long jarg3);
public final static native int SCIPsetObjsense(long jarg1, int jarg2);
public final static native int SCIPgetObjsense(long jarg1);
Expand Down Expand Up @@ -203,6 +209,9 @@ public class SCIPJNIJNI {
public final static native int SCIPsolGetDepth(long jarg1);
public final static native int SCIPsolGetIndex(long jarg1);
public final static native String SCIPconsGetName(long jarg1);
public final static native int SCIPgetDualSolVal(long jarg1, long jarg2, long jarg3, long jarg4);
public final static native double SCIPgetDualsolLinear(long jarg1, long jarg2);
public final static native double SCIPgetDualfarkasLinear(long jarg1, long jarg2);
public final static native long ObjMessagehdlr_scip_bufferedoutput__get(long jarg1, ObjMessagehdlr jarg1_);
public final static native long new_ObjMessagehdlr(long jarg1);
public final static native void delete_ObjMessagehdlr(long jarg1);
Expand Down
56 changes: 56 additions & 0 deletions java/jscip/SCIP_ParamSetting.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (https://www.swig.org).
* Version 4.2.0
*
* Do not make changes to this file unless you know what you are doing - modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */

package jscip;

public final class SCIP_ParamSetting {
public final static SCIP_ParamSetting SCIP_PARAMSETTING_DEFAULT = new SCIP_ParamSetting("SCIP_PARAMSETTING_DEFAULT", SCIPJNIJNI.SCIP_PARAMSETTING_DEFAULT_get());
public final static SCIP_ParamSetting SCIP_PARAMSETTING_AGGRESSIVE = new SCIP_ParamSetting("SCIP_PARAMSETTING_AGGRESSIVE", SCIPJNIJNI.SCIP_PARAMSETTING_AGGRESSIVE_get());
public final static SCIP_ParamSetting SCIP_PARAMSETTING_FAST = new SCIP_ParamSetting("SCIP_PARAMSETTING_FAST", SCIPJNIJNI.SCIP_PARAMSETTING_FAST_get());
public final static SCIP_ParamSetting SCIP_PARAMSETTING_OFF = new SCIP_ParamSetting("SCIP_PARAMSETTING_OFF", SCIPJNIJNI.SCIP_PARAMSETTING_OFF_get());

public final int swigValue() {
return swigValue;
}

public String toString() {
return swigName;
}

public static SCIP_ParamSetting swigToEnum(int swigValue) {
if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
return swigValues[swigValue];
for (int i = 0; i < swigValues.length; i++)
if (swigValues[i].swigValue == swigValue)
return swigValues[i];
throw new IllegalArgumentException("No enum " + SCIP_ParamSetting.class + " with value " + swigValue);
}

private SCIP_ParamSetting(String swigName) {
this.swigName = swigName;
this.swigValue = swigNext++;
}

private SCIP_ParamSetting(String swigName, int swigValue) {
this.swigName = swigName;
this.swigValue = swigValue;
swigNext = swigValue+1;
}

private SCIP_ParamSetting(String swigName, SCIP_ParamSetting swigEnum) {
this.swigName = swigName;
this.swigValue = swigEnum.swigValue;
swigNext = this.swigValue+1;
}

private static SCIP_ParamSetting[] swigValues = { SCIP_PARAMSETTING_DEFAULT, SCIP_PARAMSETTING_AGGRESSIVE, SCIP_PARAMSETTING_FAST, SCIP_PARAMSETTING_OFF };
private static int swigNext = 0;
private final int swigValue;
private final String swigName;
}

36 changes: 36 additions & 0 deletions java/jscip/Scip.java
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,18 @@ public void setStringParam(String name, String value)
CHECK_RETCODE( SCIPJNI.SCIPsetStringParam(_scipptr, name, value) );
}

/** wraps SCIPsetPresolving() */
public void setPresolving(SCIP_ParamSetting paramSetting, boolean quite)
{
CHECK_RETCODE( SCIPJNI.SCIPsetPresolving(_scipptr, paramSetting, quite ? 1 : 0) );
}

/** wraps SCIPsetHeuristics() */
public void setHeuristics(SCIP_ParamSetting paramSetting, boolean quite)
{
CHECK_RETCODE( SCIPJNI.SCIPsetHeuristics(_scipptr, paramSetting, quite ? 1 : 0) );
}

/** wraps SCIPsetEmphasis() */
public void setEmphasis(SCIP_ParamEmphasis paramEmphasis, boolean quite)
{
Expand Down Expand Up @@ -1492,6 +1504,30 @@ public double getSolOrigObj(Solution sol)
return SCIPJNI.SCIPgetSolOrigObj(_scipptr, sol.getPtr());
}

/** wraps SCIPconsGetDualsol() */
public double getDual(Constraint cons)
{
SWIGTYPE_p_double value = SCIPJNI.new_double_array(1);
SWIGTYPE_p_unsigned_int bounded = SCIPJNI.new_unsigned_int_array(1);
CHECK_RETCODE( SCIPJNI.SCIPgetDualSolVal(_scipptr, cons.getPtr(), value, bounded) );
double ret = SCIPJNI.double_array_getitem(value, 0);
SCIPJNI.delete_double_array(value);
SCIPJNI.delete_unsigned_int_array(bounded);
return ret;
}

/** wraps SCIPgetDualsolLinear() */
public double getDualLinear(Constraint cons)
{
return SCIPJNI.SCIPgetDualsolLinear(_scipptr, cons.getPtr());
}

/** wraps SCIPgetDualfarkasLinear() */
public double getDualFarkasLinear(Constraint cons)
{
return SCIPJNI.SCIPgetDualfarkasLinear(_scipptr, cons.getPtr());
}

/** wraps SCIPinfinity() */
public double infinity()
{
Expand Down
17 changes: 16 additions & 1 deletion src/scipjni.i
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,16 @@ enum SCIP_OrbitopeType
};
typedef enum SCIP_OrbitopeType SCIP_ORBITOPETYPE;

/* SCIP ParamSetting enum */
enum SCIP_ParamSetting
{
SCIP_PARAMSETTING_DEFAULT = 0, /**< use default values */
SCIP_PARAMSETTING_AGGRESSIVE = 1, /**< set to aggressive settings */
SCIP_PARAMSETTING_FAST = 2, /**< set to fast settings */
SCIP_PARAMSETTING_OFF = 3 /**< turn off */
};
typedef enum SCIP_ParamSetting SCIP_PARAMSETTING;

/* SCIP ParamEmphasis enum */
enum SCIP_ParamEmphasis
{
Expand Down Expand Up @@ -692,7 +702,7 @@ typedef enum SCIP_Stage SCIP_STAGE;
/* from pub_misc.h */
SCIP_Real SCIPcalcMachineEpsilon();

/* from scip.h*/
/* from scip.h */
SCIP_RETCODE SCIPcreate(SCIP** scip);
SCIP_RETCODE SCIPreadProb(SCIP* scip, const char* filename, const char* extension);
SCIP_RETCODE SCIPreadParams(SCIP* scip, const char* filename);
Expand Down Expand Up @@ -738,6 +748,8 @@ SCIP_RETCODE SCIPsetLongintParam(SCIP* scip, const char* name, SCIP_Longint va
SCIP_RETCODE SCIPsetRealParam(SCIP* scip, const char* name, SCIP_Real value);
SCIP_RETCODE SCIPsetCharParam(SCIP* scip, const char* name, char value);
SCIP_RETCODE SCIPsetStringParam(SCIP* scip, const char* name, const char* value);
SCIP_RETCODE SCIPsetPresolving(SCIP* scip, SCIP_PARAMSETTING paramsetting, SCIP_Bool quiet);
SCIP_RETCODE SCIPsetHeuristics(SCIP* scip, SCIP_PARAMSETTING paramsetting, SCIP_Bool quiet);
SCIP_RETCODE SCIPsetEmphasis(SCIP* scip, SCIP_PARAMEMPHASIS paramemphasis, SCIP_Bool quiet);
SCIP_RETCODE SCIPsetObjsense(SCIP* scip, SCIP_OBJSENSE objsense);
SCIP_OBJSENSE SCIPgetObjsense(SCIP* scip);
Expand Down Expand Up @@ -781,6 +793,9 @@ int SCIPsolGetIndex(SCIP_SOL* sol);

/* from pub_cons.h */
const char* SCIPconsGetName(SCIP_CONS* cons);
SCIP_RETCODE SCIPgetDualSolVal(SCIP* scip, SCIP_CONS* cons, SCIP_Real* dualsolval, SCIP_Bool* boundconstraint);
SCIP_Real SCIPgetDualsolLinear(SCIP* scip, SCIP_CONS* cons);
SCIP_Real SCIPgetDualfarkasLinear(SCIP* scip, SCIP_CONS* cons);

/* from type_message.h */
typedef struct SCIP_Messagehdlr SCIP_MESSAGEHDLR;
Expand Down
136 changes: 136 additions & 0 deletions src/scipjni_wrap.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -2696,6 +2696,54 @@ SWIGEXPORT jint JNICALL Java_jscip_SCIPJNIJNI_SCIP_1ORBITOPETYPE_1PACKING_1get(J
}


SWIGEXPORT jint JNICALL Java_jscip_SCIPJNIJNI_SCIP_1PARAMSETTING_1DEFAULT_1get(JNIEnv *jenv, jclass jcls) {
jint jresult = 0 ;
SCIP_ParamSetting result;

(void)jenv;
(void)jcls;
result = (SCIP_ParamSetting)SCIP_PARAMSETTING_DEFAULT;
jresult = (jint)result;
return jresult;
}


SWIGEXPORT jint JNICALL Java_jscip_SCIPJNIJNI_SCIP_1PARAMSETTING_1AGGRESSIVE_1get(JNIEnv *jenv, jclass jcls) {
jint jresult = 0 ;
SCIP_ParamSetting result;

(void)jenv;
(void)jcls;
result = (SCIP_ParamSetting)SCIP_PARAMSETTING_AGGRESSIVE;
jresult = (jint)result;
return jresult;
}


SWIGEXPORT jint JNICALL Java_jscip_SCIPJNIJNI_SCIP_1PARAMSETTING_1FAST_1get(JNIEnv *jenv, jclass jcls) {
jint jresult = 0 ;
SCIP_ParamSetting result;

(void)jenv;
(void)jcls;
result = (SCIP_ParamSetting)SCIP_PARAMSETTING_FAST;
jresult = (jint)result;
return jresult;
}


SWIGEXPORT jint JNICALL Java_jscip_SCIPJNIJNI_SCIP_1PARAMSETTING_1OFF_1get(JNIEnv *jenv, jclass jcls) {
jint jresult = 0 ;
SCIP_ParamSetting result;

(void)jenv;
(void)jcls;
result = (SCIP_ParamSetting)SCIP_PARAMSETTING_OFF;
jresult = (jint)result;
return jresult;
}


SWIGEXPORT jint JNICALL Java_jscip_SCIPJNIJNI_SCIP_1PARAMEMPHASIS_1DEFAULT_1get(JNIEnv *jenv, jclass jcls) {
jint jresult = 0 ;
SCIP_ParamEmphasis result;
Expand Down Expand Up @@ -4060,6 +4108,42 @@ SWIGEXPORT jint JNICALL Java_jscip_SCIPJNIJNI_SCIPsetStringParam(JNIEnv *jenv, j
}


SWIGEXPORT jint JNICALL Java_jscip_SCIPJNIJNI_SCIPsetPresolving(JNIEnv *jenv, jclass jcls, jlong jarg1, jint jarg2, jlong jarg3) {
jint jresult = 0 ;
SCIP *arg1 = (SCIP *) 0 ;
SCIP_PARAMSETTING arg2 ;
unsigned int arg3 ;
SCIP_RETCODE result;

(void)jenv;
(void)jcls;
arg1 = *(SCIP **)&jarg1;
arg2 = (SCIP_PARAMSETTING)jarg2;
arg3 = (unsigned int)jarg3;
result = (SCIP_RETCODE)SCIPsetPresolving(arg1,arg2,arg3);
jresult = (jint)result;
return jresult;
}


SWIGEXPORT jint JNICALL Java_jscip_SCIPJNIJNI_SCIPsetHeuristics(JNIEnv *jenv, jclass jcls, jlong jarg1, jint jarg2, jlong jarg3) {
jint jresult = 0 ;
SCIP *arg1 = (SCIP *) 0 ;
SCIP_PARAMSETTING arg2 ;
unsigned int arg3 ;
SCIP_RETCODE result;

(void)jenv;
(void)jcls;
arg1 = *(SCIP **)&jarg1;
arg2 = (SCIP_PARAMSETTING)jarg2;
arg3 = (unsigned int)jarg3;
result = (SCIP_RETCODE)SCIPsetHeuristics(arg1,arg2,arg3);
jresult = (jint)result;
return jresult;
}


SWIGEXPORT jint JNICALL Java_jscip_SCIPJNIJNI_SCIPsetEmphasis(JNIEnv *jenv, jclass jcls, jlong jarg1, jint jarg2, jlong jarg3) {
jint jresult = 0 ;
SCIP *arg1 = (SCIP *) 0 ;
Expand Down Expand Up @@ -4469,6 +4553,58 @@ SWIGEXPORT jstring JNICALL Java_jscip_SCIPJNIJNI_SCIPconsGetName(JNIEnv *jenv, j
}


SWIGEXPORT jint JNICALL Java_jscip_SCIPJNIJNI_SCIPgetDualSolVal(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2, jlong jarg3, jlong jarg4) {
jint jresult = 0 ;
SCIP *arg1 = (SCIP *) 0 ;
SCIP_CONS *arg2 = (SCIP_CONS *) 0 ;
double *arg3 = (double *) 0 ;
unsigned int *arg4 = (unsigned int *) 0 ;
SCIP_RETCODE result;

(void)jenv;
(void)jcls;
arg1 = *(SCIP **)&jarg1;
arg2 = *(SCIP_CONS **)&jarg2;
arg3 = *(double **)&jarg3;
arg4 = *(unsigned int **)&jarg4;
result = (SCIP_RETCODE)SCIPgetDualSolVal(arg1,arg2,arg3,arg4);
jresult = (jint)result;
return jresult;
}


SWIGEXPORT jdouble JNICALL Java_jscip_SCIPJNIJNI_SCIPgetDualsolLinear(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2) {
jdouble jresult = 0 ;
SCIP *arg1 = (SCIP *) 0 ;
SCIP_CONS *arg2 = (SCIP_CONS *) 0 ;
double result;

(void)jenv;
(void)jcls;
arg1 = *(SCIP **)&jarg1;
arg2 = *(SCIP_CONS **)&jarg2;
result = (double)SCIPgetDualsolLinear(arg1,arg2);
jresult = (jdouble)result;
return jresult;
}


SWIGEXPORT jdouble JNICALL Java_jscip_SCIPJNIJNI_SCIPgetDualfarkasLinear(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2) {
jdouble jresult = 0 ;
SCIP *arg1 = (SCIP *) 0 ;
SCIP_CONS *arg2 = (SCIP_CONS *) 0 ;
double result;

(void)jenv;
(void)jcls;
arg1 = *(SCIP **)&jarg1;
arg2 = *(SCIP_CONS **)&jarg2;
result = (double)SCIPgetDualfarkasLinear(arg1,arg2);
jresult = (jdouble)result;
return jresult;
}


SWIGEXPORT jlong JNICALL Java_jscip_SCIPJNIJNI_ObjMessagehdlr_1scip_1bufferedoutput_1_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
jlong jresult = 0 ;
scip::ObjMessagehdlr *arg1 = (scip::ObjMessagehdlr *) 0 ;
Expand Down