My Project
OSrLWriter.cpp
Go to the documentation of this file.
1/* $Id$ */
15
16
17#include "OSrLWriter.h"
18#include "OSResult.h"
19#include "OSgLWriter.h"
20#include "OSGeneral.h"
21#include "OSStringUtil.h"
22#include "OSParameters.h"
23#include "OSConfig.h"
24#include "OSOutput.h"
25#include "OSBase64.h"
26#include "OSMathUtil.h"
27#include <sstream>
28#include <iostream>
29#include <stdio.h>
30
31using std::endl;
32using std::ostringstream;
33
35{
36 m_bWriteBase64 = false;
37 m_bWhiteSpace = false;
38}
39
43
44
45std::string OSrLWriter::writeOSrL( OSResult *theosresult)
46{
47 m_OSResult = theosresult;
48 std::ostringstream outStr;
49#ifdef WIN_
50 const char dirsep='\\';
51#else
52 const char dirsep='/';
53#endif
54 // Set directory containing stylesheet files.
55 // std::string xsltDir;
56 // xsltDir = dirsep == '/' ? "../stylesheets/" : "..\\stylesheets\\";
57 // always go with '/' -- it is a hypertext reference
58 // xsltDir = "../stylesheets/";
59 // xsltDir = "http://www.coin-or.org/OS/stylesheets/";
60
61 // 31 May 2013 --- HIG
62 // some browsers consider it a security risk to allow remote stylesheets
63 // or even relative addresses containing "../", So we must make sure that
64 // the stylesheet is located in the same directory as the OSrL file
65
66 int i, j;
67 bool generalTagPrinted;
68 bool systemTagPrinted;
69 bool serviceTagPrinted;
70 bool jobTagPrinted;
71#ifndef NDEBUG
73#endif
74
75 if(m_OSResult == NULL) return outStr.str();
76 outStr << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" ;
77 outStr << "<?xml-stylesheet type=\"text/xsl\" href=\"";
78 // outStr << xsltDir;
79 outStr << "OSrL.xslt\"?>";
80 outStr << endl;
81 outStr << "<osrl xmlns=\"os.optimizationservices.org\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" ";
82 outStr << "xsi:schemaLocation=\"os.optimizationservices.org http://www.optimizationservices.org/schemas/";
83 outStr << OS_SCHEMA_VERSION;
84 outStr << "/OSrL.xsd\" >" ;
85 outStr << endl;
86
87#ifndef NDEBUG
88 osoutput->OSPrint(ENUM_OUTPUT_AREA_OSrLwriter, ENUM_OUTPUT_LEVEL_trace, "output <resultHeader>");
89#endif
90 if(m_OSResult->resultHeader != NULL)
91 {
92 if (m_OSResult->resultHeader->name != "" ||
93 m_OSResult->resultHeader->source != "" ||
94 m_OSResult->resultHeader->description != "" ||
95 m_OSResult->resultHeader->fileCreator != "" ||
96 m_OSResult->resultHeader->licence != "" )
97 {
98 outStr << "<resultHeader>" << endl;
99 outStr << writeGeneralFileHeader(m_OSResult->resultHeader, true);
100 outStr << "</resultHeader>" << endl;
101 }
102 }
103
104
105#ifndef NDEBUG
106 osoutput->OSPrint(ENUM_OUTPUT_AREA_OSrLwriter, ENUM_OUTPUT_LEVEL_trace, "output <general>");
107#endif
108 if(m_OSResult->general != NULL)
109 {
110 generalTagPrinted = false;
111 if(m_OSResult->general->generalStatus != NULL)
112 {
113 if (generalTagPrinted == false)
114 {
115 outStr << "<general>" << endl;
116 generalTagPrinted = true;
117 }
118 outStr << "<generalStatus";
119 if(m_OSResult->general->generalStatus->type.length() > 0)
120 {
121 outStr << " type=\"";
122 outStr << m_OSResult->general->generalStatus->type ;
123 outStr << "\"";
124 }
125 if(m_OSResult->general->generalStatus->description.length() > 0)
126 {
127 outStr << " description=";
128 outStr << writeStringData(m_OSResult->general->generalStatus->description);
129 }
130 if (m_OSResult->general->generalStatus->numberOfSubstatuses > 0)
131 {
132 outStr << " numberOfSubstatuses=\"";
133 outStr << m_OSResult->general->generalStatus->numberOfSubstatuses;
134 outStr << "\"";
135 }
136 outStr << ">" << endl;
137 for (int i=0; i < m_OSResult->general->generalStatus->numberOfSubstatuses; i++)
138 {
139 outStr << "<substatus";
140 if (m_OSResult->general->generalStatus->substatus[i]->name.length() > 0)
141 {
142 outStr << " name=\"";
143 outStr << m_OSResult->general->generalStatus->substatus[i]->name ;
144 outStr << "\"";
145 }
146 if (m_OSResult->general->generalStatus->substatus[i]->description.length() > 0)
147 {
148 outStr << " description=\"";
149 outStr << m_OSResult->general->generalStatus->substatus[i]->description ;
150 outStr << "\"";
151 }
152 outStr << "/>" << endl;
153 }
154 outStr << "</generalStatus>" << endl;
155 }
156
157 if(m_OSResult->general->message.length() > 0)
158 {
159 if (generalTagPrinted == false)
160 {
161 outStr << "<general>" << endl;
162 generalTagPrinted = true;
163 }
164 outStr << "<message>" + m_OSResult->general->message + "</message>" << endl;
165 }
166 if(m_OSResult->general->serviceURI.length() > 0)
167 {
168 if (generalTagPrinted == false)
169 {
170 outStr << "<general>" << endl;
171 generalTagPrinted = true;
172 }
173 outStr << "<serviceURI>" + m_OSResult->general->serviceURI + "</serviceURI>" << endl;
174 }
175 if(m_OSResult->general->serviceName.length() > 0)
176 {
177 if (generalTagPrinted == false)
178 {
179 outStr << "<general>" << endl;
180 generalTagPrinted = true;
181 }
182 outStr << "<serviceName>" + m_OSResult->general->serviceName + "</serviceName>" << endl;
183 }
184 if(m_OSResult->general->instanceName.length() > 0)
185 {
186 if (generalTagPrinted == false)
187 {
188 outStr << "<general>" << endl;
189 generalTagPrinted = true;
190 }
191 outStr << "<instanceName>" + m_OSResult->general->instanceName + "</instanceName>" << endl;
192 }
193 if(m_OSResult->general->jobID.length() > 0)
194 {
195 if (generalTagPrinted == false)
196 {
197 outStr << "<general>" << endl;
198 generalTagPrinted = true;
199 }
200 outStr << "<jobID>" + m_OSResult->general->jobID + "</jobID>" << endl;
201 }
202 if(m_OSResult->general->solverInvoked.length() > 0)
203 {
204 if (generalTagPrinted == false)
205 {
206 outStr << "<general>" << endl;
207 generalTagPrinted = true;
208 }
209 outStr << "<solverInvoked>" + m_OSResult->general->solverInvoked + "</solverInvoked>" << endl;
210 }
211 if(m_OSResult->general->timeStamp.length() > 0)
212 {
213 if (generalTagPrinted == false)
214 {
215 outStr << "<general>" << endl;
216 generalTagPrinted = true;
217 }
218 outStr << "<timeStamp>" + m_OSResult->general->timeStamp + "</timeStamp>" << endl;
219 }
220
221 if(m_OSResult->general->otherResults != NULL)
222 {
223 if(m_OSResult->general->otherResults->numberOfOtherResults > 0)
224 {
225 if (generalTagPrinted == false)
226 {
227 outStr << "<general>" << endl;
228 generalTagPrinted = true;
229 }
230 outStr << "<otherResults numberOfOtherResults=\"";
231 outStr << m_OSResult->general->otherResults->numberOfOtherResults;
232 outStr << "\">" << endl;
233 for (int i=0; i < m_OSResult->general->otherResults->numberOfOtherResults; i++)
234 {
235 outStr << "<other";
236 if (m_OSResult->general->otherResults->other[i]->name.length() > 0)
237 {
238 outStr << " name=";
239 outStr << writeStringData(m_OSResult->general->otherResults->other[i]->name);
240 }
241 if (m_OSResult->general->otherResults->other[i]->value.length() > 0)
242 {
243 outStr << " value=";
244 outStr << writeStringData(m_OSResult->general->otherResults->other[i]->value);
245 }
246 if (m_OSResult->general->otherResults->other[i]->description.length() > 0)
247 {
248 outStr << " description=";
249 outStr << writeStringData(m_OSResult->general->otherResults->other[i]->description);
250 }
251 outStr << " />" << endl;
252 }
253 outStr << "</otherResults>" << endl;;
254 }
255 }
256 if (generalTagPrinted == true)
257 outStr << "</general>" << endl;
258 }
259
260
261#ifndef NDEBUG
263#endif
264 if(m_OSResult->system != NULL)
265 {
266 systemTagPrinted = false;
267 if(m_OSResult->system->systemInformation.length() > 0)
268 {
269 if (systemTagPrinted == false)
270 {
271 outStr << "<system>" << endl;
272 systemTagPrinted = true;
273 }
274 outStr << "<systemInformation>" + m_OSResult->system->systemInformation + "</systemInformation>" << endl;
275 }
276
277 if(m_OSResult->system->availableDiskSpace != NULL)
278 {
279 if (systemTagPrinted == false)
280 {
281 outStr << "<system>" << endl;
282 systemTagPrinted = true;
283 }
284 outStr << "<availableDiskSpace";
285 if(m_OSResult->system->availableDiskSpace->unit.length() > 0)
286 {
287 outStr << " unit=\"";
288 outStr << m_OSResult->system->availableDiskSpace->unit;
289 outStr << "\"";
290 }
291 if(m_OSResult->system->availableDiskSpace->description.length() > 0)
292 {
293 outStr << " description=";
294 outStr << writeStringData(m_OSResult->system->availableDiskSpace->description);
295 }
296 outStr << ">";
297 outStr << os_dtoa_format(m_OSResult->system->availableDiskSpace->value);
298 outStr << "</availableDiskSpace>" << endl;
299 }
300
301 if(m_OSResult->system->availableMemory != NULL)
302 {
303 if (systemTagPrinted == false)
304 {
305 outStr << "<system>" << endl;
306 systemTagPrinted = true;
307 }
308 outStr << "<availableMemory";
309 if(m_OSResult->system->availableMemory->unit.length() > 0)
310 {
311 outStr << " unit=\"";
312 outStr << m_OSResult->system->availableMemory->unit;
313 outStr << "\"";
314 }
315 if(m_OSResult->system->availableMemory->description.length() > 0)
316 {
317 outStr << " description=";
318 outStr << writeStringData(m_OSResult->system->availableMemory->description);
319 }
320 outStr << ">";
321 outStr << os_dtoa_format(m_OSResult->system->availableMemory->value);
322 outStr << "</availableMemory>" << endl;
323 }
324
325 if(m_OSResult->system->availableCPUSpeed != NULL)
326 {
327 if (systemTagPrinted == false)
328 {
329 outStr << "<system>" << endl;
330 systemTagPrinted = true;
331 }
332 outStr << "<availableCPUSpeed";
333 if(m_OSResult->system->availableCPUSpeed->unit.length() > 0)
334 {
335 outStr << " unit=\"";
336 outStr << m_OSResult->system->availableCPUSpeed->unit ;
337 outStr << "\"";
338 }
339 if(m_OSResult->system->availableCPUSpeed->description.length() > 0)
340 {
341 outStr << " description=";
342 outStr << writeStringData(m_OSResult->system->availableCPUSpeed->description);
343 }
344 outStr << ">";
345 outStr << os_dtoa_format(m_OSResult->system->availableCPUSpeed->value);
346 outStr << "</availableCPUSpeed>" << endl;
347 }
348
349 if(m_OSResult->system->availableCPUNumber != NULL)
350 {
351 if (systemTagPrinted == false)
352 {
353 outStr << "<system>" << endl;
354 systemTagPrinted = true;
355 }
356 outStr << "<availableCPUNumber";
357 if(m_OSResult->system->availableCPUNumber->description.length() > 0)
358 {
359 outStr << " description=";
360 outStr << writeStringData(m_OSResult->system->availableCPUNumber->description);
361 }
362 outStr << ">";
363 outStr << m_OSResult->system->availableCPUNumber->value;
364 outStr << "</availableCPUNumber>" << endl;
365 }
366
367 if(m_OSResult->system->otherResults != NULL)
368 {
369 if(m_OSResult->system->otherResults->numberOfOtherResults > 0)
370 {
371 if (systemTagPrinted == false)
372 {
373 outStr << "<system>" << endl;
374 systemTagPrinted = true;
375 }
376 outStr << "<otherResults numberOfOtherResults=\"";
377 outStr << m_OSResult->system->otherResults->numberOfOtherResults;
378 outStr << "\">" << endl;
379 for (int i=0; i < m_OSResult->system->otherResults->numberOfOtherResults; i++)
380 {
381 outStr << "<other";
382 if (m_OSResult->system->otherResults->other[i]->name.length() > 0)
383 {
384 outStr << " name=";
385 outStr << writeStringData(m_OSResult->system->otherResults->other[i]->name);
386 }
387 if (m_OSResult->system->otherResults->other[i]->value.length() > 0)
388 {
389 outStr << " value=";
390 outStr << writeStringData(m_OSResult->system->otherResults->other[i]->value);
391 }
392 if (m_OSResult->system->otherResults->other[i]->description.length() > 0)
393 {
394 outStr << " description=";
395 outStr << writeStringData(m_OSResult->system->otherResults->other[i]->description);
396 }
397 outStr << " />" << endl;
398 }
399 outStr << "</otherResults>" << endl;
400 }
401 }
402 if (systemTagPrinted == true)
403 outStr << "</system>" << endl;
404 }
405
406
407#ifndef NDEBUG
408 osoutput->OSPrint(ENUM_OUTPUT_AREA_OSrLwriter, ENUM_OUTPUT_LEVEL_trace, "output <service>");
409#endif
410 if(m_OSResult->service != NULL)
411 {
412 serviceTagPrinted = false;
413 if(m_OSResult->service->currentState.length() > 0 && m_OSResult->service->currentState != "unknown")
414 {
415 if (serviceTagPrinted == false)
416 {
417 outStr << "<service>" << endl;
418 serviceTagPrinted = true;
419 }
420 outStr << "<currentState>" << m_OSResult->service->currentState << "</currentState>" << endl;
421 }
422 if(m_OSResult->service->currentJobCount >= 0)
423 {
424 if (serviceTagPrinted == false)
425 {
426 outStr << "<service>" << endl;
427 serviceTagPrinted = true;
428 }
429 outStr << "<currentJobCount>" << m_OSResult->service->currentJobCount << "</currentJobCount>" << endl;
430 }
431 if(m_OSResult->service->totalJobsSoFar >= 0)
432 {
433 if (serviceTagPrinted == false)
434 {
435 outStr << "<service>" << endl;
436 serviceTagPrinted = true;
437 }
438 outStr << "<totalJobsSoFar>" << m_OSResult->service->totalJobsSoFar << "</totalJobsSoFar>" << endl;
439 }
440 if(m_OSResult->service->timeServiceStarted.length() > 0 && m_OSResult->service->timeServiceStarted != "1970-01-01T00:00:00-00:00")
441 {
442 if (serviceTagPrinted == false)
443 {
444 outStr << "<service>" << endl;
445 serviceTagPrinted = true;
446 }
447 outStr << "<timeServiceStarted>" << m_OSResult->service->timeServiceStarted << "</timeServiceStarted>" << endl;
448 }
449 if(m_OSResult->service->serviceUtilization != -1.0)
450 {
451 if (serviceTagPrinted == false)
452 {
453 outStr << "<service>" << endl;
454 serviceTagPrinted = true;
455 }
456 outStr << "<serviceUtilization>" << os_dtoa_format(m_OSResult->service->serviceUtilization) << "</serviceUtilization>" << endl;
457 }
458
459 if(m_OSResult->service->otherResults != NULL)
460 {
461 if(m_OSResult->service->otherResults->numberOfOtherResults > 0)
462 {
463 if (serviceTagPrinted == false)
464 {
465 outStr << "<service>" << endl;
466 serviceTagPrinted = true;
467 }
468 outStr << "<otherResults numberOfOtherResults=\"";
469 outStr << m_OSResult->service->otherResults->numberOfOtherResults;
470 outStr << "\">" << endl;
471 for (int i=0; i < m_OSResult->service->otherResults->numberOfOtherResults; i++)
472 {
473 outStr << "<other";
474 if (m_OSResult->service->otherResults->other[i]->name.length() > 0)
475 {
476 outStr << " name=";
477 outStr << writeStringData(m_OSResult->service->otherResults->other[i]->name);
478 }
479 if (m_OSResult->service->otherResults->other[i]->value.length() > 0)
480 {
481 outStr << " value=";
482 outStr << writeStringData(m_OSResult->service->otherResults->other[i]->value);
483 }
484 if (m_OSResult->service->otherResults->other[i]->description.length() > 0)
485 {
486 outStr << " description=";
487 outStr << writeStringData(m_OSResult->service->otherResults->other[i]->description);
488 }
489 outStr << " />" << endl;
490 }
491 outStr << "</otherResults>" << endl;
492 }
493 }
494 if (serviceTagPrinted == true)
495 outStr << "</service>" << endl;
496 }
497
498
499#ifndef NDEBUG
501#endif
502 if(m_OSResult->job != NULL)
503 {
504 jobTagPrinted = false;
505
506 if(m_OSResult->job->status.length() > 0 && m_OSResult->job->status != "finished")
507 {
508 if (jobTagPrinted == false)
509 {
510 outStr << "<job>" << endl;
511 jobTagPrinted = true;
512 }
513 outStr << "<status>" + m_OSResult->job->status + "</status>" << endl;
514 }
515 if(m_OSResult->job->submitTime.length() > 0 && m_OSResult->job->submitTime != "1970-01-01T00:00:00-00:00")
516 {
517 if (jobTagPrinted == false)
518 {
519 outStr << "<job>" << endl;
520 jobTagPrinted = true;
521 }
522 outStr << "<submitTime>" + m_OSResult->job->submitTime + "</submitTime>" << endl;
523 }
524 if(m_OSResult->job->scheduledStartTime.length() > 0 && m_OSResult->job->scheduledStartTime != "1970-01-01T00:00:00-00:00")
525 {
526 if (jobTagPrinted == false)
527 {
528 outStr << "<job>" << endl;
529 jobTagPrinted = true;
530 }
531 outStr << "<scheduledStartTime>" + m_OSResult->job->scheduledStartTime + "</scheduledStartTime>" << endl;
532 }
533 if(m_OSResult->job->actualStartTime.length() > 0 && m_OSResult->job->actualStartTime != "1970-01-01T00:00:00-00:00")
534 {
535 if (jobTagPrinted == false)
536 {
537 outStr << "<job>" << endl;
538 jobTagPrinted = true;
539 }
540 outStr << "<actualStartTime>" + m_OSResult->job->actualStartTime + "</actualStartTime>" << endl;
541 }
542 if(m_OSResult->job->endTime.length() > 0 && m_OSResult->job->endTime != "1970-01-01T00:00:00-00:00")
543 {
544 if (jobTagPrinted == false)
545 {
546 outStr << "<job>" << endl;
547 jobTagPrinted = true;
548 }
549 outStr << "<endTime>" + m_OSResult->job->endTime + "</endTime>" << endl;
550 }
551
552 if (m_OSResult->job->timingInformation != NULL)
553 {
554 if (jobTagPrinted == false)
555 {
556 outStr << "<job>" << endl;
557 jobTagPrinted = true;
558 }
559 outStr << "<timingInformation numberOfTimes=\"";
560 outStr << m_OSResult->job->timingInformation->numberOfTimes << "\">" << endl;
561 for (i=0; i<m_OSResult->job->timingInformation->numberOfTimes; i++)
562 {
563 outStr << "<time";
564 if (m_OSResult->job->timingInformation->time[i]->type != "")
565 outStr << " type=\"" << m_OSResult->job->timingInformation->time[i]->type << "\"";
566 if (m_OSResult->job->timingInformation->time[i]->unit != "")
567 outStr << " unit=\"" << m_OSResult->job->timingInformation->time[i]->unit << "\"";
568 if (m_OSResult->job->timingInformation->time[i]->category != "")
569 outStr << " category=\"" << m_OSResult->job->timingInformation->time[i]->category << "\"";
570 if (m_OSResult->job->timingInformation->time[i]->description != "")
571 outStr << " description=" << writeStringData(m_OSResult->job->timingInformation->time[i]->description);
572 outStr << ">" << endl;
573 outStr << os_dtoa_format(m_OSResult->job->timingInformation->time[i]->value);
574 outStr << "</time>" << endl;
575 }
576 outStr << "</timingInformation>" << endl;
577 }
578
579 if(m_OSResult->job->usedDiskSpace != NULL)
580 {
581 if (jobTagPrinted == false)
582 {
583 outStr << "<job>" << endl;
584 jobTagPrinted = true;
585 }
586 outStr << "<usedDiskSpace";
587 if(m_OSResult->job->usedDiskSpace->unit.length() > 0)
588 {
589 outStr << " unit=\"";
590 outStr << m_OSResult->job->usedDiskSpace->unit ;
591 outStr << "\"";
592 }
593 if(m_OSResult->job->usedDiskSpace->description.length() > 0)
594 {
595 outStr << " description=";
596 outStr << writeStringData(m_OSResult->job->usedDiskSpace->description);
597 }
598 outStr << ">";
599 outStr << os_dtoa_format(m_OSResult->job->usedDiskSpace->value);
600 outStr << "</usedDiskSpace>" << endl;
601 }
602
603 if(m_OSResult->job->usedMemory != NULL)
604 {
605 if (jobTagPrinted == false)
606 {
607 outStr << "<job>" << endl;
608 jobTagPrinted = true;
609 }
610 outStr << "<usedMemory";
611 if(m_OSResult->job->usedMemory->unit.length() > 0)
612 {
613 outStr << " unit=\"";
614 outStr << m_OSResult->job->usedMemory->unit ;
615 outStr << "\"";
616 }
617 if(m_OSResult->job->usedMemory->description.length() > 0)
618 {
619 outStr << " description=";
620 outStr << writeStringData(m_OSResult->job->usedMemory->description);
621 }
622 outStr << ">";
623 outStr << os_dtoa_format(m_OSResult->job->usedMemory->value);
624 outStr << "</usedMemory>" << endl;
625 }
626
627 if(m_OSResult->job->usedCPUSpeed != NULL)
628 {
629 if (jobTagPrinted == false)
630 {
631 outStr << "<job>" << endl;
632 jobTagPrinted = true;
633 }
634 outStr << "<usedCPUSpeed";
635 if(m_OSResult->job->usedCPUSpeed->unit.length() > 0)
636 {
637 outStr << " unit=\"";
638 outStr << m_OSResult->job->usedCPUSpeed->unit ;
639 outStr << "\"";
640 }
641 if(m_OSResult->job->usedCPUSpeed->description.length() > 0)
642 {
643 outStr << " description=";
644 outStr << writeStringData(m_OSResult->job->usedCPUSpeed->description);
645 }
646 outStr << ">";
647 outStr << os_dtoa_format(m_OSResult->job->usedCPUSpeed->value);
648 outStr << "</usedCPUSpeed>" << endl;
649 }
650
651 if(m_OSResult->job->usedCPUNumber != NULL)
652 {
653 if (jobTagPrinted == false)
654 {
655 outStr << "<job>" << endl;
656 jobTagPrinted = true;
657 }
658 outStr << "<usedCPUNumber";
659 if(m_OSResult->job->usedCPUNumber->description.length() > 0)
660 {
661 outStr << " description=";
662 outStr << writeStringData(m_OSResult->job->usedCPUNumber->description);
663 }
664 outStr << ">";
665 outStr << m_OSResult->job->usedCPUNumber->value;
666 outStr << "</usedCPUNumber>" << endl;
667 }
668
669 if(m_OSResult->job->otherResults != NULL)
670 {
671 if(m_OSResult->job->otherResults->numberOfOtherResults > 0)
672 {
673 if (jobTagPrinted == false)
674 {
675 outStr << "<job>" << endl;
676 jobTagPrinted = true;
677 }
678 outStr << "<otherResults numberOfOtherResults=\"";
679 outStr << m_OSResult->job->otherResults->numberOfOtherResults;
680 outStr << "\">" << endl;
681 for (int i=0; i < m_OSResult->job->otherResults->numberOfOtherResults; i++)
682 {
683 outStr << "<other";
684 if (m_OSResult->job->otherResults->other[i]->name.length() > 0)
685 {
686 outStr << " name=";
687 outStr << writeStringData(m_OSResult->job->otherResults->other[i]->name);
688 }
689 if (m_OSResult->job->otherResults->other[i]->value.length() > 0)
690 {
691 outStr << " value=";
692 outStr << writeStringData(m_OSResult->job->otherResults->other[i]->value);
693 }
694 if (m_OSResult->job->otherResults->other[i]->description.length() > 0)
695 {
696 outStr << " description=";
697 outStr << writeStringData(m_OSResult->job->otherResults->other[i]->description);
698 }
699 outStr << " />" << endl;
700 }
701 outStr << "</otherResults>" << endl;
702 }
703 }
704 if (jobTagPrinted == true)
705 outStr << "</job>" << endl;
706 }
707
708
709#ifndef NDEBUG
710 osoutput->OSPrint(ENUM_OUTPUT_AREA_OSrLwriter, ENUM_OUTPUT_LEVEL_trace, "output <optimization>");
711#endif
712 if(m_OSResult->optimization != NULL)
713 {
714 outStr << "<optimization " ;
715 outStr << "numberOfSolutions=\"";
716 outStr << m_OSResult->optimization->numberOfSolutions ;
717 outStr << "\"";
718 if (m_OSResult->optimization->numberOfVariables >= 0)
719 {
720 outStr << " numberOfVariables=\"";
721 outStr << m_OSResult->optimization->numberOfVariables ;
722 outStr << "\"";
723 }
724 if (m_OSResult->optimization->numberOfConstraints >= 0)
725 {
726 outStr << " numberOfConstraints=\"";
727 outStr << m_OSResult->optimization->numberOfConstraints ;
728 outStr << "\"";
729 }
730 if (m_OSResult->optimization->numberOfObjectives >= 0)
731 {
732 outStr << " numberOfObjectives=\"";
733 outStr << m_OSResult->optimization->numberOfObjectives ;
734 outStr << "\"" ;
735 }
736 outStr << ">" << endl;
737 // get solution information
738 for(i = 0; i < m_OSResult->optimization->numberOfSolutions; i++)
739 {
740 if(m_OSResult->optimization->solution[i] != NULL)
741 {
742 outStr << "<solution" ;
743 outStr << " targetObjectiveIdx=\"";
744 outStr << m_OSResult->optimization->solution[i]->targetObjectiveIdx ;
745 outStr << "\"" ;
746 if (m_OSResult->optimization->solution[i]->targetObjectiveName.length() > 0)
747 {
748 outStr << " targetObjectiveName=";
749 outStr << writeStringData(m_OSResult->optimization->solution[i]->targetObjectiveName);
750 }
751 if (m_OSResult->optimization->solution[i]->weightedObjectives)
752 outStr << " weightedObjectives=\"true\"";
753 outStr << ">" << endl;
754 if(m_OSResult->optimization->solution[i]->status != NULL)
755 {
756 outStr << "<status";
757 if (m_OSResult->optimization->solution[i]->status->numberOfSubstatuses > 0)
758 {
759 outStr << " numberOfSubstatuses=\"";
760 outStr << m_OSResult->optimization->solution[i]->status->numberOfSubstatuses ;
761 outStr << "\"";
762 }
763 if(m_OSResult->optimization->solution[i]->status->type.length() > 0)
764 {
765 outStr << " type=\"";
766 outStr << m_OSResult->optimization->solution[i]->status->type;
767 outStr << "\"";
768 }
769 if(m_OSResult->optimization->solution[i]->status->description.length() > 0)
770 {
771 outStr << " description=";
772 outStr << writeStringData(m_OSResult->optimization->solution[i]->status->description);
773 }
774 outStr << ">" << endl;
775 for (int j=0; j < m_OSResult->optimization->solution[i]->status->numberOfSubstatuses; j++)
776 {
777 outStr << "<substatus";
778 if(m_OSResult->optimization->solution[i]->status->substatus[j]->type.length() > 0)
779 {
780 outStr << " type=\"";
781 outStr << m_OSResult->optimization->solution[i]->status->substatus[j]->type;
782 outStr << "\"";
783 }
784 if(m_OSResult->optimization->solution[i]->status->substatus[j]->description.length() > 0)
785 {
786 outStr << " description=";
787 outStr << writeStringData(m_OSResult->optimization->solution[i]->status->substatus[j]->description);
788 }
789 outStr << "/>" << endl;
790 }
791 outStr << "</status>" << endl;
792 }
793
794 if(m_OSResult->optimization->solution[i]->message != "")
795 {
796 outStr << "<message>";
797 outStr << m_OSResult->optimization->solution[i]->message;
798 outStr << "</message>" << endl;
799 }
800 if(m_OSResult->optimization->solution[i]->variables != NULL)
801 {
802 outStr << "<variables ";
803 if (m_OSResult->optimization->solution[i]->variables->numberOfOtherVariableResults > 0)
804 outStr << "numberOfOtherVariableResults=\"" << m_OSResult->optimization->solution[i]->variables->numberOfOtherVariableResults << "\"";
805 outStr << ">" << endl;
806 if(m_OSResult->optimization->solution[i]->variables->values != NULL)
807 {
808#ifndef NDEBUG
810 "output <variables> <values>");
811#endif
812 outStr << "<values numberOfVar=\"" << m_OSResult->optimization->solution[i]->variables->values->numberOfVar << "\">" << endl;
813 for(j = 0; j < m_OSResult->optimization->solution[i]->variables->values->numberOfVar; j++)
814 {
815 if(m_OSResult->optimization->solution[i]->variables->values->var[j] != NULL)
816 {
817 outStr << "<var";
818 outStr << " idx=\"";
819 outStr << m_OSResult->optimization->solution[i]->variables->values->var[j]->idx;
820 outStr << "\"";
821 if (m_OSResult->optimization->solution[i]->variables->values->var[j]->name != "")
822 outStr << " name=" << writeStringData(m_OSResult->optimization->solution[i]->variables->values->var[j]->name);
823 outStr << ">";
824 outStr << os_dtoa_format( m_OSResult->optimization->solution[i]->variables->values->var[j]->value );
825 outStr << "</var>" << endl;
826 }
827 }
828 outStr << "</values>" << endl;
829 }
830
831 if(m_OSResult->optimization->solution[i]->variables->valuesString != NULL)
832 {
833#ifndef NDEBUG
835 "output <variables> <valuesString>");
836#endif
837 outStr << "<valuesString numberOfVar=\"" << m_OSResult->optimization->solution[i]->variables->valuesString->numberOfVar << "\">" << endl;
838 for(j = 0; j < m_OSResult->optimization->solution[i]->variables->valuesString->numberOfVar; j++)
839 {
840 if(m_OSResult->optimization->solution[i]->variables->valuesString->var[j] != NULL)
841 {
842 outStr << "<var";
843 outStr << " idx=\"";
844 outStr << m_OSResult->optimization->solution[i]->variables->valuesString->var[j]->idx;
845 outStr << "\"";
846 if (m_OSResult->optimization->solution[i]->variables->valuesString->var[j]->name != "")
847 outStr << " name=" << writeStringData(m_OSResult->optimization->solution[i]->variables->valuesString->var[j]->name);
848 outStr << ">";
849 outStr << m_OSResult->optimization->solution[i]->variables->valuesString->var[j]->value;
850 outStr << "</var>" << endl;
851 }
852 }
853 outStr << "</valuesString>" << endl;
854 }
855
856 if(m_OSResult->optimization->solution[i]->variables->basisStatus != NULL)
857 {
858#ifndef NDEBUG
860 "output <variables> <basisStatus>");
861#endif
862 outStr << "<basisStatus>" << endl;
863 outStr << writeBasisStatus(m_OSResult->optimization->solution[i]->variables->basisStatus, m_bWhiteSpace, m_bWriteBase64);
864 outStr << "</basisStatus>" << endl;
865 }
866
867#ifndef NDEBUG
868 osoutput->OSPrint(ENUM_OUTPUT_AREA_OSrLwriter, ENUM_OUTPUT_LEVEL_trace, "output <variables> <other>");
869#endif
870 if(m_OSResult->optimization->solution[i]->variables->other != NULL)
871 {
872 if(m_OSResult->optimization->solution[i]->variables->numberOfOtherVariableResults > 0)
873 {
874 for(int k = 0; k < m_OSResult->optimization->solution[i]->variables->numberOfOtherVariableResults; k++)
875 {
876 outStr << "<other";
877 if (m_OSResult->optimization->solution[i]->variables->other[k]->numberOfVar > 0)
878 {
879 outStr << " numberOfVar=\"";
880 outStr << m_OSResult->optimization->solution[i]->variables->other[k]->numberOfVar;
881 outStr << "\"" ;
882 }
883 else if(m_OSResult->optimization->solution[i]->variables->other[k]->numberOfEnumerations > 0)
884 {
885 outStr << " numberOfEnumerations=\"";
886 outStr << m_OSResult->optimization->solution[i]->variables->other[k]->numberOfEnumerations;
887 outStr << "\"" ;
888 }
889 outStr << " name=";
890 outStr << writeStringData(m_OSResult->optimization->solution[i]->variables->other[k]->name);
891 if (m_OSResult->optimization->solution[i]->variables->other[k]->value != "")
892 {
893 outStr << " value=\"";
894 outStr << m_OSResult->optimization->solution[i]->variables->other[k]->value;
895 outStr << "\"" ;
896 }
897 if (m_OSResult->optimization->solution[i]->variables->other[k]->type != "")
898 {
899 outStr << " type=\"";
900 outStr << m_OSResult->optimization->solution[i]->variables->other[k]->type;
901 outStr << "\"" ;
902 }
903 if (m_OSResult->optimization->solution[i]->variables->other[k]->description != "")
904 {
905 outStr << " description=";
906 outStr << writeStringData(m_OSResult->optimization->solution[i]->variables->other[k]->description);
907 }
908 if (m_OSResult->optimization->solution[i]->variables->other[k]->varType != "")
909 {
910 outStr << " varType=\"";
911 outStr << m_OSResult->optimization->solution[i]->variables->other[k]->varType;
912 outStr << "\"" ;
913 }
914 if (m_OSResult->optimization->solution[i]->variables->other[k]->enumType != "")
915 {
916 outStr << " enumType=\"";
917 outStr << m_OSResult->optimization->solution[i]->variables->other[k]->enumType;
918 outStr << "\"" ;
919 }
920 outStr << ">" << endl;
921 if(m_OSResult->optimization->solution[i]->variables->other[k]->numberOfVar > 0)
922 {
923 for(j = 0; j < m_OSResult->optimization->solution[i]->variables->other[k]->numberOfVar; j++)
924 {
925 outStr << "<var";
926 outStr << " idx=\"";
927 outStr << m_OSResult->optimization->solution[i]->variables->other[k]->var[j]->idx ;
928 outStr << "\"";
929 if (m_OSResult->optimization->solution[i]->variables->other[k]->var[j]->name != "")
930 outStr << " name=" << writeStringData(m_OSResult->optimization->solution[i]->variables->other[k]->var[j]->name);
931 outStr << ">";
932 outStr << m_OSResult->optimization->solution[i]->variables->other[k]->var[j]->value;
933 outStr << "</var>" << endl;
934 }
935 }
936 else if (m_OSResult->optimization->solution[i]->variables->other[k]->numberOfEnumerations > 0)
937 {
938 for(j = 0; j < m_OSResult->optimization->solution[i]->variables->other[k]->numberOfEnumerations; j++)
939 {
940 outStr << writeOtherOptionOrResultEnumeration(m_OSResult->optimization->solution[i]->variables->other[k]->enumeration[j],
942 }
943 }
944 outStr << "</other>" << endl;
945 }
946 }
947 } // end of if on other variables
948 outStr << "</variables>" << endl;
949 }
950 if(m_OSResult->optimization->solution[i]->objectives != NULL)
951 {
952 outStr << "<objectives ";
953 if (m_OSResult->optimization->solution[i]->objectives->numberOfOtherObjectiveResults > 0)
954 outStr << "numberOfOtherObjectiveResults=\"" << m_OSResult->optimization->solution[i]->objectives->numberOfOtherObjectiveResults << "\"";
955 outStr << ">" << endl;
956#ifndef NDEBUG
958 "output <objectives> <values>");
959#endif
960 if(m_OSResult->optimization->solution[i]->objectives->values != NULL)
961 {
962 outStr << "<values numberOfObj=\"" << m_OSResult->optimization->solution[i]->objectives->values->numberOfObj << "\">" << endl;
963 for(j = 0; j < m_OSResult->optimization->solution[i]->objectives->values->numberOfObj; j++)
964 {
965 if(m_OSResult->optimization->solution[i]->objectives->values->obj[j] != NULL)
966 {
967 outStr << "<obj";
968 outStr << " idx=\"";
969 outStr << m_OSResult->optimization->solution[i]->objectives->values->obj[j]->idx; //-(1 + j) ;
970 outStr << "\"";
971 if (m_OSResult->optimization->solution[i]->objectives->values->obj[j]->name != "")
972 outStr << " name=" << writeStringData(m_OSResult->optimization->solution[i]->objectives->values->obj[j]->name);
973 outStr << ">";
974 outStr << os_dtoa_format( m_OSResult->optimization->solution[i]->objectives->values->obj[j]->value);
975 outStr << "</obj>" << endl;
976 }
977 }
978
979 outStr << "</values>" << endl;
980 }
981
982 if(m_OSResult->optimization->solution[i]->objectives->basisStatus != NULL)
983 {
984#ifndef NDEBUG
986 "output <objectives> <basisStatus>");
987#endif
988 outStr << "<basisStatus>" << endl;
989 outStr << writeBasisStatus(m_OSResult->optimization->solution[i]->objectives->basisStatus, m_bWhiteSpace, m_bWriteBase64);
990 outStr << "</basisStatus>" << endl;
991 }
992
993#ifndef NDEBUG
995 "output <objectives> <other>");
996#endif
997 if(m_OSResult->optimization->solution[i]->objectives->other != NULL)
998 {
999 if(m_OSResult->optimization->solution[i]->objectives->numberOfOtherObjectiveResults > 0)
1000 {
1001 for(int k = 0; k < m_OSResult->optimization->solution[i]->objectives->numberOfOtherObjectiveResults; k++)
1002 {
1003 outStr << "<other" ;
1004 if (m_OSResult->optimization->solution[i]->objectives->other[k]->numberOfObj > 0)
1005 {
1006 outStr << " numberOfObj=\"";
1007 outStr << m_OSResult->optimization->solution[i]->objectives->other[k]->numberOfObj;
1008 outStr << "\"" ;
1009 }
1010 else if(m_OSResult->optimization->solution[i]->objectives->other[k]->numberOfEnumerations > 0)
1011 {
1012 outStr << " numberOfEnumerations=\"";
1013 outStr << m_OSResult->optimization->solution[i]->objectives->other[k]->numberOfEnumerations;
1014 outStr << "\"" ;
1015 }
1016 if (m_OSResult->optimization->solution[i]->objectives->other[k]->name != "")
1017 {
1018 outStr << " name=";
1019 \
1020 outStr << writeStringData(m_OSResult->optimization->solution[i]->objectives->other[k]->name);
1021 };
1022 if (m_OSResult->optimization->solution[i]->objectives->other[k]->value != "")
1023 {
1024 outStr << " value=\"";
1025 \
1026 outStr << m_OSResult->optimization->solution[i]->objectives->other[k]->value;
1027 outStr << "\"" ;
1028 };
1029 if (m_OSResult->optimization->solution[i]->objectives->other[k]->type != "")
1030 {
1031 outStr << " type=\"";
1032 outStr << m_OSResult->optimization->solution[i]->objectives->other[k]->type;
1033 outStr << "\"" ;
1034 }
1035 if (m_OSResult->optimization->solution[i]->objectives->other[k]->description != "")
1036 {
1037 outStr << " description=";
1038 outStr << writeStringData(m_OSResult->optimization->solution[i]->objectives->other[k]->description);
1039 };
1040 if (m_OSResult->optimization->solution[i]->objectives->other[k]->objType != "")
1041 {
1042 outStr << " objType=\"";
1043 outStr << m_OSResult->optimization->solution[i]->objectives->other[k]->objType;
1044 outStr << "\"" ;
1045 }
1046 if (m_OSResult->optimization->solution[i]->objectives->other[k]->enumType != "")
1047 {
1048 outStr << " enumType=\"";
1049 outStr << m_OSResult->optimization->solution[i]->objectives->other[k]->enumType;
1050 outStr << "\"" ;
1051 }
1052 outStr << ">" << endl;
1053 if(m_OSResult->optimization->solution[i]->objectives->other[k]->numberOfObj > 0)
1054 {
1055 for(j = 0; j < m_OSResult->optimization->solution[i]->objectives->other[k]->numberOfObj; j++)
1056 {
1057 outStr << "<obj";
1058 outStr << " idx=\"";
1059 outStr << m_OSResult->optimization->solution[i]->objectives->other[k]->obj[j]->idx;
1060 outStr << "\"";
1061 if (m_OSResult->optimization->solution[i]->objectives->other[k]->obj[j]->name != "")
1062 outStr << " name=" << writeStringData(m_OSResult->optimization->solution[i]->objectives->other[k]->obj[j]->name);
1063 outStr << ">";
1064 outStr << m_OSResult->optimization->solution[i]->objectives->other[k]->obj[j]->value;
1065 outStr << "</obj>" << endl;
1066 }
1067 }
1068 else if (m_OSResult->optimization->solution[i]->objectives->other[k]->numberOfEnumerations > 0)
1069 {
1070 for(j = 0; j < m_OSResult->optimization->solution[i]->objectives->other[k]->numberOfEnumerations; j++)
1071 {
1072 outStr << writeOtherOptionOrResultEnumeration(m_OSResult->optimization->solution[i]->objectives->other[k]->enumeration[j],
1074 }
1075 }
1076 outStr << "</other>" << endl;
1077 }
1078 }
1079 } // end of if on other objectives
1080 outStr << "</objectives>" << endl;
1081 }
1082
1083 if(m_OSResult->optimization->solution[i]->constraints != NULL)
1084 {
1085 outStr << "<constraints ";
1086 if (m_OSResult->optimization->solution[i]->constraints->numberOfOtherConstraintResults > 0)
1087 outStr << "numberOfOtherConstraintResults=\"" << m_OSResult->optimization->solution[i]->constraints->numberOfOtherConstraintResults << "\"";
1088 outStr << ">" << endl;
1089#ifndef NDEBUG
1091 "output <constraints> <dualValues>");
1092#endif
1093 if(m_OSResult->optimization->solution[i]->constraints->dualValues != NULL)
1094 {
1095 outStr << "<dualValues numberOfCon=\"" << m_OSResult->optimization->solution[i]->constraints->dualValues->numberOfCon << "\">" << endl;
1096 for(j = 0; j < m_OSResult->optimization->solution[i]->constraints->dualValues->numberOfCon; j++)
1097 {
1098 if(m_OSResult->optimization->solution[i]->constraints->dualValues->con[j] != NULL)
1099 {
1100 outStr << "<con";
1101 outStr << " idx=\"";
1102 outStr << m_OSResult->optimization->solution[i]->constraints->dualValues->con[j]->idx;
1103 outStr << "\"";
1104 if (m_OSResult->optimization->solution[i]->constraints->dualValues->con[j]->name != "")
1105 outStr << " name=" << writeStringData(m_OSResult->optimization->solution[i]->constraints->dualValues->con[j]->name);
1106 outStr << ">";
1107 outStr << os_dtoa_format( m_OSResult->optimization->solution[i]->constraints->dualValues->con[j]->value);
1108 outStr << "</con>" << endl;
1109 }
1110 }
1111 outStr << "</dualValues>" << endl;
1112 }
1113
1114 if(m_OSResult->optimization->solution[i]->constraints->basisStatus != NULL)
1115 {
1116#ifndef NDEBUG
1118 "output <constraints> <basisStatus>");
1119#endif
1120 outStr << "<basisStatus>" << endl;
1121 outStr << writeBasisStatus(m_OSResult->optimization->solution[i]->constraints->basisStatus, m_bWhiteSpace, m_bWriteBase64);
1122 outStr << "</basisStatus>" << endl;
1123 }
1124
1125#ifndef NDEBUG
1127 "output <constraints> <other>");
1128#endif
1129 if(m_OSResult->optimization->solution[i]->constraints->other != NULL)
1130 {
1131 if(m_OSResult->optimization->solution[i]->constraints->numberOfOtherConstraintResults > 0)
1132 {
1133 for(int k = 0; k < m_OSResult->optimization->solution[i]->constraints->numberOfOtherConstraintResults; k++)
1134 {
1135 outStr << "<other";
1136 if (m_OSResult->optimization->solution[i]->constraints->other[k]->numberOfCon > 0)
1137 {
1138 outStr << " numberOfCon=\"";
1139 outStr << m_OSResult->optimization->solution[i]->constraints->other[k]->numberOfCon;
1140 outStr << "\"";
1141 }
1142 else if(m_OSResult->optimization->solution[i]->constraints->other[k]->numberOfEnumerations > 0)
1143 {
1144 outStr << " numberOfEnumerations=\"";
1145 outStr << m_OSResult->optimization->solution[i]->constraints->other[k]->numberOfEnumerations;
1146 outStr << "\"";
1147 }
1148 outStr << " name=";
1149 \
1150 outStr << writeStringData(m_OSResult->optimization->solution[i]->constraints->other[k]->name);
1151 if (m_OSResult->optimization->solution[i]->constraints->other[k]->value != "")
1152 {
1153 outStr << " value=\"";
1154 \
1155 outStr << m_OSResult->optimization->solution[i]->constraints->other[k]->value;
1156 outStr << "\"" ;
1157 };
1158 if (m_OSResult->optimization->solution[i]->constraints->other[k]->type != "")
1159 {
1160 outStr << " type=\"";
1161 outStr << m_OSResult->optimization->solution[i]->constraints->other[k]->type;
1162 outStr << "\"" ;
1163
1164 }
1165 if (m_OSResult->optimization->solution[i]->constraints->other[k]->description != "")
1166 {
1167 outStr << " description=";
1168 outStr << writeStringData(m_OSResult->optimization->solution[i]->constraints->other[k]->description);
1169 };
1170 if (m_OSResult->optimization->solution[i]->constraints->other[k]->conType != "")
1171 {
1172 outStr << " conType=\"";
1173 outStr << m_OSResult->optimization->solution[i]->constraints->other[k]->conType;
1174 outStr << "\"" ;
1175 }
1176 if (m_OSResult->optimization->solution[i]->constraints->other[k]->enumType != "")
1177 {
1178 outStr << " enumType=\"";
1179 outStr << m_OSResult->optimization->solution[i]->constraints->other[k]->enumType;
1180 outStr << "\"" ;
1181 }
1182 outStr << ">" << endl;
1183 if(m_OSResult->optimization->solution[i]->constraints->other[k]->numberOfCon > 0)
1184 {
1185 for(j = 0; j < m_OSResult->optimization->solution[i]->constraints->other[k]->numberOfCon; j++)
1186 {
1187 outStr << "<con";
1188 outStr << " idx=\"";
1189 outStr << m_OSResult->optimization->solution[i]->constraints->other[k]->con[j]->idx;
1190 outStr << "\"";
1191 if (m_OSResult->optimization->solution[i]->constraints->other[k]->con[j]->name != "")
1192 outStr << " name=" << writeStringData(m_OSResult->optimization->solution[i]->constraints->other[k]->con[j]->name);
1193 outStr << ">";
1194 outStr << m_OSResult->optimization->solution[i]->constraints->other[k]->con[j]->value;
1195 outStr << "</con>" << endl;
1196 }
1197 }
1198 else if (m_OSResult->optimization->solution[i]->constraints->other[k]->numberOfEnumerations > 0)
1199 {
1200 for(j = 0; j < m_OSResult->optimization->solution[i]->constraints->other[k]->numberOfEnumerations; j++)
1201 {
1202 outStr << writeOtherOptionOrResultEnumeration(m_OSResult->optimization->solution[i]->constraints->other[k]->enumeration[j],
1204 }
1205 }
1206 outStr << "</other>" << endl;
1207 }
1208 }
1209 } // end of if on other constraints
1210 outStr << "</constraints>" << endl;
1211 }// end of <constraints> element
1212
1213 if(m_OSResult->optimization->solution[i]->matrixProgramming != NULL)
1214 {
1215#ifndef NDEBUG
1217 "output <matrixProgramming>");
1218#endif
1219 outStr << "<matrixProgramming";
1220 if (m_OSResult->optimization->solution[i]->matrixProgramming
1221 ->numberOfOtherMatrixProgrammingResults > 0)
1222 outStr << " numberOfOtherMatrixProgrammingResults=\""
1223 << m_OSResult->optimization->solution[i]->matrixProgramming
1224 ->numberOfOtherMatrixProgrammingResults << "\"";
1225 outStr << ">" << endl;
1226
1227 if(m_OSResult->optimization->solution[i]->matrixProgramming->matrixVariables != NULL)
1228 {
1230 = m_OSResult->optimization->solution[i]->matrixProgramming->matrixVariables;
1231#ifndef NDEBUG
1233 "output <matrixVariables>");
1234#endif
1235 outStr << "<matrixVariables";
1236 if (tmpVar->numberOfOtherMatrixVariableResults > 0)
1237 outStr << " numberOfOtherMatrixVariableResults=\""
1238 << tmpVar->numberOfOtherMatrixVariableResults << "\"";
1239 outStr << ">" << endl;
1240
1241 if (tmpVar->values != NULL)
1242 {
1243 outStr << "<values numberOfMatrixVar=\""
1244 << tmpVar->values->numberOfMatrixVar << "\">" << std::endl;
1245 for (int var=0; var < tmpVar->values->numberOfMatrixVar; var++)
1246 outStr << tmpVar->values->matrixVar[var]->getMatrixNodeInXML();
1247 }
1248 outStr << "</values>" << endl;
1249 if (tmpVar->numberOfOtherMatrixVariableResults > 0 &&
1250 tmpVar->other != NULL)
1251 {
1252 for (int j=0; j < tmpVar->numberOfOtherMatrixVariableResults; j++)
1253 {
1254 outStr << "<other name=\"" << tmpVar->other[j]->name << "\"";
1255 if (tmpVar->other[j]->description != "")
1256 outStr << " description=\"" << tmpVar->other[j]->description << "\"";
1257 if (tmpVar->other[j]->value != "")
1258 outStr << " value=\"" << tmpVar->other[j]->value << "\"";
1259 if (tmpVar->other[j]->type != "")
1260 outStr << " type=\"" << tmpVar->other[j]->type << "\"";
1261 if (tmpVar->other[j]->solver != "")
1262 outStr << " solver=\"" << tmpVar->other[j]->solver << "\"";
1263 if (tmpVar->other[j]->category != "")
1264 outStr << " category=\"" << tmpVar->other[j]->category << "\"";
1265 if (tmpVar->other[j]->numberOfMatrixVar != 0)
1266 outStr << " numberOfMatrixVar=\""
1267 << tmpVar->other[j]->numberOfMatrixVar << "\"";
1268 if (tmpVar->other[j]->matrixType != "")
1269 outStr << " matrixType=\"" << tmpVar->other[j]->matrixType << "\"";
1270 if (tmpVar->other[j]->numberOfEnumerations != 0)
1271 outStr << " numberOfEnumerations=\""
1272 << tmpVar->other[j]->numberOfEnumerations << "\"";
1273 if (tmpVar->other[j]->enumType != "")
1274 outStr << " enumType=\"" << tmpVar->other[j]->enumType << "\"";
1275
1276 if (tmpVar->other[j]->numberOfMatrixVar == 0 &&
1277 tmpVar->other[j]->numberOfEnumerations == 0)
1278 {
1279 outStr << "/>" << endl;
1280 }
1281 else
1282 {
1283 outStr << ">" << endl;
1284 if (tmpVar->other[j]->numberOfMatrixVar > 0)
1285 for (int var=0; var < tmpVar->other[j]->numberOfMatrixVar; var++)
1286 outStr << tmpVar->other[j]->matrixVar[var]->getMatrixNodeInXML();
1287
1288 if (tmpVar->other[j]->numberOfEnumerations > 0)
1289 for(int k = 0; k < tmpVar->other[j]->numberOfEnumerations; k++)
1290 {
1292 tmpVar->other[j]->enumeration[j],
1294 }
1295
1296 outStr << "</other>" << endl;
1297 }
1298 }
1299 }
1300 outStr << "</matrixVariables>" << endl;
1301 }
1302 outStr << "</matrixProgramming>" << endl;
1303 }
1304
1305#ifndef NDEBUG
1306 osoutput->OSPrint(ENUM_OUTPUT_AREA_OSrLwriter, ENUM_OUTPUT_LEVEL_trace, "output <otherSolutionResults>");
1307#endif
1308 if (m_OSResult->optimization->solution[i]->otherSolutionResults != NULL)
1309 {
1310 outStr << "<otherSolutionResults numberOfOtherSolutionResults=\"";
1311 outStr << m_OSResult->optimization->solution[i]->otherSolutionResults->numberOfOtherSolutionResults;
1312 outStr << "\">" << std::endl;
1313 for(int k = 0; k < m_OSResult->optimization->solution[i]->otherSolutionResults->numberOfOtherSolutionResults; k++)
1314 {
1315 outStr << "<otherSolutionResult";
1316 outStr << " name=";
1317 outStr << writeStringData(m_OSResult->optimization->solution[i]->otherSolutionResults->otherSolutionResult[k]->name);
1318 outStr << " value=";
1319 outStr << writeStringData(m_OSResult->optimization->solution[i]->otherSolutionResults->otherSolutionResult[k]->value);
1320 outStr << " numberOfItems=\"";
1321 outStr << m_OSResult->optimization->solution[i]->otherSolutionResults->otherSolutionResult[k]->numberOfItems;
1322 outStr << "\"";
1323 if (m_OSResult->optimization->solution[i]->otherSolutionResults->otherSolutionResult[k]->category != "")
1324 outStr << " category=\"" << m_OSResult->optimization->solution[i]->otherSolutionResults->otherSolutionResult[k]->category << "\"";
1325 if (m_OSResult->optimization->solution[i]->otherSolutionResults->otherSolutionResult[k]->description != "")
1326 outStr << " description=" << writeStringData(m_OSResult->optimization->solution[i]->otherSolutionResults->otherSolutionResult[k]->description);
1327 outStr << ">" << std::endl;
1328 for(int j = 0; j < m_OSResult->optimization->solution[i]->otherSolutionResults->otherSolutionResult[k]->numberOfItems; j++)
1329 outStr << "<item>" << m_OSResult->optimization->solution[i]->otherSolutionResults->otherSolutionResult[k]->item[j] << "</item>" << std::endl;
1330 outStr << "</otherSolutionResult>" << std::endl;
1331 }
1332 outStr << "</otherSolutionResults>" << std::endl;
1333 }
1334 outStr << "</solution>" << endl;
1335 } // end if solution not NULL
1336 } // end for loop(i=0..numberOfSolutions)
1337
1338
1339#ifndef NDEBUG
1340 osoutput->OSPrint(ENUM_OUTPUT_AREA_OSrLwriter, ENUM_OUTPUT_LEVEL_trace, "output <otherSolverOutput>");
1341#endif
1342 if (m_OSResult->optimization->otherSolverOutput != NULL)
1343// if (m_OSResult->optimization->otherSolverOutput->numberOfSolverOutputs > 0)
1344 {
1345 outStr << "<otherSolverOutput numberOfSolverOutputs=\"";
1346 outStr << m_OSResult->optimization->otherSolverOutput->numberOfSolverOutputs;
1347 outStr << "\">" << std::endl;
1348 for(int k = 0; k < m_OSResult->optimization->otherSolverOutput->numberOfSolverOutputs; k++)
1349 {
1350 outStr << "<solverOutput";
1351 outStr << " name=\"";
1352 outStr << m_OSResult->optimization->otherSolverOutput->solverOutput[k]->name;
1353 outStr << "\"";
1354 outStr << " numberOfItems=\"";
1355 outStr << m_OSResult->optimization->otherSolverOutput->solverOutput[k]->numberOfItems;
1356 outStr << "\"";
1357 if (m_OSResult->optimization->otherSolverOutput->solverOutput[k]->category != "")
1358 outStr << " category=\"" << m_OSResult->optimization->otherSolverOutput->solverOutput[k]->category << "\"";
1359 if (m_OSResult->optimization->otherSolverOutput->solverOutput[k]->description != "")
1360 outStr << " description=" << writeStringData(m_OSResult->optimization->otherSolverOutput->solverOutput[k]->description);
1361 outStr << ">" << std::endl;
1362 for(int j = 0; j < m_OSResult->optimization->otherSolverOutput->solverOutput[k]->numberOfItems; j++)
1363 {
1364 outStr << "<item>" << m_OSResult->optimization->otherSolverOutput->solverOutput[k]->item[j] << "</item>" << std::endl;
1365 }
1366 outStr << "</solverOutput>" << std::endl;
1367 }
1368 outStr << "</otherSolverOutput>" << std::endl;
1369 }
1370
1371 outStr << "</optimization>" << endl;
1372 } // end if (optimization != NULL)
1373 outStr << "</osrl>" << endl ;
1374#ifndef NDEBUG
1376#endif
1377 return outStr.str();
1378}// end writeOSrL
1379
1380
const OSSmartPtr< OSOutput > osoutput
Definition OSOutput.cpp:39
std::string os_dtoa_format(double x)
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.
The in-memory representation of the <MatrixVariableSolution> element.
Definition OSResult.h:1993
MatrixVariableValues * values
values is pointer to the <values> child
Definition OSResult.h:1999
int numberOfOtherMatrixVariableResults
numberOfOtherMatrixVariableResults gives the number of <other> children
Definition OSResult.h:1996
OtherMatrixVariableResult ** other
other is a pointer to an array of <other> children
Definition OSResult.h:2002
OSMatrixWithMatrixVarIdx ** matrixVar
matrixVar is an array of pointers to the <matrixVar> children
Definition OSResult.h:1921
int numberOfMatrixVar
numberOfMatrixVar gives the number of <matrixVar> children
Definition OSResult.h:1918
virtual std::string getMatrixNodeInXML()
The Result Class.
Definition OSResult.h:2549
std::string writeOSrL(OSResult *theosresult)
create an osrl string from an OSResult object
bool m_bWhiteSpace
m_bWhiteSpace is set to true if we write white space in the file
Definition OSrLWriter.h:69
OSResult * m_OSResult
m_OSResult is an object in the class OSResult, the data in m_OSResult are written to a string that va...
Definition OSrLWriter.h:37
~OSrLWriter()
Class destructor.
bool m_bWriteBase64
m_bWriteBase64 is set to true if we encode the linear constraint coefficients in base64 binary
Definition OSrLWriter.h:65
OSrLWriter()
Default constructor.
std::string matrixType
the type of matrixVar
Definition OSResult.h:1956
OtherOptionOrResultEnumeration ** enumeration
the enumeration.
Definition OSResult.h:1970
int numberOfEnumerations
number of levels in an enumeration associated with this result
Definition OSResult.h:1962
std::string enumType
the type of the enumeration
Definition OSResult.h:1965
std::string name
Gives a name to this result.
Definition OSResult.h:1943
OSMatrixWithMatrixVarIdx ** matrixVar
the list of matrices and their values
Definition OSResult.h:1959
int numberOfMatrixVar
number of matrix variables affected by or associated with this result
Definition OSResult.h:1953
std::string description
other data elements are optional
Definition OSResult.h:1946
#define OS_SCHEMA_VERSION
@ ENUM_OUTPUT_LEVEL_trace
@ ENUM_OUTPUT_AREA_OSrLwriter