22 #include "OSCommonUtil.h"
32 using std::ostringstream;
53 std::ostringstream outStr;
55 const char dirsep=
'\\';
57 const char dirsep=
'/';
61 xsltDir = dirsep ==
'/' ?
"../stylesheets/" :
"..\\stylesheets\\";
63 xsltDir =
"../stylesheets/";
65 outStr <<
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>" ;
66 outStr <<
"<?xml-stylesheet type=\"text/xsl\" href=\"";
68 outStr <<
"OSoL.xslt\"?>";
69 outStr <<
"<osol xmlns=\"os.optimizationservices.org\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" ";
70 outStr <<
"xsi:schemaLocation=\"os.optimizationservices.org http://www.optimizationservices.org/schemas/";
72 outStr <<
"/OSoL.xsd\" >" ;
79 { outStr <<
"<general>" << endl;
88 { outStr <<
"<instanceLocation>";
112 { outStr <<
"<contact>";
121 { outStr <<
"<otherOptions numberOfOtherOptions=\"";
129 outStr <<
"/>" << endl;
131 outStr <<
"</otherOptions>" << endl;
134 outStr <<
"</general>" << endl;
142 { outStr <<
"<system>" << endl;
166 { outStr <<
"<otherOptions numberOfOtherOptions=\"";
174 outStr <<
"/>" << endl;
176 outStr <<
"</otherOptions>" << endl;
179 outStr <<
"</system>" << endl;
180 cout <<
"Done with <system> element" << endl;
187 { outStr <<
"<service>" << endl;
193 { outStr <<
"<otherOptions numberOfOtherOptions=\"";
201 outStr <<
"/>" << endl;
203 outStr <<
"</otherOptions>" << endl;
206 outStr <<
"</service>" << endl;
207 cout <<
"Done with <service> element" << endl;
214 { outStr <<
"<job>" << endl;
220 outStr <<
"INF" <<
"</maxTime>" << endl;
228 { outStr <<
"<dependencies numberOfJobIDs=\"";
233 outStr <<
"</dependencies>" << endl;
238 { outStr <<
"<requiredDirectories numberOfPaths=\"";
242 outStr <<
"</requiredDirectories>" << endl;
247 { outStr <<
"<requiredFiles numberOfPaths=\"";
251 outStr <<
"</requiredFiles>" << endl;
256 { outStr <<
"<directoriesToMake numberOfPaths=\"";
260 outStr <<
"</directoriesToMake>" << endl;
265 { outStr <<
"<filesToMake numberOfPaths=\"";
269 outStr <<
"</filesToMake>" << endl;
274 { outStr <<
"<inputDirectoriesToMove numberOfPathPairs=\"";
277 { outStr <<
"<pathPair";
281 outStr <<
" makeCopy=\"true\"";
282 outStr <<
"/>" << endl;
284 outStr <<
"</inputDirectoriesToMove>" << endl;
289 { outStr <<
"<inputFilesToMove numberOfPathPairs=\"";
292 { outStr <<
"<pathPair";
296 outStr <<
" makeCopy=\"true\"";
297 outStr <<
"/>" << endl;
299 outStr <<
"</inputFilesToMove>" << endl;
304 { outStr <<
"<outputFilesToMove numberOfPathPairs=\"";
307 { outStr <<
"<pathPair";
311 outStr <<
" makeCopy=\"true\"";
312 outStr <<
"/>" << endl;
314 outStr <<
"</outputFilesToMove>" << endl;
319 { outStr <<
"<outputDirectoriesToMove numberOfPathPairs=\"";
322 { outStr <<
"<pathPair";
326 outStr <<
" makeCopy=\"true\"";
327 outStr <<
"/>" << endl;
329 outStr <<
"</outputDirectoriesToMove>" << endl;
334 { outStr <<
"<filesToDelete numberOfPaths=\"";
338 outStr <<
"</filesToDelete>" << endl;
343 { outStr <<
"<directoriesToDelete numberOfPaths=\"";
347 outStr <<
"</directoriesToDelete>" << endl;
352 { outStr <<
"<processesToKill numberOfProcesses=\"";
356 outStr <<
"</processesToKill>" << endl;
361 { outStr <<
"<otherOptions numberOfOtherOptions=\"";
369 outStr <<
"/>" << endl;
371 outStr <<
"</otherOptions>" << endl;
374 outStr <<
"</job>" << endl;
375 cout <<
"Done with <job> element" << endl;
382 { outStr <<
"<optimization";
386 outStr <<
">" << endl;
388 { outStr <<
"<variables";
391 outStr <<
">" << endl;
396 { outStr <<
"<initialVariableValues numberOfVar=\"";
402 { outStr <<
" value=\"";
410 outStr <<
"\"/>" << endl;
412 outStr <<
"</initialVariableValues>" << endl;
418 { outStr <<
"<initialVariableValuesString numberOfVar=\"";
424 outStr <<
"/>" << endl;
426 outStr <<
"</initialVariableValuesString>" << endl;
432 { outStr <<
"<initialBasisStatus numberOfVar=\"";
438 outStr <<
"/>" << endl;
440 outStr <<
"</initialBasisStatus>" << endl;
446 { outStr <<
"<integerVariableBranchingWeights numberOfVar=\"";
452 outStr <<
"/>" << endl;
454 outStr <<
"</integerVariableBranchingWeights>" << endl;
460 { outStr <<
"<sosVariableBranchingWeights numberOfSOS=\"";
462 cout <<
"start: numberOfSOS" << endl;
476 cout <<
"idx" << endl;
480 outStr <<
"/>" << endl;
482 outStr <<
"</sos>" << endl;
484 outStr <<
"</sosVariableBranchingWeights>" << endl;
493 cout <<
"option " << i <<
":" << endl;
513 outStr <<
">" << endl;
523 outStr <<
"/>" << endl;
525 outStr <<
"</other>" << endl;
527 outStr <<
"</variables>" << endl;
530 { outStr <<
"<objectives";
533 outStr <<
">" << endl;
535 { outStr <<
"<initialObjectiveValues numberOfObj=\"";
541 { outStr <<
" value=\"";
549 outStr <<
"\"/>" << endl;
551 outStr <<
"</initialObjectiveValues>" << endl;
554 { outStr <<
"<initialObjectiveBounds numberOfObj=\"";
559 outStr <<
" lbValue=\"";
566 outStr <<
"\" ubValue=\"";
573 outStr <<
"\"/>" << endl;
575 outStr <<
"</initialObjectiveBounds>" << endl;
584 cout <<
"option " << i <<
":" << endl;
605 outStr <<
">" << endl;
611 outStr <<
"/>" << endl;
613 outStr <<
"</other>" << endl;
615 outStr <<
"</objectives>" << endl;
618 { outStr <<
"<constraints";
621 outStr <<
">" << endl;
623 { outStr <<
"<initialConstraintValues numberOfCon=\"";
629 { outStr <<
" value=\"";
637 outStr <<
"\"/>" << endl;
639 outStr <<
"</initialConstraintValues>" << endl;
642 { outStr <<
"<initialDualValues numberOfCon=\"";
647 outStr <<
" lbDualValue=\"";
654 outStr <<
"\" ubDualValue=\"";
661 outStr <<
"\"/>" << endl;
663 outStr <<
"</initialDualValues>" << endl;
672 cout <<
"option " << i <<
":" << endl;
693 outStr <<
">" << endl;
703 outStr <<
"/>" << endl;
705 outStr <<
"</other>" << endl;
707 outStr <<
"</constraints>" << endl;
711 { outStr <<
"<solverOptions numberOfSolverOptions=\"";
725 outStr <<
"/>" << endl;
727 outStr <<
"</solverOptions>" << endl;
730 outStr <<
"</optimization>" << endl;
732 outStr <<
"</osol>" << endl;
std::string unit
the unit in which CPU speed is measured
std::string value
value of the option
InitConstraintValues * initialConstraintValues
initial values for the constraints
InitObjectiveValues * initialObjectiveValues
initial values for the objectives
std::string * jobID
the list of job IDs
double ubDualValue
initial upper bound
std::string solver
name of the solver to which this option applies
InitVarValue ** var
initial value for each variable
std::string value
value of the option
DirectoriesAndFiles * requiredDirectories
directories required to run the job
int numberOfCon
number of <con> children
std::string category
name of the category into which this option falls
std::string solver
name of the solver to which this option applies
std::string solver
the solver to which the option applies
ServiceOption * service
serviceOption holds the third child of the OSOption specified by the OSoL Schema. ...
std::string serviceName
the name of the service
std::string value
value of the option
std::string requestedStartTime
the requested time to start the job
int numberOfCon
number of <con> children
std::string type
the service type
SOSVariableBranchingWeights * sosVariableBranchingWeights
branching weights for SOS variables and groups
JobOption * job
jobOption holds the fourth child of the OSOption specified by the OSoL Schema.
OtherOption ** other
the list of other options
StorageCapacity * minDiskSpace
the minimum disk space required
int sosIdx
index of the SOS (to match the OSiL file)
int numberOfOtherObjectiveOptions
number of <other> child elements
std::string * path
the list of directory and file paths
double value
the number of units
SystemOption * system
systemOption holds the second child of the OSOption specified by the OSoL Schema. ...
std::string userName
the username
int numberOfVariables
the number of variables
std::string category
the category to which the option belongs
OtherVariableOption ** other
other variable options
std::string type
type of the option value (integer, double, boolean, string)
OtherOptions * otherOptions
the list of other general options
~OSoLWriter()
Class destructor.
InitDualVariableValues * initialDualValues
initial dual values for the constraints
std::string solver
name of the solver to which this option applies
std::string name
name of the option
DirectoriesAndFiles * directoriesToDelete
directories to delete upon completion
ConstraintOption * constraints
the options for the constraints
std::string category
name of the category into which this option falls
std::string name
name of the option
StorageCapacity * minMemorySize
the minimum memory required
std::string lbValue
lower bound of the option
std::string category
name of the category into which this option falls
int numberOfVar
number of children
bool makeCopy
record whether a copy is to be made
std::string instanceName
the name of the instance
const OSOption * m_OSOption
m_OSOption is an object in the class OSOption
PathPairs * outputFilesToMove
output files to move or copy
double groupWeight
branching weight for the entire SOS
int numberOfCon
number of <con> children
int numberOfPathPairs
the number of <path> children
std::string name
name of the option
std::string password
the password
std::string jobID
the job ID
double lbValue
initial lower bound
std::string to
the file or directory to move/copy to
std::string locationType
the type of the location
int numberOfObj
number of <obj> children
int numberOfSolverOptions
the number of solver options
DirectoriesAndFiles * filesToDelete
files to delete upon completion
int numberOfObjectives
the number of objectives
int numberOfVar
number of child elements
InstanceLocationOption * instanceLocation
the location of the instance
std::string from
the file or directory to move/copy from
std::string serviceURI
the service URI
BasisStatus * initialBasisStatus
initial basis information
#define OS_SCHEMA_VERSION
BranchingWeight ** var
branching weights for individual variables
int numberOfOtherVariableOptions
number of <other> child elements
OSoLWriter()
Default constructor.
std::string description
the description of the option
int numberOfVar
number of children
InitObjValue ** obj
initial value for each objective
CPUNumber * minCPUNumber
the minimum number of processors required
int numberOfPaths
the number of <path> children
std::string name
the name of the option
double value
branching weight
int numberOfConstraints
the number of constraints
double value
initial value
std::string value
initial value
std::string writeOSoL(OSOption *theosoption)
create an osol string from an OSOption object
std::string description
description of the option
DirectoriesAndFiles * directoriesToMake
directories to make during the job
int idx
index of the variable
PathPairs * inputDirectoriesToMove
input directories to move or copy
std::string value
the value of the option
int numberOfVar
number of children
OtherOptions * otherOptions
the list of other service options
double value
initial value
std::string unit
the unit in which storage capacity is measured
int numberOfProcesses
the number of <process> children
double lbDualValue
initial lower bound
SolverOptions * solverOptions
other solver options
std::string value
value of the option
InitVarValueString ** var
initial value for each variable
InitConValue ** con
initial value for each constraint
DirectoriesAndFiles * filesToMake
files to make during the job
OtherOptions * otherOptions
the list of other system options
PathPairs * outputDirectoriesToMove
output directories to move or copy
int numberOfObj
number of <obj> children
CPUSpeed * minCPUSpeed
the minimum CPU speed required
std::string description
description of the option
VariableOption * variables
the options for the variables
OtherVarOption ** var
array of option values
Processes * processesToKill
processes to kill upon completion
std::string value
value of the option
std::string name
the name of the option
InitVariableValuesString * initialVariableValuesString
initial values for string-valued variables
std::string license
the license information
double value
the CPU speed (expressed in multiples of unit)
ContactOption * contact
the contact method
OtherConOption ** con
array of option values
PathPair ** pathPair
the list of directory and file paths
TimeSpan * maxTime
the maximum time allowed
SOSWeights ** sos
branching weights for the SOS
std::string type
the type of the option value (integer, double, boolean, string)
double ubValue
initial upper bound
std::string value
value of the option
InitDualVarValue ** con
initial dual values for each constraint
OtherObjectiveOption ** other
other information about the objectives
std::string type
type of the option value (integer, double, boolean, string)
int numberOfSOS
number of <sos> children
std::string solverToInvoke
the solver to invoke
PathPairs * inputFilesToMove
input files to move or copy
std::string ubValue
lower bound on the value
std::string os_dtoa_format(double x)
int numberOfVar
number of children
int numberOfObj
number of <obj> children
int numberOfJobIDs
the number of entries in the list of job dependencies
std::string type
type of the option value (integer, double, boolean, string)
OptimizationOption * optimization
optimizationOption holds the fifth child of the OSOption specified by the OSoL Schema.
int numberOfOtherConstraintOptions
number of <other> child elements
std::string value
the value of the <instanceLocation> element
GeneralOption * general
generalOption holds the first child of the OSOption specified by the OSoL Schema. ...
IntegerVariableBranchingWeights * integerVariableBranchingWeights
branching weights for integer variables
std::string lbValue
lower bound on the value
std::string value
the value of the option
std::string description
description of the option
std::string ubValue
upper bound of the option
ObjectiveOption * objectives
the options for the objectives
int numberOfOtherOptions
the number of other options
SolverOption ** solverOption
the list of solver options
double value
initial value
InitObjectiveBounds * initialObjectiveBounds
initial bounds for the objectives
BranchingWeight ** var
branching weight for each variable
OtherObjOption ** obj
array of option values
InitObjBound ** obj
initial bounds for each objective
std::string description
the description of the option
std::string * process
the list of processes
OtherOptions * otherOptions
list of other job options
std::string unit
the unit in which time is measured
double value
the number of units of storage capacity
OtherConstraintOption ** other
other information about the constraints
JobDependencies * dependencies
the dependency set
InitVariableValues * initialVariableValues
initial values for the variables
DirectoriesAndFiles * requiredFiles
files required to run the job