Documentation
Download
Licensing
Contact
CONOPT
Loading...
Searching...
No Matches
std.java
Go to the documentation of this file.
1
import
java.util.*;
2
import
java.io.IOException;
3
import
java.io.FileWriter;
4
import
java.lang.Math;
5
6
public
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
}
std.checkSolve
static int checkSolve(String name, int model_status, int solution_status, double objective, double expected_objective, double tol)
Definition
std.java:20
std.std
std()
Definition
std.java:7
std.java_log
static void java_log(final String name, final String message)
Definition
std.java:10
std
Definition
std.py:1
examples
common
std.java
Generated by
1.13.2