My Project
OSoLWriter.cpp
Go to the documentation of this file.
1
17#define DEBUG
18
19#include "OSoLWriter.h"
20#include "OSOption.h"
21#include "OSParameters.h"
22#include "OSCommonUtil.h"
23#include "OSConfig.h"
24#include "OSBase64.h"
25#include "OSMathUtil.h"
26#include <sstream>
27#include <iostream>
28#include <stdio.h>
29
30using std::cout;
31using std::endl;
32using std::ostringstream;
33
35}
36
38}
39
40
41/*char* OSoLWriter::writeOSoLWrap( OSOption *theosoption){
42 std::string sTmp = writeOSoL( theosoption);
43 char *ch;
44 ch = new char[sTmp.size() + 1];
45 strcpy(ch, sTmp.c_str());
46 return ch;
47}
48*/
49
50
51std::string OSoLWriter::writeOSoL( OSOption *theosoption)
52{ m_OSOption = theosoption;
53 std::ostringstream outStr;
54 #ifdef WIN_
55 const char dirsep='\\';
56 #else
57 const char dirsep='/';
58 #endif
59 // Set directory containing stylesheet files.
60 std::string xsltDir;
61 xsltDir = dirsep == '/' ? "../stylesheets/" : "..\\stylesheets\\";
62 // always go with '/' -- it is a hypertext reference
63 xsltDir = "../stylesheets/";
64 if(m_OSOption == NULL) return outStr.str();
65 outStr << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" ;
66 outStr << "<?xml-stylesheet type=\"text/xsl\" href=\"";
67 outStr << xsltDir;
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/";
71 outStr << OS_SCHEMA_VERSION;
72 outStr <<"/OSoL.xsd\" >" ;
73 outStr << endl;
74
78 if(m_OSOption->general != NULL)
79 { outStr << "<general>" << endl;
80 if (m_OSOption->general->serviceURI != "")
81 outStr << "<serviceURI>" << m_OSOption->general->serviceURI << "</serviceURI>" << endl;
82 if (m_OSOption->general->serviceName != "")
83 outStr << "<serviceName>" << m_OSOption->general->serviceName << "</serviceName>" << endl;
85 outStr << "<instanceName>" << m_OSOption->general->instanceName << "</instanceName>" << endl;
88 { outStr << "<instanceLocation>";
89 }
90 else
91 { outStr << "<instanceLocation locationType=\"" << m_OSOption->general->instanceLocation->locationType << "\">";
92 };
93 outStr << m_OSOption->general->instanceLocation->value << "</instanceLocation>" << endl;
94 };
95 if (m_OSOption->general->jobID != "")
96 { outStr << "<jobID>" << m_OSOption->general->jobID << "</jobID>" << endl;
97 };
99 { outStr << "<solverToInvoke>" << m_OSOption->general->solverToInvoke << "</solverToInvoke>" << endl;
100 };
101 if (m_OSOption->general->license != "")
102 { outStr << "<license>" << m_OSOption->general->license << "</license>" << endl;
103 };
104 if (m_OSOption->general->userName != "")
105 { outStr << "<userName>" << m_OSOption->general->userName << "</userName>" << endl;
106 };
107 if (m_OSOption->general->password != "")
108 { outStr << "<password>" << m_OSOption->general->password << "</password>" << endl;
109 };
110 if (m_OSOption->general->contact != NULL)
112 { outStr << "<contact>";
113 }
114 else
115 { outStr << "<contact transportType=\"" << m_OSOption->general->contact->transportType << "\">";
116 };
117 outStr << m_OSOption->general->contact->value << "</contact>" << endl;
118 };
119 if (m_OSOption->general->otherOptions != NULL)
121 { outStr << "<otherOptions numberOfOtherOptions=\"";
122 outStr << m_OSOption->general->otherOptions->numberOfOtherOptions << "\">" << endl;
123 for (int i=0; i < m_OSOption->general->otherOptions->numberOfOtherOptions; i++)
124 { outStr << "<other name=\"" << m_OSOption->general->otherOptions->other[i]->name << "\"";
125 if (m_OSOption->general->otherOptions->other[i]->value != "")
126 outStr << " value=\"" << m_OSOption->general->otherOptions->other[i]->value << "\"";
128 outStr << " description=\"" << m_OSOption->general->otherOptions->other[i]->description << "\"";
129 outStr << "/>" << endl;
130 }
131 outStr << "</otherOptions>" << endl;
132 }
133 }
134 outStr << "</general>" << endl;
135// cout << "Done with <general> element" << endl;
136 };
137
141 if(m_OSOption->system != NULL)
142 { outStr << "<system>" << endl;
143 if (m_OSOption->system->minDiskSpace != NULL)
144 { if (m_OSOption->system->minDiskSpace->unit == "")
146 outStr << "<minDiskSpace unit=\"" << m_OSOption->system->minDiskSpace->unit << "\">";
147 outStr << os_dtoa_format(m_OSOption->system->minDiskSpace->value) << "</minDiskSpace>" << endl;
148 }
149 if (m_OSOption->system->minMemorySize != NULL)
150 { if (m_OSOption->system->minMemorySize->unit == "")
152 outStr << "<minMemorySize unit=\"" << m_OSOption->system->minMemorySize->unit << "\">";
153 outStr << os_dtoa_format(m_OSOption->system->minMemorySize->value) << "</minMemorySize>" << endl;
154 }
155 if (m_OSOption->system->minCPUSpeed != NULL)
156 { if (m_OSOption->system->minCPUSpeed->unit == "")
157 m_OSOption->system->minCPUSpeed->unit = "hertz";
158 outStr << "<minCPUSpeed unit=\"" << m_OSOption->system->minCPUSpeed->unit << "\">";
159 outStr << os_dtoa_format(m_OSOption->system->minCPUSpeed->value) << "</minCPUSpeed>" << endl;
160 }
161 if (m_OSOption->system->minCPUNumber != 1.0)
162 { outStr << "<minCPUNumber>" << m_OSOption->system->minCPUNumber << "</minCPUNumber>";
163 };
164 if (m_OSOption->system->otherOptions != NULL)
166 { outStr << "<otherOptions numberOfOtherOptions=\"";
167 outStr << m_OSOption->system->otherOptions->numberOfOtherOptions << "\">" << endl;
168 for (int i=0; i < m_OSOption->system->otherOptions->numberOfOtherOptions; i++)
169 { outStr << "<other name=\"" << m_OSOption->system->otherOptions->other[i]->name << "\"";
170 if (m_OSOption->system->otherOptions->other[i]->value != "")
171 outStr << " value=\"" << m_OSOption->system->otherOptions->other[i]->value << "\"";
173 outStr << " description=\"" << m_OSOption->system->otherOptions->other[i]->description << "\"";
174 outStr << "/>" << endl;
175 }
176 outStr << "</otherOptions>" << endl;
177 }
178 }
179 outStr << "</system>" << endl;
180 cout << "Done with <system> element" << endl;
181 };
182
186 if(m_OSOption->service != NULL)
187 { outStr << "<service>" << endl;
188 if (m_OSOption->service->type != "")
189 { outStr << "<type>" << m_OSOption->service->type << "</type>" << endl;
190 };
191 if (m_OSOption->service->otherOptions != NULL)
193 { outStr << "<otherOptions numberOfOtherOptions=\"";
194 outStr << m_OSOption->service->otherOptions->numberOfOtherOptions << "\">" << endl;
195 for (int i=0; i < m_OSOption->service->otherOptions->numberOfOtherOptions; i++)
196 { outStr << "<other name=\"" << m_OSOption->service->otherOptions->other[i]->name << "\"";
197 if (m_OSOption->service->otherOptions->other[i]->value != "")
198 outStr << " value=\"" << m_OSOption->service->otherOptions->other[i]->value << "\"";
200 outStr << " description=\"" << m_OSOption->service->otherOptions->other[i]->description << "\"";
201 outStr << "/>" << endl;
202 }
203 outStr << "</otherOptions>" << endl;
204 }
205 }
206 outStr << "</service>" << endl;
207 cout << "Done with <service> element" << endl;
208 };
209
213 if(m_OSOption->job != NULL)
214 { outStr << "<job>" << endl;
215 if (m_OSOption->job->maxTime != NULL)
216 { if (m_OSOption->job->maxTime->unit == "")
217 m_OSOption->job->maxTime->unit = "second";
218 outStr << "<maxTime unit=\"" << m_OSOption->job->maxTime->unit << "\">";
220 outStr << "INF" << "</maxTime>" << endl;
221 else
222 outStr << os_dtoa_format(m_OSOption->job->maxTime->value) << "</maxTime>" << endl;
223 }
225 outStr << "<requestedStartTime>" << m_OSOption->job->requestedStartTime << "</requestedStartTime>" << endl;
226 if (m_OSOption->job->dependencies != NULL)
228 { outStr << "<dependencies numberOfJobIDs=\"";
229 outStr << m_OSOption->job->dependencies->numberOfJobIDs << "\">" << endl;
230 for (int i=0; i < m_OSOption->job->dependencies->numberOfJobIDs; i++)
231 { outStr << "<jobID>" << m_OSOption->job->dependencies->jobID[i] << "</jobID>" << endl;
232 }
233 outStr << "</dependencies>" << endl;
234 }
235 }
236 if (m_OSOption->job->requiredDirectories != NULL)
238 { outStr << "<requiredDirectories numberOfPaths=\"";
239 outStr << m_OSOption->job->requiredDirectories->numberOfPaths << "\">" << endl;
240 for (int i=0; i < m_OSOption->job->requiredDirectories->numberOfPaths; i++)
241 outStr << "<path>" << m_OSOption->job->requiredDirectories->path[i] << "</path>" << endl;
242 outStr << "</requiredDirectories>" << endl;
243 }
244 }
245 if (m_OSOption->job->requiredFiles != NULL)
247 { outStr << "<requiredFiles numberOfPaths=\"";
248 outStr << m_OSOption->job->requiredFiles->numberOfPaths << "\">" << endl;
249 for (int i=0; i < m_OSOption->job->requiredFiles->numberOfPaths; i++)
250 outStr << "<path>" << m_OSOption->job->requiredFiles->path[i] << "</path>" << endl;
251 outStr << "</requiredFiles>" << endl;
252 }
253 }
254 if (m_OSOption->job->directoriesToMake != NULL)
256 { outStr << "<directoriesToMake numberOfPaths=\"";
257 outStr << m_OSOption->job->directoriesToMake->numberOfPaths << "\">" << endl;
258 for (int i=0; i < m_OSOption->job->directoriesToMake->numberOfPaths; i++)
259 outStr << "<path>" << m_OSOption->job->directoriesToMake->path[i] << "</path>" << endl;
260 outStr << "</directoriesToMake>" << endl;
261 }
262 }
263 if (m_OSOption->job->filesToMake != NULL)
265 { outStr << "<filesToMake numberOfPaths=\"";
266 outStr << m_OSOption->job->filesToMake->numberOfPaths << "\">" << endl;
267 for (int i=0; i < m_OSOption->job->filesToMake->numberOfPaths; i++)
268 outStr << "<path>" << m_OSOption->job->filesToMake->path[i] << "</path>" << endl;
269 outStr << "</filesToMake>" << endl;
270 }
271 }
274 { outStr << "<inputDirectoriesToMove numberOfPathPairs=\"";
275 outStr << m_OSOption->job->inputDirectoriesToMove->numberOfPathPairs << "\">" << endl;
276 for (int i=0; i < m_OSOption->job->inputDirectoriesToMove->numberOfPathPairs; i++)
277 { outStr << "<pathPair";
278 outStr << " from=\"" << m_OSOption->job->inputDirectoriesToMove->pathPair[i]->from << "\"";
279 outStr << " to=\"" << m_OSOption->job->inputDirectoriesToMove->pathPair[i]->to << "\"";
281 outStr << " makeCopy=\"true\"";
282 outStr << "/>" << endl;
283 }
284 outStr << "</inputDirectoriesToMove>" << endl;
285 }
286 }
287 if (m_OSOption->job->inputFilesToMove != NULL)
289 { outStr << "<inputFilesToMove numberOfPathPairs=\"";
290 outStr << m_OSOption->job->inputFilesToMove->numberOfPathPairs << "\">" << endl;
291 for (int i=0; i < m_OSOption->job->inputFilesToMove->numberOfPathPairs; i++)
292 { outStr << "<pathPair";
293 outStr << " from=\"" << m_OSOption->job->inputFilesToMove->pathPair[i]->from << "\"";
294 outStr << " to=\"" << m_OSOption->job->inputFilesToMove->pathPair[i]->to << "\"";
296 outStr << " makeCopy=\"true\"";
297 outStr << "/>" << endl;
298 }
299 outStr << "</inputFilesToMove>" << endl;
300 }
301 }
302 if (m_OSOption->job->outputFilesToMove != NULL)
304 { outStr << "<outputFilesToMove numberOfPathPairs=\"";
305 outStr << m_OSOption->job->outputFilesToMove->numberOfPathPairs << "\">" << endl;
306 for (int i=0; i < m_OSOption->job->outputFilesToMove->numberOfPathPairs; i++)
307 { outStr << "<pathPair";
308 outStr << " from=\"" << m_OSOption->job->outputFilesToMove->pathPair[i]->from << "\"";
309 outStr << " to=\"" << m_OSOption->job->outputFilesToMove->pathPair[i]->to << "\"";
311 outStr << " makeCopy=\"true\"";
312 outStr << "/>" << endl;
313 }
314 outStr << "</outputFilesToMove>" << endl;
315 }
316 }
319 { outStr << "<outputDirectoriesToMove numberOfPathPairs=\"";
320 outStr << m_OSOption->job->outputDirectoriesToMove->numberOfPathPairs << "\">" << endl;
322 { outStr << "<pathPair";
323 outStr << " from=\"" << m_OSOption->job->outputDirectoriesToMove->pathPair[i]->from << "\"";
324 outStr << " to=\"" << m_OSOption->job->outputDirectoriesToMove->pathPair[i]->to << "\"";
326 outStr << " makeCopy=\"true\"";
327 outStr << "/>" << endl;
328 }
329 outStr << "</outputDirectoriesToMove>" << endl;
330 }
331 }
332 if (m_OSOption->job->filesToDelete != NULL)
334 { outStr << "<filesToDelete numberOfPaths=\"";
335 outStr << m_OSOption->job->filesToDelete->numberOfPaths << "\">" << endl;
336 for (int i=0; i < m_OSOption->job->filesToDelete->numberOfPaths; i++)
337 outStr << "<path>" << m_OSOption->job->filesToDelete->path[i] << "</path>" << endl;
338 outStr << "</filesToDelete>" << endl;
339 }
340 }
341 if (m_OSOption->job->directoriesToDelete != NULL)
343 { outStr << "<directoriesToDelete numberOfPaths=\"";
344 outStr << m_OSOption->job->directoriesToDelete->numberOfPaths << "\">" << endl;
345 for (int i=0; i < m_OSOption->job->directoriesToDelete->numberOfPaths; i++)
346 outStr << "<path>" << m_OSOption->job->directoriesToDelete->path[i] << "</path>" << endl;
347 outStr << "</directoriesToDelete>" << endl;
348 }
349 }
350 if (m_OSOption->job->processesToKill != NULL)
352 { outStr << "<processesToKill numberOfProcesses=\"";
353 outStr << m_OSOption->job->processesToKill->numberOfProcesses << "\">" << endl;
354 for (int i=0; i < m_OSOption->job->processesToKill->numberOfProcesses; i++)
355 outStr << "<process>" << m_OSOption->job->processesToKill->process[i] << "</process>" << endl;
356 outStr << "</processesToKill>" << endl;
357 }
358 }
359 if (m_OSOption->job->otherOptions != NULL)
361 { outStr << "<otherOptions numberOfOtherOptions=\"";
362 outStr << m_OSOption->job->otherOptions->numberOfOtherOptions << "\">" << endl;
363 for (int i=0; i < m_OSOption->job->otherOptions->numberOfOtherOptions; i++)
364 { outStr << "<other name=\"" << m_OSOption->job->otherOptions->other[i]->name << "\"";
365 if (m_OSOption->job->otherOptions->other[i]->value != "")
366 outStr << " value=\"" << m_OSOption->job->otherOptions->other[i]->value << "\"";
368 outStr << " description=\"" << m_OSOption->job->otherOptions->other[i]->description << "\"";
369 outStr << "/>" << endl;
370 }
371 outStr << "</otherOptions>" << endl;
372 }
373 }
374 outStr << "</job>" << endl;
375 cout << "Done with <job> element" << endl;
376 };
377
381 if (m_OSOption->optimization != NULL)
382 { outStr << "<optimization";
383 outStr << " numberOfVariables=\"" << m_OSOption->optimization->numberOfVariables << "\" ";
384 outStr << " numberOfObjectives=\"" << m_OSOption->optimization->numberOfObjectives << "\" ";
385 outStr << " numberOfConstraints=\"" << m_OSOption->optimization->numberOfConstraints << "\" ";
386 outStr << ">" << endl;
387 if (m_OSOption->optimization->variables != NULL)
388 { outStr << "<variables";
390 outStr << " numberOfOtherVariableOptions=\"" << m_OSOption->optimization->variables->numberOfOtherVariableOptions << "\"";
391 outStr << ">" << endl;
392#ifdef DEBUG
393 cout << "initialVariableValues: " << (m_OSOption->optimization->variables->initialVariableValues != NULL) << endl;
394#endif
396 { outStr << "<initialVariableValues numberOfVar=\"";
399 { outStr << "<var";
400 outStr << " idx=\"" << m_OSOption->optimization->variables->initialVariableValues->var[i]->idx << "\"";
402 { outStr << " value=\"";
404 outStr << "INF";
406 outStr << "-INF";
407 else
409 }
410 outStr << "\"/>" << endl;
411 }
412 outStr << "</initialVariableValues>" << endl;
413 }
414#ifdef DEBUG
415 cout << "initialVariableValuesString: " << (m_OSOption->optimization->variables->initialVariableValuesString != NULL) << endl;
416#endif
418 { outStr << "<initialVariableValuesString numberOfVar=\"";
421 { outStr << "<var";
422 outStr << " idx=\"" << m_OSOption->optimization->variables->initialVariableValuesString->var[i]->idx << "\"";
423 outStr << " value=\"" << m_OSOption->optimization->variables->initialVariableValuesString->var[i]->value << "\"";
424 outStr << "/>" << endl;
425 }
426 outStr << "</initialVariableValuesString>" << endl;
427 }
428#ifdef DEBUG
429 cout << "initialBasisStatus: " << (m_OSOption->optimization->variables->initialBasisStatus != NULL) << endl;
430#endif
432 { outStr << "<initialBasisStatus numberOfVar=\"";
433 outStr << m_OSOption->optimization->variables->initialBasisStatus->numberOfVar << "\">" << endl;
434 for (int i=0; i < m_OSOption->optimization->variables->initialBasisStatus->numberOfVar; i++)
435 { outStr << "<var";
436 outStr << " idx=\"" << m_OSOption->optimization->variables->initialBasisStatus->var[i]->idx << "\"";
437 outStr << " value=\"" << m_OSOption->optimization->variables->initialBasisStatus->var[i]->value << "\"";
438 outStr << "/>" << endl;
439 }
440 outStr << "</initialBasisStatus>" << endl;
441 }
442#ifdef DEBUG
443 cout << "integerVariableBranchingWeights: " << (m_OSOption->optimization->variables->integerVariableBranchingWeights != NULL) << endl;
444#endif
446 { outStr << "<integerVariableBranchingWeights numberOfVar=\"";
449 { outStr << "<var";
450 outStr << " idx=\"" << m_OSOption->optimization->variables->integerVariableBranchingWeights->var[i]->idx << "\"";
452 outStr << "/>" << endl;
453 }
454 outStr << "</integerVariableBranchingWeights>" << endl;
455 }
456#ifdef DEBUG
457 cout << "sosVariableBranchingWeights: " << (m_OSOption->optimization->variables->sosVariableBranchingWeights != NULL) << endl;
458#endif
460 { outStr << "<sosVariableBranchingWeights numberOfSOS=\"";
461#ifdef DEBUG
462 cout << "start: numberOfSOS" << endl;
463#endif
466 { outStr << "<sos";
467#ifdef DEBUG
468 cout << "sosIdx - nvar: " << m_OSOption->optimization->variables->sosVariableBranchingWeights->sos[i]->numberOfVar << endl;
469#endif
470 outStr << " sosIdx=\"" << m_OSOption->optimization->variables->sosVariableBranchingWeights->sos[i]->sosIdx << "\"";
471 outStr << " numberOfVar=\"" << m_OSOption->optimization->variables->sosVariableBranchingWeights->sos[i]->numberOfVar << "\"";
472 outStr << " groupWeight=\"" << os_dtoa_format(m_OSOption->optimization->variables->sosVariableBranchingWeights->sos[i]->groupWeight) << "\">" << endl;
474 { outStr << "<var";
475#ifdef DEBUG
476 cout << "idx" << endl;
477#endif
478 outStr << " idx=\"" << m_OSOption->optimization->variables->sosVariableBranchingWeights->sos[i]->var[j]->idx << "\"";
479 outStr << " value=\"" << os_dtoa_format(m_OSOption->optimization->variables->sosVariableBranchingWeights->sos[i]->var[j]->value) << "\"";
480 outStr << "/>" << endl;
481 }
482 outStr << "</sos>" << endl;
483 }
484 outStr << "</sosVariableBranchingWeights>" << endl;
485 }
486#ifdef DEBUG
487 printf("\n%s%d\n","Number of other variable options: ",m_OSOption->optimization->variables->numberOfOtherVariableOptions);
488#endif
491 { outStr << "<other name=\"" << m_OSOption->optimization->variables->other[i]->name << "\"";
492#ifdef DEBUG
493 cout << "option " << i << ":" << endl;
494 cout << " numberOfVar \'" << m_OSOption->optimization->variables->other[i]->numberOfVar << "\'" << endl;
495 cout << " value \'" << m_OSOption->optimization->variables->other[i]->value << "\'" << endl;
496 cout << " solver \'" << m_OSOption->optimization->variables->other[i]->solver << "\'" << endl;
497 cout << " category \'" << m_OSOption->optimization->variables->other[i]->category << "\'" << endl;
498 cout << " type \'" << m_OSOption->optimization->variables->other[i]->type << "\'" << endl;
499 cout << " description \'" << m_OSOption->optimization->variables->other[i]->description << "\'" << endl;
500#endif
501// if (m_OSOption->optimization->variables->other[i]->numberOfVar > 0)
502 outStr << " numberOfVar=\"" << m_OSOption->optimization->variables->other[i]->numberOfVar << "\"";
504 outStr << " value=\"" << m_OSOption->optimization->variables->other[i]->value << "\"";
506 outStr << " solver=\"" << m_OSOption->optimization->variables->other[i]->solver << "\"";
508 outStr << " category=\"" << m_OSOption->optimization->variables->other[i]->category << "\"";
509 if (m_OSOption->optimization->variables->other[i]->type != "")
510 outStr << " type=\"" << m_OSOption->optimization->variables->other[i]->type << "\"";
512 outStr << " description=\"" << m_OSOption->optimization->variables->other[i]->description << "\"";
513 outStr << ">" << endl;
515 for (int j=0; j < m_OSOption->optimization->variables->other[i]->numberOfVar; j++)
516 { outStr << "<var idx=\"" << m_OSOption->optimization->variables->other[i]->var[j]->idx << "\"";
517 if (m_OSOption->optimization->variables->other[i]->var[j]->value != "")
518 outStr << " value=\"" << m_OSOption->optimization->variables->other[i]->var[j]->value << "\"";
519 if (m_OSOption->optimization->variables->other[i]->var[j]->lbValue != "")
520 outStr << " lbValue=\"" << m_OSOption->optimization->variables->other[i]->var[j]->lbValue << "\"";
521 if (m_OSOption->optimization->variables->other[i]->var[j]->ubValue != "")
522 outStr << " ubValue=\"" << m_OSOption->optimization->variables->other[i]->var[j]->ubValue << "\"";
523 outStr << "/>" << endl;
524 }
525 outStr << "</other>" << endl;
526 }
527 outStr << "</variables>" << endl;
528 }
529 if (m_OSOption->optimization->objectives != NULL)
530 { outStr << "<objectives";
532 outStr << " numberOfOtherObjectiveOptions=\"" << m_OSOption->optimization->objectives->numberOfOtherObjectiveOptions << "\"";
533 outStr << ">" << endl;
535 { outStr << "<initialObjectiveValues numberOfObj=\"";
538 { outStr << "<obj";
539 outStr << " idx=\"" << m_OSOption->optimization->objectives->initialObjectiveValues->obj[i]->idx << "\"";
541 { outStr << " value=\"";
543 outStr << "INF";
545 outStr << "-INF";
546 else
548 }
549 outStr << "\"/>" << endl;
550 }
551 outStr << "</initialObjectiveValues>" << endl;
552 }
554 { outStr << "<initialObjectiveBounds numberOfObj=\"";
557 { outStr << "<obj";
558 outStr << " idx=\"" << m_OSOption->optimization->objectives->initialObjectiveBounds->obj[i]->idx << "\"";
559 outStr << " lbValue=\"";
561 outStr << "INF";
563 outStr << "-INF";
564 else
566 outStr << "\" ubValue=\"";
568 outStr << "INF";
570 outStr << "-INF";
571 else
573 outStr << "\"/>" << endl;
574 }
575 outStr << "</initialObjectiveBounds>" << endl;
576 }
577#ifdef DEBUG
578 printf("\n%s%d\n","Number of other objective options: ",m_OSOption->optimization->objectives->numberOfOtherObjectiveOptions);
579#endif
582 { outStr << "<other name=\"" << m_OSOption->optimization->objectives->other[i]->name << "\"";
583#ifdef DEBUG
584 cout << "option " << i << ":" << endl;
585 cout << " numberOfObj \'" << m_OSOption->optimization->objectives->other[i]->numberOfObj << "\'" << endl;
586 cout << " value \'" << m_OSOption->optimization->objectives->other[i]->value << "\'" << endl;
587 cout << " solver \'" << m_OSOption->optimization->objectives->other[i]->solver << "\'" << endl;
588 cout << " category \'" << m_OSOption->optimization->objectives->other[i]->category << "\'" << endl;
589 cout << " type \'" << m_OSOption->optimization->objectives->other[i]->type << "\'" << endl;
590 cout << " description \'" << m_OSOption->optimization->objectives->other[i]->description << "\'" << endl;
591#endif
592
593// if (m_OSOption->optimization->objectives->other[i]->numberOfObj > 0)
594 outStr << " numberOfObj=\"" << m_OSOption->optimization->objectives->other[i]->numberOfObj << "\"";
596 outStr << " value=\"" << m_OSOption->optimization->objectives->other[i]->value << "\"";
598 outStr << " solver=\"" << m_OSOption->optimization->objectives->other[i]->solver << "\"";
600 outStr << " category=\"" << m_OSOption->optimization->objectives->other[i]->category << "\"";
602 outStr << " type=\"" << m_OSOption->optimization->objectives->other[i]->type << "\"";
604 outStr << " description=\"" << m_OSOption->optimization->objectives->other[i]->description << "\"";
605 outStr << ">" << endl;
607 for (int j=0; j < m_OSOption->optimization->objectives->other[i]->numberOfObj; j++)
608 { outStr << "<var idx=\"" << m_OSOption->optimization->objectives->other[i]->obj[j]->idx << "\"";
609 if (m_OSOption->optimization->objectives->other[i]->obj[j]->value != "")
610 outStr << " value=\"" << m_OSOption->optimization->objectives->other[i]->obj[j]->value << "\"";
611 outStr << "/>" << endl;
612 }
613 outStr << "</other>" << endl;
614 }
615 outStr << "</objectives>" << endl;
616 }
617 if (m_OSOption->optimization->constraints != NULL)
618 { outStr << "<constraints";
620 outStr << " numberOfOtherConstraintOptions=\"" << m_OSOption->optimization->constraints->numberOfOtherConstraintOptions << "\"";
621 outStr << ">" << endl;
623 { outStr << "<initialConstraintValues numberOfCon=\"";
626 { outStr << "<con";
627 outStr << " idx=\"" << m_OSOption->optimization->constraints->initialConstraintValues->con[i]->idx << "\"";
629 { outStr << " value=\"";
631 outStr << "INF";
633 outStr << "-INF";
634 else
636 }
637 outStr << "\"/>" << endl;
638 }
639 outStr << "</initialConstraintValues>" << endl;
640 }
642 { outStr << "<initialDualValues numberOfCon=\"";
643 outStr << m_OSOption->optimization->constraints->initialDualValues->numberOfCon << "\">" << endl;
645 { outStr << "<con";
646 outStr << " idx=\"" << m_OSOption->optimization->constraints->initialDualValues->con[i]->idx << "\"";
647 outStr << " lbDualValue=\"";
649 outStr << "INF";
651 outStr << "-INF";
652 else
654 outStr << "\" ubDualValue=\"";
656 outStr << "INF";
658 outStr << "-INF";
659 else
661 outStr << "\"/>" << endl;
662 }
663 outStr << "</initialDualValues>" << endl;
664 }
665#ifdef DEBUG
666 printf("\n%s%d\n","Number of other constraint options: ",m_OSOption->optimization->constraints->numberOfOtherConstraintOptions);
667#endif
670 { outStr << "<other name=\"" << m_OSOption->optimization->constraints->other[i]->name << "\"";
671#ifdef DEBUG
672 cout << "option " << i << ":" << endl;
673 cout << " numberOfCon \'" << m_OSOption->optimization->constraints->other[i]->numberOfCon << "\'" << endl;
674 cout << " value \'" << m_OSOption->optimization->constraints->other[i]->value << "\'" << endl;
675 cout << " solver \'" << m_OSOption->optimization->constraints->other[i]->solver << "\'" << endl;
676 cout << " category \'" << m_OSOption->optimization->constraints->other[i]->category << "\'" << endl;
677 cout << " type \'" << m_OSOption->optimization->constraints->other[i]->type << "\'" << endl;
678 cout << " description \'" << m_OSOption->optimization->constraints->other[i]->description << "\'" << endl;
679#endif
680
681// if (m_OSOption->optimization->constraints->other[i]->numberOfCon > 0)
682 outStr << " numberOfCon=\"" << m_OSOption->optimization->constraints->other[i]->numberOfCon << "\"";
684 outStr << " value=\"" << m_OSOption->optimization->constraints->other[i]->value << "\"";
686 outStr << " solver=\"" << m_OSOption->optimization->constraints->other[i]->solver << "\"";
688 outStr << " category=\"" << m_OSOption->optimization->constraints->other[i]->category << "\"";
690 outStr << " type=\"" << m_OSOption->optimization->constraints->other[i]->type << "\"";
692 outStr << " description=\"" << m_OSOption->optimization->constraints->other[i]->description << "\"";
693 outStr << ">" << endl;
695 for (int j=0; j < m_OSOption->optimization->constraints->other[i]->numberOfCon; j++)
696 { outStr << "<con idx=\"" << m_OSOption->optimization->constraints->other[i]->con[j]->idx << "\"";
697 if (m_OSOption->optimization->constraints->other[i]->con[j]->value != "")
698 outStr << " value=\"" << m_OSOption->optimization->constraints->other[i]->con[j]->value << "\"";
699 if (m_OSOption->optimization->constraints->other[i]->con[j]->lbValue != "")
700 outStr << " lbValue=\"" << m_OSOption->optimization->constraints->other[i]->con[j]->lbValue << "\"";
701 if (m_OSOption->optimization->constraints->other[i]->con[j]->ubValue != "")
702 outStr << " ubValue=\"" << m_OSOption->optimization->constraints->other[i]->con[j]->ubValue << "\"";
703 outStr << "/>" << endl;
704 }
705 outStr << "</other>" << endl;
706 }
707 outStr << "</constraints>" << endl;
708 }
711 { outStr << "<solverOptions numberOfSolverOptions=\"";
712 outStr << m_OSOption->optimization->solverOptions->numberOfSolverOptions << "\">" << endl;
714 { outStr << "<solverOption name=\"" << m_OSOption->optimization->solverOptions->solverOption[i]->name << "\"";
716 outStr << " value=\"" << m_OSOption->optimization->solverOptions->solverOption[i]->value << "\"";
718 outStr << " solver=\"" << m_OSOption->optimization->solverOptions->solverOption[i]->solver << "\"";
720 outStr << " category=\"" << m_OSOption->optimization->solverOptions->solverOption[i]->category << "\"";
722 outStr << " type=\"" << m_OSOption->optimization->solverOptions->solverOption[i]->type << "\"";
724 outStr << " description=\"" << m_OSOption->optimization->solverOptions->solverOption[i]->description << "\"";
725 outStr << "/>" << endl;
726 }
727 outStr << "</solverOptions>" << endl;
728 }
729 }
730 outStr << "</optimization>" << endl;
731 };
732 outStr << "</osol>" << endl;
733 return outStr.str();
734}// end writeOSoL
735
736
737
std::string os_dtoa_format(double x)
double value
branching weight
Definition OSOption.h:1622
int idx
index of the variable
Definition OSOption.h:1616
std::string unit
the unit in which CPU speed is measured
Definition OSGeneral.h:817
double value
the CPU speed (expressed in multiples of unit)
Definition OSGeneral.h:823
InitConstraintValues * initialConstraintValues
initial values for the constraints
Definition OSOption.h:3271
InitDualVariableValues * initialDualValues
initial dual values for the constraints
Definition OSOption.h:3274
OtherConstraintOption ** other
other information about the constraints
Definition OSOption.h:3280
int numberOfOtherConstraintOptions
number of <other> child elements
Definition OSOption.h:3268
std::string value
the value of the <contact> element
Definition OSOption.h:104
std::string transportType
the contact mechanism
Definition OSOption.h:101
int numberOfPaths
the number of <path> children
Definition OSOption.h:785
std::string * path
the list of directory and file paths
Definition OSOption.h:788
OtherOptions * otherOptions
the list of other general options
Definition OSOption.h:320
InstanceLocationOption * instanceLocation
the location of the instance
Definition OSOption.h:299
std::string license
the license information
Definition OSOption.h:308
std::string serviceURI
the service URI
Definition OSOption.h:290
std::string serviceName
the name of the service
Definition OSOption.h:293
std::string jobID
the job ID
Definition OSOption.h:302
std::string userName
the username
Definition OSOption.h:311
std::string instanceName
the name of the instance
Definition OSOption.h:296
std::string solverToInvoke
the solver to invoke
Definition OSOption.h:305
std::string password
the password
Definition OSOption.h:314
ContactOption * contact
the contact method
Definition OSOption.h:317
double value
initial value
Definition OSOption.h:2774
int idx
constraint index
Definition OSOption.h:2768
InitConValue ** con
initial value for each constraint
Definition OSOption.h:2830
int numberOfCon
number of <con> children
Definition OSOption.h:2827
int idx
constraint index
Definition OSOption.h:2929
double ubDualValue
initial upper bound
Definition OSOption.h:2938
double lbDualValue
initial lower bound
Definition OSOption.h:2935
int numberOfCon
number of <con> children
Definition OSOption.h:2992
InitDualVarValue ** con
initial dual values for each constraint
Definition OSOption.h:2995
double lbValue
initial lower bound
Definition OSOption.h:2354
int idx
objective index
Definition OSOption.h:2348
double ubValue
initial upper bound
Definition OSOption.h:2357
double value
initial value
Definition OSOption.h:2193
int idx
objective index
Definition OSOption.h:2187
InitObjBound ** obj
initial bounds for each objective
Definition OSOption.h:2413
int numberOfObj
number of <obj> children
Definition OSOption.h:2410
InitObjValue ** obj
initial value for each objective
Definition OSOption.h:2249
int numberOfObj
number of <obj> children
Definition OSOption.h:2246
double value
initial value
Definition OSOption.h:1170
int idx
variable index
Definition OSOption.h:1164
std::string value
initial value
Definition OSOption.h:1331
int idx
variable index
Definition OSOption.h:1325
InitVarValue ** var
initial value for each variable
Definition OSOption.h:1226
int numberOfVar
number of children
Definition OSOption.h:1223
InitVarValueString ** var
initial value for each variable
Definition OSOption.h:1387
int numberOfVar
number of children
Definition OSOption.h:1384
std::string value
the value of the <instanceLocation> element
Definition OSOption.h:47
std::string locationType
the type of the location
Definition OSOption.h:44
BranchingWeight ** var
branching weight for each variable
Definition OSOption.h:1679
int numberOfVar
number of children
Definition OSOption.h:1676
std::string * jobID
the list of job IDs
Definition OSOption.h:717
int numberOfJobIDs
the number of entries in the list of job dependencies
Definition OSOption.h:714
Processes * processesToKill
processes to kill upon completion
Definition OSOption.h:1108
DirectoriesAndFiles * requiredDirectories
directories required to run the job
Definition OSOption.h:1078
DirectoriesAndFiles * filesToMake
files to make during the job
Definition OSOption.h:1087
DirectoriesAndFiles * directoriesToDelete
directories to delete upon completion
Definition OSOption.h:1105
std::string requestedStartTime
the requested time to start the job
Definition OSOption.h:1072
DirectoriesAndFiles * requiredFiles
files required to run the job
Definition OSOption.h:1081
DirectoriesAndFiles * filesToDelete
files to delete upon completion
Definition OSOption.h:1102
JobDependencies * dependencies
the dependency set
Definition OSOption.h:1075
PathPairs * inputFilesToMove
input files to move or copy
Definition OSOption.h:1093
TimeSpan * maxTime
the maximum time allowed
Definition OSOption.h:1069
PathPairs * outputDirectoriesToMove
output directories to move or copy
Definition OSOption.h:1099
PathPairs * inputDirectoriesToMove
input directories to move or copy
Definition OSOption.h:1090
PathPairs * outputFilesToMove
output files to move or copy
Definition OSOption.h:1096
DirectoriesAndFiles * directoriesToMake
directories to make during the job
Definition OSOption.h:1084
OtherOptions * otherOptions
list of other job options
Definition OSOption.h:1111
The Option Class.
Definition OSOption.h:3565
OptimizationOption * optimization
optimizationOption holds the fifth child of the OSOption specified by the OSoL Schema.
Definition OSOption.h:3596
GeneralOption * general
generalOption holds the first child of the OSOption specified by the OSoL Schema.
Definition OSOption.h:3580
ServiceOption * service
serviceOption holds the third child of the OSOption specified by the OSoL Schema.
Definition OSOption.h:3588
SystemOption * system
systemOption holds the second child of the OSOption specified by the OSoL Schema.
Definition OSOption.h:3584
JobOption * job
jobOption holds the fourth child of the OSOption specified by the OSoL Schema.
Definition OSOption.h:3592
std::string writeOSoL(OSOption *theosoption)
create an osol string from an OSOption object
OSoLWriter()
Default constructor.
~OSoLWriter()
Class destructor.
const OSOption * m_OSOption
m_OSOption is an object in the class OSOption
Definition OSoLWriter.h:35
int numberOfOtherObjectiveOptions
number of <other> child elements
Definition OSOption.h:2686
OtherObjectiveOption ** other
other information about the objectives
Definition OSOption.h:2698
InitObjectiveValues * initialObjectiveValues
initial values for the objectives
Definition OSOption.h:2689
InitObjectiveBounds * initialObjectiveBounds
initial bounds for the objectives
Definition OSOption.h:2692
VariableOption * variables
the options for the variables
Definition OSOption.h:3509
int numberOfConstraints
the number of constraints
Definition OSOption.h:3506
ObjectiveOption * objectives
the options for the objectives
Definition OSOption.h:3512
SolverOptions * solverOptions
other solver options
Definition OSOption.h:3518
ConstraintOption * constraints
the options for the constraints
Definition OSOption.h:3515
int numberOfObjectives
the number of objectives
Definition OSOption.h:3503
int numberOfVariables
the number of variables
Definition OSOption.h:3500
std::string lbValue
lower bound of the option
Definition OSOption.h:3105
std::string ubValue
upper bound of the option
Definition OSOption.h:3108
int idx
variable index
Definition OSOption.h:3096
std::string value
value of the option
Definition OSOption.h:3102
std::string category
name of the category into which this option falls
Definition OSOption.h:3176
std::string name
name of the option
Definition OSOption.h:3167
int numberOfCon
number of <con> children
Definition OSOption.h:3161
OtherConOption ** con
array of option values
Definition OSOption.h:3185
std::string type
type of the option value (integer, double, boolean, string)
Definition OSOption.h:3179
std::string description
description of the option
Definition OSOption.h:3182
std::string solver
name of the solver to which this option applies
Definition OSOption.h:3173
std::string value
value of the option
Definition OSOption.h:3170
int idx
variable index
Definition OSOption.h:2514
std::string value
value of the option
Definition OSOption.h:2520
OtherObjOption ** obj
array of option values
Definition OSOption.h:2603
int numberOfObj
number of <obj> children
Definition OSOption.h:2579
std::string name
name of the option
Definition OSOption.h:2585
std::string value
value of the option
Definition OSOption.h:2588
std::string solver
name of the solver to which this option applies
Definition OSOption.h:2591
std::string category
name of the category into which this option falls
Definition OSOption.h:2594
std::string type
type of the option value (integer, double, boolean, string)
Definition OSOption.h:2597
std::string description
description of the option
Definition OSOption.h:2600
std::string value
the value of the option
Definition OSOption.h:160
std::string description
the description of the option
Definition OSOption.h:163
std::string name
the name of the option
Definition OSOption.h:157
OtherOption ** other
the list of other options
Definition OSOption.h:219
int numberOfOtherOptions
the number of other options
Definition OSOption.h:216
std::string value
value of the option
Definition OSOption.h:1938
std::string ubValue
lower bound on the value
Definition OSOption.h:1944
int idx
variable index
Definition OSOption.h:1932
std::string lbValue
lower bound on the value
Definition OSOption.h:1941
int numberOfVar
number of child elements
Definition OSOption.h:1994
std::string type
type of the option value (integer, double, boolean, string)
Definition OSOption.h:2012
std::string name
name of the option
Definition OSOption.h:2000
std::string solver
name of the solver to which this option applies
Definition OSOption.h:2006
std::string category
name of the category into which this option falls
Definition OSOption.h:2009
OtherVarOption ** var
array of option values
Definition OSOption.h:2018
std::string description
description of the option
Definition OSOption.h:2015
std::string value
value of the option
Definition OSOption.h:2003
std::string from
the file or directory to move/copy from
Definition OSOption.h:856
bool makeCopy
record whether a copy is to be made
Definition OSOption.h:862
std::string to
the file or directory to move/copy to
Definition OSOption.h:859
PathPair ** pathPair
the list of directory and file paths
Definition OSOption.h:918
int numberOfPathPairs
the number of <path> children
Definition OSOption.h:915
std::string * process
the list of processes
Definition OSOption.h:1001
int numberOfProcesses
the number of <process> children
Definition OSOption.h:998
SOSWeights ** sos
branching weights for the SOS
Definition OSOption.h:1861
int numberOfSOS
number of <sos> children
Definition OSOption.h:1858
BranchingWeight ** var
branching weights for individual variables
Definition OSOption.h:1789
int sosIdx
index of the SOS (to match the OSiL file)
Definition OSOption.h:1780
int numberOfVar
number of children
Definition OSOption.h:1786
double groupWeight
branching weight for the entire SOS
Definition OSOption.h:1783
std::string type
the service type
Definition OSOption.h:615
OtherOptions * otherOptions
the list of other service options
Definition OSOption.h:618
std::string value
the value of the option
Definition OSOption.h:3352
std::string solver
the solver to which the option applies
Definition OSOption.h:3355
std::string description
the description of the option
Definition OSOption.h:3364
std::string type
the type of the option value (integer, double, boolean, string)
Definition OSOption.h:3361
std::string category
the category to which the option belongs
Definition OSOption.h:3358
std::string name
the name of the option
Definition OSOption.h:3349
SolverOption ** solverOption
the list of solver options
Definition OSOption.h:3426
int numberOfSolverOptions
the number of solver options
Definition OSOption.h:3423
std::string unit
the unit in which storage capacity is measured
Definition OSGeneral.h:759
double value
the number of units of storage capacity
Definition OSGeneral.h:765
StorageCapacity * minDiskSpace
the minimum disk space required
Definition OSOption.h:550
StorageCapacity * minMemorySize
the minimum memory required
Definition OSOption.h:553
CPUSpeed * minCPUSpeed
the minimum CPU speed required
Definition OSOption.h:556
CPUNumber * minCPUNumber
the minimum number of processors required
Definition OSOption.h:559
OtherOptions * otherOptions
the list of other system options
Definition OSOption.h:562
std::string unit
the unit in which time is measured
Definition OSGeneral.h:929
double value
the number of units
Definition OSGeneral.h:932
BasisStatus * initialBasisStatus
initial basis information
Definition OSOption.h:2110
int numberOfOtherVariableOptions
number of <other> child elements
Definition OSOption.h:2101
InitVariableValuesString * initialVariableValuesString
initial values for string-valued variables
Definition OSOption.h:2107
OtherVariableOption ** other
other variable options
Definition OSOption.h:2119
SOSVariableBranchingWeights * sosVariableBranchingWeights
branching weights for SOS variables and groups
Definition OSOption.h:2116
InitVariableValues * initialVariableValues
initial values for the variables
Definition OSOption.h:2104
IntegerVariableBranchingWeights * integerVariableBranchingWeights
branching weights for integer variables
Definition OSOption.h:2113
#define OS_SCHEMA_VERSION
#define OSNAN
#define OSDBL_MAX