localsolver
public class LocalSolver extends java.lang.Object
LSModel) by creating some expressions (LSExpression).LSParam, LSPhase).LocalSolver).LSSolution).LSStatistics).getState() and stop().
Please consult LSVersion for copyright and version info.| Constructor and Description |
|---|
LocalSolver()
Constructs a complete LocalSolver environment and take a token license.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addCallback(LSCallbackType type,
LSCallback callback)
Add a new callback for a specific event type.
|
LSPhase |
createPhase()
Adds a new phase to this LocalSolver environment.
|
void |
delete()
Delete the LocalSolver objects and release the licence token.
|
boolean |
equals(java.lang.Object obj) |
java.lang.String |
getInfo()
Returns useful info about the search while running.
|
LSModel |
getModel()
Gets the model associated to this LocalSolver environment.
|
int |
getNbPhases()
Gets the number of phases.
|
LSParam |
getParam()
Gets the parameters of this LocalSolver environment.
|
LSPhase |
getPhase(int phaseIndex)
Gets the phase with the given index.
|
LSSolution |
getSolution()
Gets the best solution found by the solver.
|
LSState |
getState()
Gets the state of this LocalSolver environment.
|
LSStatistics |
getStatistics()
Gets the statistics of this LocalSolver environment.
|
int |
hashCode() |
void |
loadEnvironment(java.lang.String filename)
Import a complete environment or a model from a file.
|
boolean |
removeCallback(LSCallbackType type,
LSCallback callback)
Remove the callback for the given event type.
|
void |
saveEnvironment(java.lang.String filename)
Exports the complete environment (model, parameters, solution, ..) in a file.
|
void |
solve()
Solves the model.
|
void |
stop()
Aborts the resolution previously launched using
solve(). |
java.lang.String |
toString() |
public LocalSolver()
public void delete()
public LSState getState()
LSState.Running.public LSModel getModel()
solve().public LSParam getParam()
public void solve()
public void stop()
solve().
If no resolution was launched, this method does nothing.
Called from another thread, this method enables users
to stop the resolution properly. Solution and statistics
remain valid. This method can be called in any state,
notably in state LSState.Running.public LSPhase createPhase()
LSState.Stopped.public LSPhase getPhase(int phaseIndex)
LSState.Paused or LSState.Stopped.phaseIndex - Index of the phase.public int getNbPhases()
LSState.Paused or LSState.Stopped.public LSSolution getSolution()
LSState.Paused or LSState.Stopped.public LSStatistics getStatistics()
LSState.Paused or LSState.Stopped.
Note that for performance reasons, this function always returns the same object.LSStatisticspublic java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String getInfo()
LSState.Paused or LSState.Stopped. Useful for debugging or logging purposes.
Here are some explanations about the output String:
public void saveEnvironment(java.lang.String filename)
filename - Name of the file.loadEnvironment(java.lang.String)public void loadEnvironment(java.lang.String filename)
LSState.Modeling.
The current model must be empty.
Currently, this function supports 4 main file formats : LSM, LSB, LP and MPS.
The first two are preferable since they are the native format of LocalSolver.
The other ones are classically used by linear programming solvers. LocalSolver
supports only a subset of features exposed by these last formats.
Please refer to the documentation for more details on this subject.
The chosen file format is determined by the file suffix. An exception
is thrown if the provided file suffix is not supported. The suffix
may optionally be followed by .gz. In that case, this function
uncompress the stream before reading.filename - Name of the file.saveEnvironment(java.lang.String)public void addCallback(LSCallbackType type, LSCallback callback)
LSState.Paused".
The same callback can be used for different events.
Only allowed in states LSState.Stopped or LSState.Modeling.type - Event to watch.callback - User callback. Cannot be null.userdata - A pointer to a user structure.public boolean removeCallback(LSCallbackType type, LSCallback callback)
type - Event.callback - User callback to delete.addCallback(localsolver.LSCallbackType, localsolver.LSCallback)public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Object