Package org.ssclab.pl.milp
Class JsonSolution
- java.lang.Object
-
- org.ssclab.pl.milp.JsonSolution
-
public class JsonSolution extends Object
This class represents the solution of a Linear Programming (LP) problem in JSON format. The generated JSON follows this structure:{ "meta": { // Information about the processing (duration, number of threads, etc.) }, "objectiveType": "min", "status": "optimal", "solution": { "objectiveValue": 1244.0, "variables": { // Variable values } }, "relaxedSolution": { "objectiveValue": 1244.0, "variables": { // Relaxed solution variable values } } }
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description jakarta.json.JsonObject
getJsonObject()
Returns the JSON object built using the jakarta.json library.JsonSolution
saveToFile(String path)
Saves the JSON object to an external file.String
toString()
Returns the JSON representation of the solution as a String.
-
-
-
Method Detail
-
getJsonObject
public jakarta.json.JsonObject getJsonObject()
Returns the JSON object built using the jakarta.json library.- Returns:
- JsonObject representing the solution.
-
saveToFile
public JsonSolution saveToFile(String path) throws IOException
Saves the JSON object to an external file.- Parameters:
path
- The file path where the JSON should be saved.- Returns:
- The current JsonSolution instance.
- Throws:
IOException
- if an I/O error occurs during the writing process.
-
-