22#include "OSParameters.h"
32using std::ostringstream;
48 std::ostringstream osolStr, outStr;
50 const char dirsep=
'\\';
52 const char dirsep=
'/';
56 xsltDir = dirsep ==
'/' ?
"../stylesheets/" :
"..\\stylesheets\\";
58 xsltDir =
"http://www.coin-or.org/OS/stylesheets/";
60 bool generalTagPrinted;
66 osolStr <<
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>" ;
67 osolStr <<
"<?xml-stylesheet type=\"text/xsl\" href=\"";
69 osolStr <<
"OSoL.xslt\"?>";
71 osolStr <<
"<osol xmlns=\"os.optimizationservices.org\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" ";
72 osolStr <<
"xsi:schemaLocation=\"os.optimizationservices.org http://www.optimizationservices.org/schemas/";
74 osolStr <<
"/OSoL.xsd\" >" ;
82 osolStr <<
"<optionHeader>" << endl;
84 osolStr <<
"</optionHeader>" << endl;
92 generalTagPrinted =
false;
95 if (generalTagPrinted ==
false)
97 osolStr <<
"<general>" << endl;
98 generalTagPrinted =
true;
104 if (generalTagPrinted ==
false)
106 osolStr <<
"<general>" << endl;
107 generalTagPrinted =
true;
113 if (generalTagPrinted ==
false)
115 osolStr <<
"<general>" << endl;
116 generalTagPrinted =
true;
122 if (generalTagPrinted ==
false)
124 osolStr <<
"<general>" << endl;
125 generalTagPrinted =
true;
129 osolStr <<
"<instanceLocation>";
139 if (generalTagPrinted ==
false)
141 osolStr <<
"<general>" << endl;
142 generalTagPrinted =
true;
148 if (generalTagPrinted ==
false)
150 osolStr <<
"<general>" << endl;
151 generalTagPrinted =
true;
157 if (generalTagPrinted ==
false)
159 osolStr <<
"<general>" << endl;
160 generalTagPrinted =
true;
166 if (generalTagPrinted ==
false)
168 osolStr <<
"<general>" << endl;
169 generalTagPrinted =
true;
175 if (generalTagPrinted ==
false)
177 osolStr <<
"<general>" << endl;
178 generalTagPrinted =
true;
184 if (generalTagPrinted ==
false)
186 osolStr <<
"<general>" << endl;
187 generalTagPrinted =
true;
191 osolStr <<
"<contact>";
201 if (generalTagPrinted ==
false)
203 osolStr <<
"<general>" << endl;
204 generalTagPrinted =
true;
206 osolStr <<
"<otherOptions numberOfOtherOptions=\"";
215 osolStr <<
"/>" << endl;
217 osolStr <<
"</otherOptions>" << endl;
219 if (generalTagPrinted ==
false)
220 osolStr <<
"<general>" << endl;
222 osolStr <<
"</general>" << endl;
234 osolStr <<
"<system>" << endl;
237 osolStr <<
"<minDiskSpace";
247 osolStr <<
"</minDiskSpace>" << endl;
251 osolStr <<
"<minMemorySize";
261 osolStr <<
"</minMemorySize>" << endl;
265 osolStr <<
"<minCPUSpeed";
275 osolStr <<
"</minCPUSpeed>" << endl;
279 osolStr <<
"<minCPUNumber";
287 osolStr <<
"<otherOptions numberOfOtherOptions=\"";
296 osolStr <<
"/>" << endl;
298 osolStr <<
"</otherOptions>" << endl;
300 osolStr <<
"</system>" << endl;
311 osolStr <<
"<service>" << endl;
318 osolStr <<
"<otherOptions numberOfOtherOptions=\"";
327 osolStr <<
"/>" << endl;
329 osolStr <<
"</otherOptions>" << endl;
331 osolStr <<
"</service>" << endl;
342 osolStr <<
"<job>" << endl;
352 osolStr <<
"</maxTime>" << endl;
358 osolStr <<
"<dependencies numberOfJobIDs=\"";
362 osolStr <<
"</dependencies>" << endl;
366 osolStr <<
"<requiredDirectories numberOfPaths=\"";
370 osolStr <<
"</requiredDirectories>" << endl;
374 osolStr <<
"<requiredFiles numberOfPaths=\"";
378 osolStr <<
"</requiredFiles>" << endl;
382 osolStr <<
"<directoriesToMake numberOfPaths=\"";
387 osolStr <<
"</directoriesToMake>" << endl;
391 osolStr <<
"<filesToMake numberOfPaths=\"";
395 osolStr <<
"</filesToMake>" << endl;
399 osolStr <<
"<inputDirectoriesToMove numberOfPathPairs=\"";
403 osolStr <<
"<pathPair";
407 osolStr <<
" makeCopy=\"true\"";
408 osolStr <<
"/>" << endl;
410 osolStr <<
"</inputDirectoriesToMove>" << endl;
414 osolStr <<
"<inputFilesToMove numberOfPathPairs=\"";
418 osolStr <<
"<pathPair";
422 osolStr <<
" makeCopy=\"true\"";
423 osolStr <<
"/>" << endl;
425 osolStr <<
"</inputFilesToMove>" << endl;
429 osolStr <<
"<outputFilesToMove numberOfPathPairs=\"";
433 osolStr <<
"<pathPair";
437 osolStr <<
" makeCopy=\"true\"";
438 osolStr <<
"/>" << endl;
440 osolStr <<
"</outputFilesToMove>" << endl;
444 osolStr <<
"<outputDirectoriesToMove numberOfPathPairs=\"";
448 osolStr <<
"<pathPair";
452 osolStr <<
" makeCopy=\"true\"";
453 osolStr <<
"/>" << endl;
455 osolStr <<
"</outputDirectoriesToMove>" << endl;
459 osolStr <<
"<filesToDelete numberOfPaths=\"";
463 osolStr <<
"</filesToDelete>" << endl;
467 osolStr <<
"<directoriesToDelete numberOfPaths=\"";
471 osolStr <<
"</directoriesToDelete>" << endl;
475 osolStr <<
"<processesToKill numberOfProcesses=\"";
479 osolStr <<
"</processesToKill>" << endl;
483 osolStr <<
"<otherOptions numberOfOtherOptions=\"";
492 osolStr <<
"/>" << endl;
494 osolStr <<
"</otherOptions>" << endl;
496 osolStr <<
"</job>" << endl;
507 osolStr <<
"<optimization";
514 osolStr <<
">" << endl;
517 osolStr <<
"<variables";
520 osolStr <<
">" << endl;
524 outStr <<
"initialVariableValues: "
530 osolStr <<
"<initialVariableValues numberOfVar=\"";
540 osolStr <<
" value=\"";
544 osolStr <<
"/>" << endl;
546 osolStr <<
"</initialVariableValues>" << endl;
551 outStr <<
"initialVariableValuesString: "
557 osolStr <<
"<initialVariableValuesString numberOfVar=\"";
566 osolStr <<
"/>" << endl;
568 osolStr <<
"</initialVariableValuesString>" << endl;
575 "output <variables> <basisStatus>");
577 osolStr <<
"<initialBasisStatus>" << endl;
579 osolStr <<
"</initialBasisStatus>" << endl;
585 outStr <<
"integerVariableBranchingWeights: "
591 osolStr <<
"<integerVariableBranchingWeights numberOfVar=\"";
601 osolStr <<
" value=\"";
605 osolStr <<
"/>" << endl;
607 osolStr <<
"</integerVariableBranchingWeights>" << endl;
612 outStr <<
"sosVariableBranchingWeights: "
618 osolStr <<
"<sosVariableBranchingWeights numberOfSOS=\"";
629 outStr <<
"sosIdx - nvar: "
638 osolStr <<
" groupWeight=\"";
640 osolStr <<
"\">" << endl;
653 osolStr <<
" value=\"";
657 osolStr <<
"/>" << endl;
659 osolStr <<
"</sos>" << endl;
661 osolStr <<
"</sosVariableBranchingWeights>" << endl;
666 outStr <<
"Number of other variable options: "
693 osolStr <<
">" << endl;
706 osolStr <<
"/>" << endl;
714 osolStr <<
"</other>" << endl;
716 osolStr <<
"</variables>" << endl;
720 osolStr <<
"<objectives";
723 osolStr <<
">" << endl;
726 osolStr <<
"<initialObjectiveValues numberOfObj=\"";
736 osolStr <<
" value=\"";
740 osolStr <<
"/>" << endl;
742 osolStr <<
"</initialObjectiveValues>" << endl;
746 osolStr <<
"<initialObjectiveBounds numberOfObj=\"";
756 osolStr <<
" lbValue=\"";
762 osolStr <<
" ubValue=\"";
766 osolStr <<
"/>" << endl;
768 osolStr <<
"</initialObjectiveBounds>" << endl;
775 "output <objectives> <basisStatus>");
777 osolStr <<
"<initialBasisStatus>" << endl;
779 osolStr <<
"</initialBasisStatus>" << endl;
785 outStr <<
"Number of other objective options: "
811 osolStr <<
">" << endl;
820 osolStr <<
"/>" << endl;
826 osolStr <<
"</other>" << endl;
828 osolStr <<
"</objectives>" << endl;
835 osolStr <<
"<constraints";
838 osolStr <<
">" << endl;
841 osolStr <<
"<initialConstraintValues numberOfCon=\"";
851 osolStr <<
" value=\"";
855 osolStr <<
"/>" << endl;
857 osolStr <<
"</initialConstraintValues>" << endl;
862 osolStr <<
"<initialDualValues numberOfCon=\"";
872 osolStr <<
" lbDualValue=\"";
878 osolStr <<
" ubDualValue=\"";
882 osolStr <<
"/>" << endl;
884 osolStr <<
"</initialDualValues>" << endl;
891 "output <constraints> <basisStatus>");
893 osolStr <<
"<initialBasisStatus>" << endl;
895 osolStr <<
"</initialBasisStatus>" << endl;
901 outStr <<
"Number of other constraint options: "
929 osolStr <<
">" << endl;
942 osolStr <<
"/>" << endl;
948 osolStr <<
"</other>" << endl;
950 osolStr <<
"</constraints>" << endl;
959 osolStr <<
"<solverOptions numberOfSolverOptions=\"";
975 osolStr <<
"/>" << endl;
981 osolStr <<
"</solverOption>" << endl;
984 osolStr <<
"</solverOptions>" << endl;
987 osolStr <<
"</optimization>" << endl;
989 osolStr <<
"</osol>" << endl;
993 return osolStr.str();
const OSSmartPtr< OSOutput > osoutput
std::string os_dtoa_format(double x)
bool OSIsnan(double x)
checks whether a given double is NaN
std::string writeStringData(std::string str)
writeStringData
std::string writeGeneralFileHeader(GeneralFileHeader *v, bool addWhiteSpace)
Take a GeneralFileHeader object and write a string that validates against the OSgL schema.
std::string writeOtherOptionOrResultEnumeration(OtherOptionOrResultEnumeration *e, bool addWhiteSpace, bool writeBase64)
Take an OtherOptionOrResultEnumeration object and write a string that validates against the OSgL sche...
std::string writeBasisStatus(BasisStatus *bs, bool addWhiteSpace, bool writeBase64)
Take a BasisStatus object and write a string that validates against the OSgL schema.
std::string name
optional variable name
double value
branching weight
int idx
index of the variable
std::string description
additional description about the CPU
int value
the number of CPUs
std::string description
additional description about the CPU speed
std::string unit
the unit in which CPU speed is measured
double value
the CPU speed (expressed in multiples of unit)
InitConstraintValues * initialConstraintValues
initial values for the constraints
InitDualVariableValues * initialDualValues
initial dual values for the constraints
OtherConstraintOption ** other
other information about the constraints
int numberOfOtherConstraintOptions
number of <other> child elements
BasisStatus * initialBasisStatus
initial basis status for the slack variables
int numberOfPaths
the number of <path> children
std::string * path
the list of directory and file paths
OtherOptions * otherOptions
the list of other general options
InstanceLocationOption * instanceLocation
the location of the instance
std::string license
the license information
std::string serviceURI
the service URI
std::string serviceName
the name of the service
std::string jobID
the job ID
std::string userName
the username
std::string instanceName
the name of the instance
std::string solverToInvoke
the solver to invoke
std::string password
the password
ContactOption * contact
the contact method
double value
initial value
std::string name
optional variable name
InitConValue ** con
initial value for each constraint
int numberOfCon
number of <con> children
std::string name
optional variable name
double ubDualValue
initial upper bound
double lbDualValue
initial lower bound
int numberOfCon
number of <con> children
InitDualVarValue ** con
initial dual values for each constraint
double lbValue
initial lower bound
double ubValue
initial upper bound
std::string name
optional variable name
std::string name
optional objective name
double value
initial value
InitObjBound ** obj
initial bounds for each objective
int numberOfObj
number of <obj> children
InitObjValue ** obj
initial value for each objective
int numberOfObj
number of <obj> children
double value
initial value
std::string name
optional variable name
std::string value
initial value
std::string name
optional variable name
InitVarValue ** var
initial value for each variable
int numberOfVar
number of children
InitVarValueString ** var
initial value for each variable
int numberOfVar
number of children
std::string value
the value of the <instanceLocation> element
std::string locationType
the type of the location
BranchingWeight ** var
branching weight for each variable
int numberOfVar
number of children
std::string * jobID
the list of job IDs
int numberOfJobIDs
the number of entries in the list of job dependencies
Processes * processesToKill
processes to kill upon completion
DirectoriesAndFiles * requiredDirectories
directories required to run the job
DirectoriesAndFiles * filesToMake
files to make during the job
DirectoriesAndFiles * directoriesToDelete
directories to delete upon completion
std::string requestedStartTime
the requested time to start the job
DirectoriesAndFiles * requiredFiles
files required to run the job
DirectoriesAndFiles * filesToDelete
files to delete upon completion
JobDependencies * dependencies
the dependency set
PathPairs * inputFilesToMove
input files to move or copy
TimeSpan * maxTime
the maximum time allowed
PathPairs * outputDirectoriesToMove
output directories to move or copy
PathPairs * inputDirectoriesToMove
input directories to move or copy
PathPairs * outputFilesToMove
output files to move or copy
DirectoriesAndFiles * directoriesToMake
directories to make during the job
OtherOptions * otherOptions
list of other job options
OptimizationOption * optimization
optimizationOption holds the fifth child of the OSOption specified by the OSoL Schema.
GeneralOption * general
generalOption holds the first child of the OSOption specified by the OSoL Schema.
GeneralFileHeader * optionHeader
OSOption has a header and five other children: general, system, service, job, and optimization.
ServiceOption * service
serviceOption holds the third child of the OSOption specified by the OSoL Schema.
SystemOption * system
systemOption holds the second child of the OSOption specified by the OSoL Schema.
JobOption * job
jobOption holds the fourth child of the OSOption specified by the OSoL Schema.
std::string writeOSoL(OSOption *theosoption)
create an osol string from an OSOption object
bool m_bWriteBase64
m_bWriteBase64 is set to true if we encode the linear constraint coefficients in base64 binary
bool m_bWhiteSpace
m_bWhiteSpace is set to true if we write white space in the file
OSoLWriter()
Default constructor.
~OSoLWriter()
Class destructor.
const OSOption * m_OSOption
m_OSOption is an object in the class OSOption
int numberOfOtherObjectiveOptions
number of <other> child elements
OtherObjectiveOption ** other
other information about the objectives
InitObjectiveValues * initialObjectiveValues
initial values for the objectives
BasisStatus * initialBasisStatus
initial basis status for the objectives
InitObjectiveBounds * initialObjectiveBounds
initial bounds for the objectives
VariableOption * variables
the options for the variables
int numberOfConstraints
the number of constraints
ObjectiveOption * objectives
the options for the objectives
SolverOptions * solverOptions
other solver options
ConstraintOption * constraints
the options for the constraints
int numberOfObjectives
the number of objectives
int numberOfVariables
the number of variables
std::string lbValue
lower bound of the option
std::string ubValue
upper bound of the option
std::string name
optional variable name
std::string value
value of the option
std::string conType
type of the values in the con array
std::string category
name of the category into which this option falls
std::string name
name of the option
int numberOfCon
number of <con> children
OtherConOption ** con
array of option values
std::string type
type of the option value (integer, double, boolean, string)
OtherOptionOrResultEnumeration ** enumeration
std::string description
description of the option
std::string solver
name of the solver to which this option applies
std::string enumType
type of the values in the enumeration array
int numberOfEnumerations
number of <enumeration> child elements
std::string value
value of the option
std::string name
optional variable name
std::string value
value of the option
OtherObjOption ** obj
array of option values
int numberOfObj
number of <obj> children
std::string name
name of the option
std::string value
value of the option
std::string solver
name of the solver to which this option applies
int numberOfEnumerations
number of <enumeration> child elements
std::string objType
type of the values in the obj array
std::string category
name of the category into which this option falls
std::string type
type of the option value (integer, double, boolean, string)
std::string description
description of the option
std::string enumType
type of the values in the enumeration array
OtherOptionOrResultEnumeration ** enumeration
std::string value
the value of the option
std::string description
the description of the option
std::string name
the name of the option
OtherOption ** other
the list of other options
int numberOfOtherOptions
the number of other options
std::string value
value of the option
std::string ubValue
lower bound on the value
std::string name
optional variable name
std::string lbValue
lower bound on the value
int numberOfVar
number of child elements
int numberOfEnumerations
number of <enumeration> child elements
std::string type
type of the option value (integer, double, boolean, string)
std::string name
name of the option
std::string solver
name of the solver to which this option applies
std::string enumType
type of the values in the enumeration array
OtherOptionOrResultEnumeration ** enumeration
std::string category
name of the category into which this option falls
OtherVarOption ** var
array of option values
std::string description
description of the option
std::string varType
type of the values in the var array
std::string value
value of the option
std::string from
the file or directory to move/copy from
bool makeCopy
record whether a copy is to be made
std::string to
the file or directory to move/copy to
PathPair ** pathPair
the list of directory and file paths
int numberOfPathPairs
the number of <path> children
std::string * process
the list of processes
int numberOfProcesses
the number of <process> children
SOSWeights ** sos
branching weights for the SOS
int numberOfSOS
number of <sos> children
BranchingWeight ** var
branching weights for individual variables
int sosIdx
index of the SOS (to match the OSiL file)
int numberOfVar
number of children
double groupWeight
branching weight for the entire SOS
std::string type
the service type
OtherOptions * otherOptions
the list of other service options
std::string * item
the list of items of the option
std::string value
the value of the option
std::string solver
the solver to which the option applies
std::string description
the description of the option
std::string type
the type of the option value (integer, double, boolean, string)
std::string category
the category to which the option belongs
int numberOfItems
the number of items (additional pieces of data) of the option
std::string name
the name of the option
SolverOption ** solverOption
the list of solver options
int numberOfSolverOptions
the number of solver options
std::string unit
the unit in which storage capacity is measured
double value
the number of units of storage capacity
std::string description
additional description about the storage
StorageCapacity * minDiskSpace
the minimum disk space required
StorageCapacity * minMemorySize
the minimum memory required
CPUSpeed * minCPUSpeed
the minimum CPU speed required
CPUNumber * minCPUNumber
the minimum number of processors required
OtherOptions * otherOptions
the list of other system options
std::string unit
the unit in which time is measured
double value
the number of units
BasisStatus * initialBasisStatus
initial basis information
int numberOfOtherVariableOptions
number of <other> child elements
InitVariableValuesString * initialVariableValuesString
initial values for string-valued variables
OtherVariableOption ** other
other variable options
SOSVariableBranchingWeights * sosVariableBranchingWeights
branching weights for SOS variables and groups
InitVariableValues * initialVariableValues
initial values for the variables
IntegerVariableBranchingWeights * integerVariableBranchingWeights
branching weights for integer variables
#define OS_SCHEMA_VERSION
@ ENUM_OUTPUT_LEVEL_detailed_trace
@ ENUM_OUTPUT_LEVEL_debug
@ ENUM_OUTPUT_LEVEL_trace
@ ENUM_OUTPUT_AREA_OSoLwriter