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
private
static
void
log(
final
String name,
final
String message)
throws
IOException {
11
FileWriter logfile =
new
FileWriter(name +
".rc"
);
12
logfile.write(name +
": "
+ message + System.lineSeparator());
13
logfile.close();
14
}
15
16
public
static
int
checkSolve
(String name,
int
model_status,
int
solution_status,
17
double
objective,
double
expected_objective,
double
tol) {
18
try
{
19
if
(model_status != 2 || solution_status != 1) {
20
log(name,
"Incorrect Model or Solver Status"
);
21
return
-1;
22
}
23
else
if
(Math.abs(objective - expected_objective) > tol) {
24
log(name,
"Incorrect objective returned"
);
25
return
-1;
26
}
27
28
log(name,
"Successful Solve"
);
29
}
catch
(IOException e) {
30
System.err.println(
"An error occurred: "
+ e.getMessage());
31
}
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:16
std.std
std()
Definition
std.java:7
std
Definition
std.py:1
examples
common
std.java
Generated by
1.13.2