com.google.ortools.sat.SatHelper Maven / Gradle / Ivy
The newest version!
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.12
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.google.ortools.sat;
import com.google.ortools.util.Domain;
public class SatHelper {
private transient long swigCPtr;
protected transient boolean swigCMemOwn;
/*PTRCTOR_VISIBILITY=*/public SatHelper(long cPtr, boolean cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = cPtr;
}
/*CPTR_VISIBILITY=*/protected static long getCPtr(SatHelper obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
protected void finalize() {
delete();
}
public synchronized void delete() {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
mainJNI.delete_SatHelper(swigCPtr);
}
swigCPtr = 0;
}
}
public static com.google.ortools.sat.CpSolverResponse solve(com.google.ortools.sat.CpModelProto model_proto) {
byte[] buf = mainJNI.SatHelper_solve(model_proto.toByteArray());
if (buf == null || buf.length == 0) {
return null;
}
try {
return com.google.ortools.sat.CpSolverResponse.parseFrom(buf);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw new RuntimeException(
"Unable to parse com.google.ortools.sat.CpSolverResponse protocol message.");
}
}
public static com.google.ortools.sat.CpSolverResponse solveWithParameters(com.google.ortools.sat.CpModelProto model_proto, com.google.ortools.sat.SatParameters parameters) {
byte[] buf = mainJNI.SatHelper_solveWithParameters(model_proto.toByteArray(), parameters.toByteArray());
if (buf == null || buf.length == 0) {
return null;
}
try {
return com.google.ortools.sat.CpSolverResponse.parseFrom(buf);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw new RuntimeException(
"Unable to parse com.google.ortools.sat.CpSolverResponse protocol message.");
}
}
public static com.google.ortools.sat.CpSolverResponse solveWithParametersAndSolutionCallback(com.google.ortools.sat.CpModelProto model_proto, com.google.ortools.sat.SatParameters parameters, SolutionCallback callback) {
byte[] buf = mainJNI.SatHelper_solveWithParametersAndSolutionCallback(model_proto.toByteArray(), parameters.toByteArray(), SolutionCallback.getCPtr(callback), callback);
if (buf == null || buf.length == 0) {
return null;
}
try {
return com.google.ortools.sat.CpSolverResponse.parseFrom(buf);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw new RuntimeException(
"Unable to parse com.google.ortools.sat.CpSolverResponse protocol message.");
}
}
public static String modelStats(com.google.ortools.sat.CpModelProto model_proto) {
return mainJNI.SatHelper_modelStats(model_proto.toByteArray());
}
public static String solverResponseStats(com.google.ortools.sat.CpSolverResponse response) {
return mainJNI.SatHelper_solverResponseStats(response.toByteArray());
}
public static String validateModel(com.google.ortools.sat.CpModelProto model_proto) {
return mainJNI.SatHelper_validateModel(model_proto.toByteArray());
}
public static Domain variableDomain(com.google.ortools.sat.IntegerVariableProto variable_proto) {
return new Domain(mainJNI.SatHelper_variableDomain(variable_proto.toByteArray()), true);
}
public SatHelper() {
this(mainJNI.new_SatHelper(), true);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy