0

I use the Scip solver from the Java api, via the Jni interface.

I want to dump my lp model into a file.

For this, there is the following c method in the native API

extern SCIP_RETCODE SCIPprintOrigProblem(
SCIP* scip, /**< SCIP data structure */
FILE* file, /**< output file (or NULL for standard output) */
const char* extension, /**< file format (or NULL for default CIP format)*/
SCIP_Bool genericnames /**< using generic variable and constraint names? */
);

This method corresponds to the following java method in the public abstract interface de.zib.jscip.nativ.NativeScip

public abstract void printOrigProblem(long arg0, long arg1, java.lang.String arg2, boolean arg3) throws de.zib.jscip.nativ.NativeScipException;

Method works fine when I give a zero value for the second argument: the linear formulation is returned in the standard output, as expected.

Now I want to specify the file where the linear formulation is dumped.

So I want to pass a reference in the second parameter of the method.

The native methode expects a FILE*, while the java method expects a long.

Question is what must I pass as value for this second parameter?

1 Answers1

1

I guess you should use the function writeOrigProblem which corresponds to SCIPwriteOrigProblem.

mueldgog
  • 383
  • 1
  • 7
  • Using writeOrigProblem works indeed around the problem. So my problem is solved. Still I am wondering if it is possible to pass a FILE through the jni interface. – Michel Schaffers May 18 '16 at 15:41
  • It should be possible but you might need to extend the interface since there is no SCIP function which receives a string and returns an FILE*. – mueldgog May 18 '16 at 17:31