IGLib
1.7.2
The IGLib base library for development of numerical, technical and business applications.
|
Performs elementary operations for optimization and analysis servers and clients that exchange data and messages through files. Each such server can serve a single request at a time (single thread of execution). Client-server pair (or pairs, when both analysis and optimization are performed in this way) has (or have) a single directory for exchanging data and messages. If there is a need for analyses running in parallel, each thread must have its own directory and its own client-server pair. More...
Public Member Functions | |
OptFileManager (string directoryPath) | |
Creates a new optimization file server manager. More... | |
string | GetPath (string relativePath) |
Returns full path of the file or directory with the specified relative path within the data and messages exchange directory. More... | |
bool | LockFileMutexCheckAbandoned () |
Check whether the filesystem locking mutex (property LockFileMutex) has been abandoned, and returns true if it has been (otherwise, false is returned). More... | |
virtual bool | IsAnInputReady () |
Gets a flag telling whether analysis input data is ready. More... | |
virtual void | WaitAnInputReady () |
Waits until analysis data is ready. REMARK: Currently this file just checks existence of the file in a loop. This should be changed in the future because it is not the best solution. More... | |
virtual void | ClearAnInputReady () |
Clears the analysis data ready flag. More... | |
virtual void | SetAnInputReady () |
Sets the analysis input ready flag. More... | |
virtual bool | IsAnResultsReady () |
Gets a flag telling whether analysis output data is ready. More... | |
virtual void | WaitAnResultsReady () |
Waits until analysis data is ready. REMARK: Currently this file just checks existence of the file in a loop. This should be changed in the future because it is not the best solution. More... | |
virtual void | ClearAnResultsReady () |
Clears the analysis results ready flag. More... | |
virtual void | SetAnResultsReady () |
Sets the analysis results ready flag. More... | |
virtual bool | IsAnBusy () |
Gets a flag telling whether direct analysis is busy. More... | |
virtual void | WaitAnReady () |
Waits until analysis is ready. REMARK: Currently this file just checks existence of the file in a loop. This should be changed in the future because it is not the best solution. More... | |
virtual void | ClearAnBusy () |
Clears the analysis busy flag. More... | |
virtual void | SetAnBusy () |
Sets the analysis busy flag. More... | |
void | ClearMessages () |
Clears messages from the working directory. More... | |
virtual void | ClientWriteAnInput (AnalysisResults anInput) |
Client writes analysis input data for calculation of analysis results. Messages are set nad cleared appropriately. More... | |
virtual void | ClientReadAnOutput (ref AnalysisResults anres) |
Client reads analysis results. Messages are set and cleared appropriately. More... | |
virtual void | ClientSendAnalysisRequest () |
Sends request to the server for calculation of analysis response. More... | |
virtual void | ClientCalculateAnalysisResults (ref AnalysisResults anRes) |
Calculates analysis results by using the analysis server. Writes analysis input, sends request to the server, and reads the calculated results. More... | |
virtual void | ClientTestCalculateAnalysisResults (string inputFilePath, bool reqObjective, bool reqConstraints, bool reqObjectiveGradient, bool reqConstraintGradients, string outputFilePath) |
Performs client-side test calculation of analysis response. More... | |
virtual void | ServerAnalyse () |
Performs direct analysis (in optimization) with prescribed analysis input data, and saves results. Messages are set and cleared appropriately. This method reads analysis input from standard location, performs calculation, calculates analysis results and stores them to the standard location. More... | |
Protected Member Functions | |
virtual void | WriteAnalysisInputMath (string filePath, AnalysisResults anpt) |
Stores analysis input data to the specified file in the standard format (Mathematica-like, but with C style numbers). Does not perform any locking. More... | |
virtual void | WriteAnalysisInputJson (string filePath, AnalysisResults anpt) |
Stores analysis input data to the specified file in the JSON format. Does not perform any locking. More... | |
virtual void | WriteAnalysisInputXml (string filePath, AnalysisResults anpt) |
Stores analysis input data to the specified file in the XML format Does not perform any locking. More... | |
virtual void | ReadAnalysisInputMath (string filePath, ref AnalysisResults anpt) |
Reads analysis input data (request) from the specified file in the standard IGLib format, and stores the data in the specified object. More... | |
virtual void | ReadAnalysisInputJson (string filePath, ref AnalysisResults anpt) |
Reads analysis input data (request) from the specified file in the JSON format, and stores the data in the specified object. More... | |
virtual void | ReadAnalysisInputXml (string filePath, ref AnalysisResults anpt) |
Reads analysis input data (request) from the specified file in the XML format, and stores the data in the specified object. More... | |
virtual void | WriteAnalysisOutputMath (string filePath, AnalysisResults anpt) |
Stores analysis results to the specified file in the standard format (Mathematica-like, but with C style numbers). Does not perform any locking. More... | |
virtual void | WriteAnalysisOutputJson (string filePath, AnalysisResults anpt) |
Stores analysis output data to the specified file in the JSON format Does not perform any locking. More... | |
virtual void | WriteAnalysisOutputXml (string filePath, AnalysisResults anpt) |
Stores analysis output data to the specified file in the XML format . Does not perform any locking. More... | |
virtual void | ReadAnalysisOutputMath (string filePath, ref AnalysisResults anpt) |
Reads analysis output data (request) from the specified file in the standard IGLib format, and stores the data in the specified object. More... | |
virtual void | ReadAnalysisOutputJson (string filePath, ref AnalysisResults anpt) |
Reads analysis output data (request) from the specified file in the JSON format, and stores the data in the specified object. More... | |
virtual void | ReadAnalysisOutputXml (string filePath, ref AnalysisResults anpt) |
Reads analysis output data (request) from the specified file in the XML format, and stores the data in the specified object. More... | |
Protected Attributes | |
string | _directory = null |
string | _anInMathFilename = OptFileConst.AnInMathFileName |
string | _msgAnBusyFileName = OptFileConst.MsgAnBusyFilename |
string | _invOptCommandFilename = OptFileConst.InvOptCommandFilename |
string | _lockFileMutexName = OptFileConst.LockFileMutexName |
Mutex | _lockFileMutex |
Properties | |
object | Lock [get] |
This object's central lock object to be used by other object. Do not use this object for locking in class' methods, for this you should use InternalLock. More... | |
string | DataDirectory [get, protected set] |
Directory for data and messages exchange through files. More... | |
string | LockFileMutexName [get, protected set] |
Name of the mutex for system-wide locking of files. More... | |
Mutex | LockFileMutex [get] |
Mutex for system-wide exclusive locks for file system operations related to the current class. More... | |
string | AnInMathPath [get, protected set] |
File path of the analysis input file in standard IGLib format. Setter takes only pure file name, without path information. If set to null then file path is set to null and will be recalculated when getter is called. More... | |
string | AnInJsonPath [get, protected set] |
File path of the analysis input file in Json format. Setter takes only pure file name, without path information. If set to null then file path is set to null and will be recalculated when getter is called. More... | |
string | AnInXmlPath [get, protected set] |
File path of the analysis input file in XML format. Setter takes only pure file name, without path information. If set to null then file path is set to null and will be recalculated when getter is called. More... | |
string | AnOutMathPath [get, protected set] |
File path of the analysis output file in standard IGLib format. Setter takes only pure file name, without path information. If set to null then fle path is set to null and will be recalculated when getter is called. More... | |
string | AnOutJsonPath [get, protected set] |
File path of the analysis output file in JSON format. Setter takes only pure file name, without path information. If set to null then file path is set to null and will be recalculated when getter is called. More... | |
string | AnOutXmlPath [get, protected set] |
File path of the analysis output file in XML format. Setter takes only pure file name, without path information. If set to null then file path is set to null and will be recalculated when getter is called. More... | |
string | MsgAnBusyPath [get, protected set] |
File path of the analysis busy flag file. Setter takes only pure file name, without path information. If set to null then path is set to null and will be recalculated when getter is called. More... | |
string | MsgAnInputReadyPath [get, protected set] |
File path of the analysis input data ready flag file. Setter takes only pure file name, without path information. If set to null then path is set to null and will be recalculated when getter is called. More... | |
string | MsgAnResultsReadyPath [get, protected set] |
File path of the analysis results ready flag file. Setter takes only pure file name, without path information. If set to null then path is set to null and will be recalculated when getter is called. More... | |
string | MsgOptBusyPath [get, protected set] |
File path of the optimization busy flag file. Setter takes only pure file name, without path information. If set to null then path is set to null and will be recalculated when getter is called. More... | |
string | MsgOptInputReadyPath [get, protected set] |
File path of the optimization input data ready flag file. Setter takes only pure file name, without path information. If set to null then path is set to null and will be recalculated when getter is called. More... | |
string | MsgOptResultsReadyPath [get, protected set] |
File path of the optimization resutlts ready flag file. Setter takes only pure file name, without path information. If set to null then path is set to null and will be recalculated when getter is called. More... | |
string | InvOptCommandPath [get, protected set] |
File path of the optimization command file for program Inverse (Inverse interface). Setter takes only pure file name, without path information. If set to null then path is set to null and will be recalculated when getter is called. More... | |
string | InvAnCommandFilePath [get, protected set] |
File path of the analysis command file for program Inverse (Inverse interface). Setter takes only pure file name, without path information. If set to null then path is set to null and will be recalculated when getter is called. More... | |
ISerializer | SerializerJson [get] |
Serializer for JSON format. More... | |
bool | AnFormatMath [get, set] |
Gets or sets the flag indicating whether analysis input and output is written Math format. More... | |
bool | AnFormatJson [get, set] |
Gets or sets the flag indicating whether analysis input and output is written JSON format. More... | |
bool | AnFormatXml [get, set] |
Gets or sets the flag indicating whether analysis input and output is written XML format. More... | |
AnalysisResults | AnResults [get] |
Analysis reaults whae analysis request data and analysis results ar stored. More... | |
virtual IAnalysis | Analysis [get, set] |
Properties inherited from IG.Lib.ILockable | |
object | Lock [get] |
Performs elementary operations for optimization and analysis servers and clients that exchange data and messages through files. Each such server can serve a single request at a time (single thread of execution). Client-server pair (or pairs, when both analysis and optimization are performed in this way) has (or have) a single directory for exchanging data and messages. If there is a need for analyses running in parallel, each thread must have its own directory and its own client-server pair.
WARNING: This module is taken from Dragonfly opt. server and adapted for purpose of some projects. If necessary to further develop, synchronize (and possibly merge) with Dragonfly, otherwise there will be problems with consistent development of both branches.
$A Igor jul08 Mar11;
|
inline |
Creates a new optimization file server manager.
directoryPath | Path to the working directory for the current manager. This is the directory where all data and commmunication (data transfer and messaging) files are located. |
|
inline |
Returns full path of the file or directory with the specified relative path within the data and messages exchange directory.
relativePath | Relative path (with respect to data and messages exchange directory) |
|
inline |
Check whether the filesystem locking mutex (property LockFileMutex) has been abandoned, and returns true if it has been (otherwise, false is returned).
After the call, mutex is no longer in abandoned state (WaitOne() will not throw an exception) if it has been before the call.
Call does not block.
References IG.Lib.Util.MutexCheckAbandoned().
|
inlinevirtual |
Gets a flag telling whether analysis input data is ready.
|
inlinevirtual |
Waits until analysis data is ready. REMARK: Currently this file just checks existence of the file in a loop. This should be changed in the future because it is not the best solution.
|
inlinevirtual |
Clears the analysis data ready flag.
|
inlinevirtual |
Sets the analysis input ready flag.
|
inlinevirtual |
Gets a flag telling whether analysis output data is ready.
|
inlinevirtual |
Waits until analysis data is ready. REMARK: Currently this file just checks existence of the file in a loop. This should be changed in the future because it is not the best solution.
|
inlinevirtual |
Clears the analysis results ready flag.
|
inlinevirtual |
Sets the analysis results ready flag.
|
inlinevirtual |
Gets a flag telling whether direct analysis is busy.
|
inlinevirtual |
Waits until analysis is ready. REMARK: Currently this file just checks existence of the file in a loop. This should be changed in the future because it is not the best solution.
|
inlinevirtual |
Clears the analysis busy flag.
|
inlinevirtual |
Sets the analysis busy flag.
|
inline |
Clears messages from the working directory.
|
inlineprotectedvirtual |
Stores analysis input data to the specified file in the standard format (Mathematica-like, but with C style numbers). Does not perform any locking.
filePath | Full path of the file that data is written to. |
anpt | Analysis input data. |
References IG.Num.AnalysisResults.SaveRequestMath().
|
inlineprotectedvirtual |
Stores analysis input data to the specified file in the JSON format. Does not perform any locking.
filePath | Full path of the file that data is written to. |
anpt | Analysis input data. |
|
inlineprotectedvirtual |
Stores analysis input data to the specified file in the XML format Does not perform any locking.
filePath | Full path of the file that data is written to. |
anpt | Analysis results. |
|
inlineprotectedvirtual |
Reads analysis input data (request) from the specified file in the standard IGLib format, and stores the data in the specified object.
filePath | Path to the file that data is read from. |
anpt | Analysis results object where the data is stored. |
References IG.Num.AnalysisResults.LoadRequestMath().
|
inlineprotectedvirtual |
Reads analysis input data (request) from the specified file in the JSON format, and stores the data in the specified object.
filePath | Path to the file that data is read from. |
anpt | Analysis results object where the data is stored. |
|
inlineprotectedvirtual |
Reads analysis input data (request) from the specified file in the XML format, and stores the data in the specified object.
filePath | Path to the file that data is read from. |
anpt | Analysis results object where the data is stored. |
|
inlineprotectedvirtual |
Stores analysis results to the specified file in the standard format (Mathematica-like, but with C style numbers). Does not perform any locking.
filePath | Full path of the file that data is written to. |
anpt | Analysis output data. |
References IG.Num.AnalysisResults.SaveMath().
|
inlineprotectedvirtual |
Stores analysis output data to the specified file in the JSON format Does not perform any locking.
filePath | Full path of the file that data is written to. |
anpt | Analysis results. |
|
inlineprotectedvirtual |
Stores analysis output data to the specified file in the XML format . Does not perform any locking.
filePath | Full path of the file that data is written to. |
anpt | Analysis results. |
|
inlineprotectedvirtual |
Reads analysis output data (request) from the specified file in the standard IGLib format, and stores the data in the specified object.
filePath | Path to the file that data is read from. |
anpt | Analysis results object where the data is stored. |
References IG.Num.AnalysisResults.LoadMath().
|
inlineprotectedvirtual |
Reads analysis output data (request) from the specified file in the JSON format, and stores the data in the specified object.
filePath | Path to the file that data is read from. |
anpt | Analysis results object where the data is stored. |
|
inlineprotectedvirtual |
Reads analysis output data (request) from the specified file in the XML format, and stores the data in the specified object.
filePath | Path to the file that data is read from. |
anpt | Analysis results object where the data is stored. |
|
inlinevirtual |
Client writes analysis input data for calculation of analysis results. Messages are set nad cleared appropriately.
anInput | Parameters to be written. |
|
inlinevirtual |
Client reads analysis results. Messages are set and cleared appropriately.
anres | Object where results are written. |
|
inlinevirtual |
Sends request to the server for calculation of analysis response.
|
inlinevirtual |
Calculates analysis results by using the analysis server. Writes analysis input, sends request to the server, and reads the calculated results.
anRes | Analysis results object where approximation output values are stored. |
|
inlinevirtual |
Performs client-side test calculation of analysis response.
inputFilePath | Path to the JSON file where input parameters are read from. The file pointed at must exist. |
reqObjective | Flag indicating whether objective function must be calculated. |
reqConstraints | Flag indicating whether constraint functions must be calculated. |
reqObjectiveGradient | Flag indicating whether objective function gradientmust be calculated. |
reqConstraintGradients | Fleg indicating whether constraint function gradients must be calculated. |
outputFilePath | Path of a file where the calculated analysis response in JSON is written to. It can be null or empty string, in this case response is not written to a file (but it is output on console). |
References IG.Num.VectorBase.LoadJson(), IG.Num.AnalysisResults.Parameters, IG.Num.AnalysisResults.ReqConstraintGradients, IG.Num.AnalysisResults.ReqConstraints, IG.Num.AnalysisResults.ReqObjective, IG.Num.AnalysisResults.ReqObjectiveGradient, and IG.Num.AnalysisResults.SaveJson().
|
inlinevirtual |
Performs direct analysis (in optimization) with prescribed analysis input data, and saves results. Messages are set and cleared appropriately. This method reads analysis input from standard location, performs calculation, calculates analysis results and stores them to the standard location.
References IG.Num.AnalysisResults.ResetResults().
|
private |
|
protected |
|
protected |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
protected |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
protected |
|
private |
|
private |
|
private |
|
protected |
|
protected |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
get |
This object's central lock object to be used by other object. Do not use this object for locking in class' methods, for this you should use InternalLock.
|
getprotected set |
Directory for data and messages exchange through files.
|
getprotected set |
Name of the mutex for system-wide locking of files.
|
getprotected |
Mutex for system-wide exclusive locks for file system operations related to the current class.
|
getprotected set |
File path of the analysis input file in standard IGLib format. Setter takes only pure file name, without path information. If set to null then file path is set to null and will be recalculated when getter is called.
|
getprotected set |
File path of the analysis input file in Json format. Setter takes only pure file name, without path information. If set to null then file path is set to null and will be recalculated when getter is called.
|
getprotected set |
File path of the analysis input file in XML format. Setter takes only pure file name, without path information. If set to null then file path is set to null and will be recalculated when getter is called.
|
getprotected set |
File path of the analysis output file in standard IGLib format. Setter takes only pure file name, without path information. If set to null then fle path is set to null and will be recalculated when getter is called.
|
getprotected set |
File path of the analysis output file in JSON format. Setter takes only pure file name, without path information. If set to null then file path is set to null and will be recalculated when getter is called.
|
getprotected set |
File path of the analysis output file in XML format. Setter takes only pure file name, without path information. If set to null then file path is set to null and will be recalculated when getter is called.
|
getprotected set |
File path of the analysis busy flag file. Setter takes only pure file name, without path information. If set to null then path is set to null and will be recalculated when getter is called.
|
getprotected set |
File path of the analysis input data ready flag file. Setter takes only pure file name, without path information. If set to null then path is set to null and will be recalculated when getter is called.
|
getprotected set |
File path of the analysis results ready flag file. Setter takes only pure file name, without path information. If set to null then path is set to null and will be recalculated when getter is called.
|
getprotected set |
File path of the optimization busy flag file. Setter takes only pure file name, without path information. If set to null then path is set to null and will be recalculated when getter is called.
|
getprotected set |
File path of the optimization input data ready flag file. Setter takes only pure file name, without path information. If set to null then path is set to null and will be recalculated when getter is called.
|
getprotected set |
File path of the optimization resutlts ready flag file. Setter takes only pure file name, without path information. If set to null then path is set to null and will be recalculated when getter is called.
|
getprotected set |
File path of the optimization command file for program Inverse (Inverse interface). Setter takes only pure file name, without path information. If set to null then path is set to null and will be recalculated when getter is called.
|
getprotected set |
File path of the analysis command file for program Inverse (Inverse interface). Setter takes only pure file name, without path information. If set to null then path is set to null and will be recalculated when getter is called.
|
getprotected |
Serializer for JSON format.
|
getset |
Gets or sets the flag indicating whether analysis input and output is written Math format.
|
getset |
Gets or sets the flag indicating whether analysis input and output is written JSON format.
|
getset |
Gets or sets the flag indicating whether analysis input and output is written XML format.
|
getprotected |
Analysis reaults whae analysis request data and analysis results ar stored.
|
getset |