CONOPT
Loading...
Searching...
No Matches
std.java
Go to the documentation of this file.
1import java.util.*;
2import java.io.IOException;
3import java.io.FileWriter;
4import java.lang.Math;
5
6public class std {
7 public std() {
8 }
9
10 public static void java_log(final String name, final String message) {
11 try {
12 FileWriter logfile = new FileWriter(name + ".rc");
13 logfile.write(name + ": " + message + System.lineSeparator());
14 logfile.close();
15 } catch (IOException e) {
16 System.err.println("An error occurred: " + e.getMessage());
17 }
18 }
19
20 public static int checkSolve(String name, int model_status, int solution_status,
21 double objective, double expected_objective, double tol) {
22 if (model_status != 2 || solution_status != 1) {
23 java_log(name, "Incorrect Model or Solver Status");
24 return -1;
25 }
26 else if (Math.abs(objective - expected_objective) > tol) {
27 java_log(name, "Incorrect objective returned");
28 return -1;
29 }
30
31 java_log(name, "Successful Solve");
32
33 return 0;
34 }
35}
static int checkSolve(String name, int model_status, int solution_status, double objective, double expected_objective, double tol)
Definition std.java:20
std()
Definition std.java:7
static void java_log(final String name, final String message)
Definition std.java:10
Definition std.py:1