mostly reindent of examples

This commit is contained in:
Laurent Perron
2019-05-06 10:31:03 +02:00
parent 9b8a26beee
commit cd6bf20fe5
10 changed files with 77 additions and 91 deletions

View File

@@ -12,12 +12,15 @@
// limitations under the License.
import com.google.ortools.linearsolver.MPConstraint;
import com.google.ortools.linearsolver.MPModelExportOptions;
import com.google.ortools.linearsolver.MPObjective;
import com.google.ortools.linearsolver.MPSolver;
import com.google.ortools.linearsolver.MPVariable;
/** Linear programming example that shows how to use the API. */
/**
* Linear programming example that shows how to use the API.
*
*/
public class LinearProgramming {
static {
System.loadLibrary("jniortools");
@@ -73,8 +76,7 @@ public class LinearProgramming {
System.out.println("Number of constraints = " + solver.numConstraints());
if (printModel) {
MPModelExportOptions options = new MPModelExportOptions();
String model = solver.exportModelAsLpFormat(options);
String model = solver.exportModelAsLpFormat();
System.out.println(model);
}
@@ -88,10 +90,9 @@ public class LinearProgramming {
// Verify that the solution satisfies all constraints (when using solvers
// others than GLOP_LINEAR_PROGRAMMING, this is highly recommended!).
if (!solver.verifySolution(/*tolerance=*/ 1e-7, /*logErrors=*/ true)) {
System.err.println(
"The solution returned by the solver violated the"
+ " problem constraints by at least 1e-7");
if (!solver.verifySolution(/*tolerance=*/1e-7, /* log_errors= */ true)) {
System.err.println("The solution returned by the solver violated the"
+ " problem constraints by at least 1e-7");
return;
}