My Project
OSoLWriter.cpp
Go to the documentation of this file.
1/* $Id$ */
15
16
17#include "OSoLWriter.h"
18#include "OSOption.h"
19#include "OSgLWriter.h"
20#include "OSGeneral.h"
21#include "OSStringUtil.h"
22#include "OSParameters.h"
23#include "OSConfig.h"
24#include "OSBase64.h"
25#include "OSMathUtil.h"
26#include "OSOutput.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 OSoLWriter::writeOSoL( OSOption *theosoption)
46{
47 m_OSOption = theosoption;
48 std::ostringstream osolStr, 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 = "http://www.coin-or.org/OS/stylesheets/";
59
60 bool generalTagPrinted;
61#ifndef NDEBUG
63#endif
64
65 if(m_OSOption == NULL) return osolStr.str();
66 osolStr << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" ;
67 osolStr << "<?xml-stylesheet type=\"text/xsl\" href=\"";
68 osolStr << xsltDir;
69 osolStr << "OSoL.xslt\"?>";
70 osolStr << endl;
71 osolStr << "<osol xmlns=\"os.optimizationservices.org\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" ";
72 osolStr << "xsi:schemaLocation=\"os.optimizationservices.org http://www.optimizationservices.org/schemas/";
73 osolStr << OS_SCHEMA_VERSION;
74 osolStr << "/OSoL.xsd\" >" ;
75 osolStr << endl;
76
77#ifndef NDEBUG
78 osoutput->OSPrint(ENUM_OUTPUT_AREA_OSoLwriter, ENUM_OUTPUT_LEVEL_trace, "output <optionHeader>");
79#endif
80 if(m_OSOption->optionHeader != NULL)
81 {
82 osolStr << "<optionHeader>" << endl;
83 osolStr << writeGeneralFileHeader(m_OSOption->optionHeader, true);
84 osolStr << "</optionHeader>" << endl;
85 }
86
87#ifndef NDEBUG
89#endif
90 if(m_OSOption->general != NULL)
91 {
92 generalTagPrinted = false;
93 if (m_OSOption->general->serviceURI != "")
94 {
95 if (generalTagPrinted == false)
96 {
97 osolStr << "<general>" << endl;
98 generalTagPrinted = true;
99 }
100 osolStr << "<serviceURI>" << m_OSOption->general->serviceURI << "</serviceURI>" << endl;
101 }
102 if (m_OSOption->general->serviceName != "")
103 {
104 if (generalTagPrinted == false)
105 {
106 osolStr << "<general>" << endl;
107 generalTagPrinted = true;
108 }
109 osolStr << "<serviceName>" << m_OSOption->general->serviceName << "</serviceName>" << endl;
110 }
111 if (m_OSOption->general->instanceName != "")
112 {
113 if (generalTagPrinted == false)
114 {
115 osolStr << "<general>" << endl;
116 generalTagPrinted = true;
117 }
118 osolStr << "<instanceName>" << m_OSOption->general->instanceName << "</instanceName>" << endl;
119 }
120 if (m_OSOption->general->instanceLocation != NULL)
121 {
122 if (generalTagPrinted == false)
123 {
124 osolStr << "<general>" << endl;
125 generalTagPrinted = true;
126 }
127 if (m_OSOption->general->instanceLocation->locationType == "")
128 {
129 osolStr << "<instanceLocation>";
130 }
131 else
132 {
133 osolStr << "<instanceLocation locationType=\"" << m_OSOption->general->instanceLocation->locationType << "\">";
134 };
135 osolStr << m_OSOption->general->instanceLocation->value << "</instanceLocation>" << endl;
136 }
137 if (m_OSOption->general->jobID != "")
138 {
139 if (generalTagPrinted == false)
140 {
141 osolStr << "<general>" << endl;
142 generalTagPrinted = true;
143 }
144 osolStr << "<jobID>" << m_OSOption->general->jobID << "</jobID>" << endl;
145 }
146 if (m_OSOption->general->solverToInvoke != "")
147 {
148 if (generalTagPrinted == false)
149 {
150 osolStr << "<general>" << endl;
151 generalTagPrinted = true;
152 }
153 osolStr << "<solverToInvoke>" << m_OSOption->general->solverToInvoke << "</solverToInvoke>" << endl;
154 }
155 if (m_OSOption->general->license != "")
156 {
157 if (generalTagPrinted == false)
158 {
159 osolStr << "<general>" << endl;
160 generalTagPrinted = true;
161 }
162 osolStr << "<license>" << m_OSOption->general->license << "</license>" << endl;
163 }
164 if (m_OSOption->general->userName != "")
165 {
166 if (generalTagPrinted == false)
167 {
168 osolStr << "<general>" << endl;
169 generalTagPrinted = true;
170 }
171 osolStr << "<userName>" << m_OSOption->general->userName << "</userName>" << endl;
172 }
173 if (m_OSOption->general->password != "")
174 {
175 if (generalTagPrinted == false)
176 {
177 osolStr << "<general>" << endl;
178 generalTagPrinted = true;
179 }
180 osolStr << "<password>" << m_OSOption->general->password << "</password>" << endl;
181 }
182 if (m_OSOption->general->contact != NULL)
183 {
184 if (generalTagPrinted == false)
185 {
186 osolStr << "<general>" << endl;
187 generalTagPrinted = true;
188 }
189 if (m_OSOption->general->contact->transportType == "")
190 {
191 osolStr << "<contact>";
192 }
193 else
194 {
195 osolStr << "<contact transportType=\"" << m_OSOption->general->contact->transportType << "\">";
196 };
197 osolStr << m_OSOption->general->contact->value << "</contact>" << endl;
198 }
199 if (m_OSOption->general->otherOptions != NULL)
200 {
201 if (generalTagPrinted == false)
202 {
203 osolStr << "<general>" << endl;
204 generalTagPrinted = true;
205 }
206 osolStr << "<otherOptions numberOfOtherOptions=\"";
207 osolStr << m_OSOption->general->otherOptions->numberOfOtherOptions << "\">" << endl;
208 for (int i=0; i < m_OSOption->general->otherOptions->numberOfOtherOptions; i++)
209 {
210 osolStr << "<other name=\"" << m_OSOption->general->otherOptions->other[i]->name << "\"";
211 if (m_OSOption->general->otherOptions->other[i]->value != "")
212 osolStr << " value=\"" << m_OSOption->general->otherOptions->other[i]->value << "\"";
213 if (m_OSOption->general->otherOptions->other[i]->description != "")
214 osolStr << " description=" << writeStringData(m_OSOption->general->otherOptions->other[i]->description);
215 osolStr << "/>" << endl;
216 }
217 osolStr << "</otherOptions>" << endl;
218 }
219 if (generalTagPrinted == false)
220 osolStr << "<general>" << endl;
221
222 osolStr << "</general>" << endl;
223#ifndef NDEBUG
224 osoutput->OSPrint(ENUM_OUTPUT_AREA_OSoLwriter, ENUM_OUTPUT_LEVEL_trace, "Done with <general> element");
225#endif
226 };
227
231 if(m_OSOption->system != NULL)
232 {
233
234 osolStr << "<system>" << endl;
235 if (m_OSOption->system->minDiskSpace != NULL)
236 {
237 osolStr << "<minDiskSpace";
238 if (m_OSOption->system->minDiskSpace->unit != "byte")
239 osolStr << " unit=\"" << m_OSOption->system->minDiskSpace->unit << "\"";
240 if (m_OSOption->system->minDiskSpace->description != "")
241 osolStr << " description=" << writeStringData(m_OSOption->system->minDiskSpace->description);
242 osolStr << ">";
243 if (!OSIsnan(m_OSOption->system->minDiskSpace->value))
244 osolStr << os_dtoa_format(m_OSOption->system->minDiskSpace->value);
245 else
246 osolStr << "NaN";
247 osolStr << "</minDiskSpace>" << endl;
248 }
249 if (m_OSOption->system->minMemorySize != NULL)
250 {
251 osolStr << "<minMemorySize";
252 if (m_OSOption->system->minMemorySize->unit != "byte")
253 osolStr << " unit=\"" << m_OSOption->system->minMemorySize->unit << "\"";
254 if (m_OSOption->system->minMemorySize->description != "")
255 osolStr << " description=" << writeStringData(m_OSOption->system->minMemorySize->description);
256 osolStr << ">";
257 if (!OSIsnan(m_OSOption->system->minMemorySize->value))
258 osolStr << os_dtoa_format(m_OSOption->system->minMemorySize->value);
259 else
260 osolStr << "NaN";
261 osolStr << "</minMemorySize>" << endl;
262 }
263 if (m_OSOption->system->minCPUSpeed != NULL)
264 {
265 osolStr << "<minCPUSpeed";
266 if (m_OSOption->system->minCPUSpeed->unit != "hertz")
267 osolStr << " unit=\"" << m_OSOption->system->minCPUSpeed->unit << "\"";
268 if (m_OSOption->system->minCPUSpeed->description != "")
269 osolStr << " description=" << writeStringData(m_OSOption->system->minCPUSpeed->description);
270 osolStr << ">";
271 if (!OSIsnan(m_OSOption->system->minCPUSpeed->value))
272 osolStr << os_dtoa_format(m_OSOption->system->minCPUSpeed->value);
273 else
274 osolStr << "NaN";
275 osolStr << "</minCPUSpeed>" << endl;
276 }
277 if (m_OSOption->system->minCPUNumber != NULL)
278 {
279 osolStr << "<minCPUNumber";
280 if (m_OSOption->system->minCPUNumber->description != "")
281 osolStr << " description=" << writeStringData(m_OSOption->system->minCPUNumber->description);
282 osolStr << ">";
283 osolStr << m_OSOption->system->minCPUNumber->value << "</minCPUNumber>" << endl;
284 };
285 if (m_OSOption->system->otherOptions != NULL)
286 {
287 osolStr << "<otherOptions numberOfOtherOptions=\"";
288 osolStr << m_OSOption->system->otherOptions->numberOfOtherOptions << "\">" << endl;
289 for (int i=0; i < m_OSOption->system->otherOptions->numberOfOtherOptions; i++)
290 {
291 osolStr << "<other name=\"" << m_OSOption->system->otherOptions->other[i]->name << "\"";
292 if (m_OSOption->system->otherOptions->other[i]->value != "")
293 osolStr << " value=\"" << m_OSOption->system->otherOptions->other[i]->value << "\"";
294 if (m_OSOption->system->otherOptions->other[i]->description != "")
295 osolStr << " description=" << writeStringData(m_OSOption->system->otherOptions->other[i]->description);
296 osolStr << "/>" << endl;
297 }
298 osolStr << "</otherOptions>" << endl;
299 }
300 osolStr << "</system>" << endl;
301#ifndef NDEBUG
302 osoutput->OSPrint(ENUM_OUTPUT_AREA_OSoLwriter, ENUM_OUTPUT_LEVEL_trace, "Done with <system> element");
303#endif
304 }
305
309 if(m_OSOption->service != NULL)
310 {
311 osolStr << "<service>" << endl;
312 if (m_OSOption->service->type != "")
313 {
314 osolStr << "<type>" << m_OSOption->service->type << "</type>" << endl;
315 }
316 if (m_OSOption->service->otherOptions != NULL)
317 {
318 osolStr << "<otherOptions numberOfOtherOptions=\"";
319 osolStr << m_OSOption->service->otherOptions->numberOfOtherOptions << "\">" << endl;
320 for (int i=0; i < m_OSOption->service->otherOptions->numberOfOtherOptions; i++)
321 {
322 osolStr << "<other name=\"" << m_OSOption->service->otherOptions->other[i]->name << "\"";
323 if (m_OSOption->service->otherOptions->other[i]->value != "")
324 osolStr << " value=\"" << m_OSOption->service->otherOptions->other[i]->value << "\"";
325 if (m_OSOption->service->otherOptions->other[i]->description != "")
326 osolStr << " description=" << writeStringData(m_OSOption->service->otherOptions->other[i]->description);
327 osolStr << "/>" << endl;
328 }
329 osolStr << "</otherOptions>" << endl;
330 }
331 osolStr << "</service>" << endl;
332#ifndef NDEBUG
333 osoutput->OSPrint(ENUM_OUTPUT_AREA_OSoLwriter, ENUM_OUTPUT_LEVEL_trace, "Done with <service> element");
334#endif
335 };
336
340 if(m_OSOption->job != NULL)
341 {
342 osolStr << "<job>" << endl;
343 if (m_OSOption->job->maxTime != NULL)
344 {
345 if (m_OSOption->job->maxTime->unit == "")
346 m_OSOption->job->maxTime->unit = "second";
347 osolStr << "<maxTime unit=\"" << m_OSOption->job->maxTime->unit << "\">";
348 if (!OSIsnan(m_OSOption->job->maxTime->value))
349 osolStr << os_dtoa_format(m_OSOption->job->maxTime->value);
350 else
351 osolStr << "NaN";
352 osolStr << "</maxTime>" << endl;
353 }
354 if (m_OSOption->job->requestedStartTime != "")
355 osolStr << "<requestedStartTime>" << m_OSOption->job->requestedStartTime << "</requestedStartTime>" << endl;
356 if (m_OSOption->job->dependencies != NULL)
357 {
358 osolStr << "<dependencies numberOfJobIDs=\"";
359 osolStr << m_OSOption->job->dependencies->numberOfJobIDs << "\">" << endl;
360 for (int i=0; i < m_OSOption->job->dependencies->numberOfJobIDs; i++)
361 osolStr << "<jobID>" << m_OSOption->job->dependencies->jobID[i] << "</jobID>" << endl;
362 osolStr << "</dependencies>" << endl;
363 }
364 if (m_OSOption->job->requiredDirectories != NULL)
365 {
366 osolStr << "<requiredDirectories numberOfPaths=\"";
367 osolStr << m_OSOption->job->requiredDirectories->numberOfPaths << "\">" << endl;
368 for (int i=0; i < m_OSOption->job->requiredDirectories->numberOfPaths; i++)
369 osolStr << "<path>" << m_OSOption->job->requiredDirectories->path[i] << "</path>" << endl;
370 osolStr << "</requiredDirectories>" << endl;
371 }
372 if (m_OSOption->job->requiredFiles != NULL)
373 {
374 osolStr << "<requiredFiles numberOfPaths=\"";
375 osolStr << m_OSOption->job->requiredFiles->numberOfPaths << "\">" << endl;
376 for (int i=0; i < m_OSOption->job->requiredFiles->numberOfPaths; i++)
377 osolStr << "<path>" << m_OSOption->job->requiredFiles->path[i] << "</path>" << endl;
378 osolStr << "</requiredFiles>" << endl;
379 }
380 if (m_OSOption->job->directoriesToMake != NULL)
381 {
382 osolStr << "<directoriesToMake numberOfPaths=\"";
383 osolStr << m_OSOption->job->directoriesToMake->numberOfPaths << "\">" << endl;
384 for (int i=0; i < m_OSOption->job->directoriesToMake->numberOfPaths; i++)
385 osolStr << "<path>" << m_OSOption->job->directoriesToMake->path[i] << "</path>" << endl;
386
387 osolStr << "</directoriesToMake>" << endl;
388 }
389 if (m_OSOption->job->filesToMake != NULL)
390 {
391 osolStr << "<filesToMake numberOfPaths=\"";
392 osolStr << m_OSOption->job->filesToMake->numberOfPaths << "\">" << endl;
393 for (int i=0; i < m_OSOption->job->filesToMake->numberOfPaths; i++)
394 osolStr << "<path>" << m_OSOption->job->filesToMake->path[i] << "</path>" << endl;
395 osolStr << "</filesToMake>" << endl;
396 }
397 if (m_OSOption->job->inputDirectoriesToMove != NULL)
398 {
399 osolStr << "<inputDirectoriesToMove numberOfPathPairs=\"";
400 osolStr << m_OSOption->job->inputDirectoriesToMove->numberOfPathPairs << "\">" << endl;
401 for (int i=0; i < m_OSOption->job->inputDirectoriesToMove->numberOfPathPairs; i++)
402 {
403 osolStr << "<pathPair";
404 osolStr << " from=\"" << m_OSOption->job->inputDirectoriesToMove->pathPair[i]->from << "\"";
405 osolStr << " to=\"" << m_OSOption->job->inputDirectoriesToMove->pathPair[i]->to << "\"";
406 if (m_OSOption->job->inputDirectoriesToMove->pathPair[i]->makeCopy)
407 osolStr << " makeCopy=\"true\"";
408 osolStr << "/>" << endl;
409 }
410 osolStr << "</inputDirectoriesToMove>" << endl;
411 }
412 if (m_OSOption->job->inputFilesToMove != NULL)
413 {
414 osolStr << "<inputFilesToMove numberOfPathPairs=\"";
415 osolStr << m_OSOption->job->inputFilesToMove->numberOfPathPairs << "\">" << endl;
416 for (int i=0; i < m_OSOption->job->inputFilesToMove->numberOfPathPairs; i++)
417 {
418 osolStr << "<pathPair";
419 osolStr << " from=\"" << m_OSOption->job->inputFilesToMove->pathPair[i]->from << "\"";
420 osolStr << " to=\"" << m_OSOption->job->inputFilesToMove->pathPair[i]->to << "\"";
421 if (m_OSOption->job->inputFilesToMove->pathPair[i]->makeCopy)
422 osolStr << " makeCopy=\"true\"";
423 osolStr << "/>" << endl;
424 }
425 osolStr << "</inputFilesToMove>" << endl;
426 }
427 if (m_OSOption->job->outputFilesToMove != NULL)
428 {
429 osolStr << "<outputFilesToMove numberOfPathPairs=\"";
430 osolStr << m_OSOption->job->outputFilesToMove->numberOfPathPairs << "\">" << endl;
431 for (int i=0; i < m_OSOption->job->outputFilesToMove->numberOfPathPairs; i++)
432 {
433 osolStr << "<pathPair";
434 osolStr << " from=\"" << m_OSOption->job->outputFilesToMove->pathPair[i]->from << "\"";
435 osolStr << " to=\"" << m_OSOption->job->outputFilesToMove->pathPair[i]->to << "\"";
436 if (m_OSOption->job->outputFilesToMove->pathPair[i]->makeCopy)
437 osolStr << " makeCopy=\"true\"";
438 osolStr << "/>" << endl;
439 }
440 osolStr << "</outputFilesToMove>" << endl;
441 }
442 if (m_OSOption->job->outputDirectoriesToMove != NULL)
443 {
444 osolStr << "<outputDirectoriesToMove numberOfPathPairs=\"";
445 osolStr << m_OSOption->job->outputDirectoriesToMove->numberOfPathPairs << "\">" << endl;
446 for (int i=0; i < m_OSOption->job->outputDirectoriesToMove->numberOfPathPairs; i++)
447 {
448 osolStr << "<pathPair";
449 osolStr << " from=\"" << m_OSOption->job->outputDirectoriesToMove->pathPair[i]->from << "\"";
450 osolStr << " to=\"" << m_OSOption->job->outputDirectoriesToMove->pathPair[i]->to << "\"";
451 if (m_OSOption->job->outputDirectoriesToMove->pathPair[i]->makeCopy)
452 osolStr << " makeCopy=\"true\"";
453 osolStr << "/>" << endl;
454 }
455 osolStr << "</outputDirectoriesToMove>" << endl;
456 }
457 if (m_OSOption->job->filesToDelete != NULL)
458 {
459 osolStr << "<filesToDelete numberOfPaths=\"";
460 osolStr << m_OSOption->job->filesToDelete->numberOfPaths << "\">" << endl;
461 for (int i=0; i < m_OSOption->job->filesToDelete->numberOfPaths; i++)
462 osolStr << "<path>" << m_OSOption->job->filesToDelete->path[i] << "</path>" << endl;
463 osolStr << "</filesToDelete>" << endl;
464 }
465 if (m_OSOption->job->directoriesToDelete != NULL)
466 {
467 osolStr << "<directoriesToDelete numberOfPaths=\"";
468 osolStr << m_OSOption->job->directoriesToDelete->numberOfPaths << "\">" << endl;
469 for (int i=0; i < m_OSOption->job->directoriesToDelete->numberOfPaths; i++)
470 osolStr << "<path>" << m_OSOption->job->directoriesToDelete->path[i] << "</path>" << endl;
471 osolStr << "</directoriesToDelete>" << endl;
472 }
473 if (m_OSOption->job->processesToKill != NULL)
474 {
475 osolStr << "<processesToKill numberOfProcesses=\"";
476 osolStr << m_OSOption->job->processesToKill->numberOfProcesses << "\">" << endl;
477 for (int i=0; i < m_OSOption->job->processesToKill->numberOfProcesses; i++)
478 osolStr << "<process>" << m_OSOption->job->processesToKill->process[i] << "</process>" << endl;
479 osolStr << "</processesToKill>" << endl;
480 }
481 if (m_OSOption->job->otherOptions != NULL)
482 {
483 osolStr << "<otherOptions numberOfOtherOptions=\"";
484 osolStr << m_OSOption->job->otherOptions->numberOfOtherOptions << "\">" << endl;
485 for (int i=0; i < m_OSOption->job->otherOptions->numberOfOtherOptions; i++)
486 {
487 osolStr << "<other name=\"" << m_OSOption->job->otherOptions->other[i]->name << "\"";
488 if (m_OSOption->job->otherOptions->other[i]->value != "")
489 osolStr << " value=\"" << m_OSOption->job->otherOptions->other[i]->value << "\"";
490 if (m_OSOption->job->otherOptions->other[i]->description != "")
491 osolStr << " description=" << writeStringData(m_OSOption->job->otherOptions->other[i]->description);
492 osolStr << "/>" << endl;
493 }
494 osolStr << "</otherOptions>" << endl;
495 }
496 osolStr << "</job>" << endl;
497#ifndef NDEBUG
498 osoutput->OSPrint(ENUM_OUTPUT_AREA_OSoLwriter, ENUM_OUTPUT_LEVEL_trace, "Done with <job> element");
499#endif
500 };
501
505 if (m_OSOption->optimization != NULL)
506 {
507 osolStr << "<optimization";
508 if (m_OSOption->optimization->numberOfVariables >= 0)
509 osolStr << " numberOfVariables=\"" << m_OSOption->optimization->numberOfVariables << "\" ";
510 if (m_OSOption->optimization->numberOfObjectives >= 0)
511 osolStr << " numberOfObjectives=\"" << m_OSOption->optimization->numberOfObjectives << "\" ";
512 if (m_OSOption->optimization->numberOfConstraints >= 0)
513 osolStr << " numberOfConstraints=\"" << m_OSOption->optimization->numberOfConstraints << "\" ";
514 osolStr << ">" << endl;
515 if (m_OSOption->optimization->variables != NULL)
516 {
517 osolStr << "<variables";
518 if (m_OSOption->optimization->variables->numberOfOtherVariableOptions > 0)
519 osolStr << " numberOfOtherVariableOptions=\"" << m_OSOption->optimization->variables->numberOfOtherVariableOptions << "\"";
520 osolStr << ">" << endl;
521#ifndef NDEBUG
522 outStr.str("");
523 outStr.clear();
524 outStr << "initialVariableValues: "
525 << (m_OSOption->optimization->variables->initialVariableValues != NULL) << endl;
527#endif
528 if (m_OSOption->optimization->variables->initialVariableValues != NULL)
529 {
530 osolStr << "<initialVariableValues numberOfVar=\"";
531 osolStr << m_OSOption->optimization->variables->initialVariableValues->numberOfVar << "\">" << endl;
532 for (int i=0; i < m_OSOption->optimization->variables->initialVariableValues->numberOfVar; i++)
533 {
534 osolStr << "<var";
535 osolStr << " idx=\"" << m_OSOption->optimization->variables->initialVariableValues->var[i]->idx << "\"";
536 if (m_OSOption->optimization->variables->initialVariableValues->var[i]->name != "")
537 osolStr << " name=" << writeStringData(m_OSOption->optimization->variables->initialVariableValues->var[i]->name);
538 if (!OSIsnan(m_OSOption->optimization->variables->initialVariableValues->var[i]->value))
539 {
540 osolStr << " value=\"";
541 osolStr << os_dtoa_format(m_OSOption->optimization->variables->initialVariableValues->var[i]->value);
542 osolStr << "\"";
543 }
544 osolStr << "/>" << endl;
545 }
546 osolStr << "</initialVariableValues>" << endl;
547 }
548#ifndef NDEBUG
549 outStr.str("");
550 outStr.clear();
551 outStr << "initialVariableValuesString: "
552 << (m_OSOption->optimization->variables->initialVariableValuesString != NULL) << endl;
554#endif
555 if (m_OSOption->optimization->variables->initialVariableValuesString != NULL)
556 {
557 osolStr << "<initialVariableValuesString numberOfVar=\"";
558 osolStr << m_OSOption->optimization->variables->initialVariableValuesString->numberOfVar << "\">" << endl;
559 for (int i=0; i < m_OSOption->optimization->variables->initialVariableValuesString->numberOfVar; i++)
560 {
561 osolStr << "<var";
562 osolStr << " idx=\"" << m_OSOption->optimization->variables->initialVariableValuesString->var[i]->idx << "\"";
563 if (m_OSOption->optimization->variables->initialVariableValuesString->var[i]->name != "")
564 osolStr << " name=" << writeStringData(m_OSOption->optimization->variables->initialVariableValuesString->var[i]->name);
565 osolStr << " value=\"" << m_OSOption->optimization->variables->initialVariableValuesString->var[i]->value << "\"";
566 osolStr << "/>" << endl;
567 }
568 osolStr << "</initialVariableValuesString>" << endl;
569 }
570
571 if (m_OSOption->optimization->variables->initialBasisStatus != NULL)
572 {
573#ifndef NDEBUG
575 "output <variables> <basisStatus>");
576#endif
577 osolStr << "<initialBasisStatus>" << endl;
578 osolStr << writeBasisStatus(m_OSOption->optimization->variables->initialBasisStatus, m_bWhiteSpace, m_bWriteBase64);
579 osolStr << "</initialBasisStatus>" << endl;
580 }
581
582#ifndef NDEBUG
583 outStr.str("");
584 outStr.clear();
585 outStr << "integerVariableBranchingWeights: "
586 << (m_OSOption->optimization->variables->integerVariableBranchingWeights != NULL) << endl;
588#endif
589 if (m_OSOption->optimization->variables->integerVariableBranchingWeights != NULL)
590 {
591 osolStr << "<integerVariableBranchingWeights numberOfVar=\"";
592 osolStr << m_OSOption->optimization->variables->integerVariableBranchingWeights->numberOfVar << "\">" << endl;
593 for (int i=0; i < m_OSOption->optimization->variables->integerVariableBranchingWeights->numberOfVar; i++)
594 {
595 osolStr << "<var";
596 osolStr << " idx=\"" << m_OSOption->optimization->variables->integerVariableBranchingWeights->var[i]->idx << "\"";
597 if (m_OSOption->optimization->variables->integerVariableBranchingWeights->var[i]->name != "")
598 osolStr << " name=" << writeStringData(m_OSOption->optimization->variables->integerVariableBranchingWeights->var[i]->name);
599 if (!OSIsnan(m_OSOption->optimization->variables->integerVariableBranchingWeights->var[i]->value))
600 {
601 osolStr << " value=\"";
602 osolStr << os_dtoa_format(m_OSOption->optimization->variables->integerVariableBranchingWeights->var[i]->value);
603 osolStr << "\"";
604 }
605 osolStr << "/>" << endl;
606 }
607 osolStr << "</integerVariableBranchingWeights>" << endl;
608 }
609#ifndef NDEBUG
610 outStr.str("");
611 outStr.clear();
612 outStr << "sosVariableBranchingWeights: "
613 << (m_OSOption->optimization->variables->sosVariableBranchingWeights != NULL) << endl;
615#endif
616 if (m_OSOption->optimization->variables->sosVariableBranchingWeights != NULL)
617 {
618 osolStr << "<sosVariableBranchingWeights numberOfSOS=\"";
619#ifndef NDEBUG
620 osoutput->OSPrint(ENUM_OUTPUT_AREA_OSoLwriter, ENUM_OUTPUT_LEVEL_trace, "start: numberOfSOS");
621#endif
622 osolStr << m_OSOption->optimization->variables->sosVariableBranchingWeights->numberOfSOS << "\">" << endl;
623 for (int i=0; i < m_OSOption->optimization->variables->sosVariableBranchingWeights->numberOfSOS; i++)
624 {
625 osolStr << "<sos";
626#ifndef NDEBUG
627 outStr.str("");
628 outStr.clear();
629 outStr << "sosIdx - nvar: "
630 << m_OSOption->optimization->variables->sosVariableBranchingWeights->sos[i]->numberOfVar
631 << endl;
633#endif
634 osolStr << " sosIdx=\"" << m_OSOption->optimization->variables->sosVariableBranchingWeights->sos[i]->sosIdx << "\"";
635 osolStr << " numberOfVar=\"" << m_OSOption->optimization->variables->sosVariableBranchingWeights->sos[i]->numberOfVar << "\"";
636 if (!OSIsnan(m_OSOption->optimization->variables->sosVariableBranchingWeights->sos[i]->groupWeight))
637 {
638 osolStr << " groupWeight=\"";
639 osolStr << os_dtoa_format(m_OSOption->optimization->variables->sosVariableBranchingWeights->sos[i]->groupWeight);
640 osolStr << "\">" << endl;
641 }
642 for (int j=0; j < m_OSOption->optimization->variables->sosVariableBranchingWeights->sos[i]->numberOfVar; j++)
643 {
644 osolStr << "<var";
645#ifndef NDEBUG
647#endif
648 osolStr << " idx=\"" << m_OSOption->optimization->variables->sosVariableBranchingWeights->sos[i]->var[j]->idx << "\"";
649 if (m_OSOption->optimization->variables->sosVariableBranchingWeights->sos[i]->var[j]->name != "")
650 osolStr << " name=" << writeStringData(m_OSOption->optimization->variables->sosVariableBranchingWeights->sos[i]->var[j]->name);
651 if (!OSIsnan(m_OSOption->optimization->variables->sosVariableBranchingWeights->sos[i]->var[j]->value))
652 {
653 osolStr << " value=\"";
654 osolStr << os_dtoa_format(m_OSOption->optimization->variables->sosVariableBranchingWeights->sos[i]->var[j]->value);
655 osolStr << "\"";
656 }
657 osolStr << "/>" << endl;
658 }
659 osolStr << "</sos>" << endl;
660 }
661 osolStr << "</sosVariableBranchingWeights>" << endl;
662 }
663#ifndef NDEBUG
664 outStr.str("");
665 outStr.clear();
666 outStr << "Number of other variable options: "
667 << m_OSOption->optimization->variables->numberOfOtherVariableOptions
668 << std::endl;
670#endif
671// if (m_OSOption->optimization->variables->numberOfOtherVariableOptions > 0)
672 for (int i=0; i < m_OSOption->optimization->variables->numberOfOtherVariableOptions; i++)
673 {
674 osolStr << "<other name=\"" << m_OSOption->optimization->variables->other[i]->name << "\"";
675// if (m_OSOption->optimization->variables->other[i]->numberOfVar > 0)
676 osolStr << " numberOfVar=\"" << m_OSOption->optimization->variables->other[i]->numberOfVar << "\"";
677// if (m_OSOption->optimization->variables->other[i]->numberOfEnumerations > 0)
678 osolStr << " numberOfEnumerations=\"" << m_OSOption->optimization->variables->other[i]->numberOfEnumerations << "\"";
679 if (m_OSOption->optimization->variables->other[i]->value != "")
680 osolStr << " value=\"" << m_OSOption->optimization->variables->other[i]->value << "\"";
681 if (m_OSOption->optimization->variables->other[i]->solver != "")
682 osolStr << " solver=\"" << m_OSOption->optimization->variables->other[i]->solver << "\"";
683 if (m_OSOption->optimization->variables->other[i]->category != "")
684 osolStr << " category=\"" << m_OSOption->optimization->variables->other[i]->category << "\"";
685 if (m_OSOption->optimization->variables->other[i]->type != "")
686 osolStr << " type=\"" << m_OSOption->optimization->variables->other[i]->type << "\"";
687 if (m_OSOption->optimization->variables->other[i]->description != "")
688 osolStr << " description=" << writeStringData(m_OSOption->optimization->variables->other[i]->description);
689 if (m_OSOption->optimization->variables->other[i]->varType != "")
690 osolStr << " varType=\"" << m_OSOption->optimization->variables->other[i]->varType << "\"";
691 if (m_OSOption->optimization->variables->other[i]->enumType != "")
692 osolStr << " enumType=\"" << m_OSOption->optimization->variables->other[i]->enumType << "\"";
693 osolStr << ">" << endl;
694// if (m_OSOption->optimization->variables->other[i]->numberOfVar > 0)
695 for (int j=0; j < m_OSOption->optimization->variables->other[i]->numberOfVar; j++)
696 {
697 osolStr << "<var idx=\"" << m_OSOption->optimization->variables->other[i]->var[j]->idx << "\"";
698 if (m_OSOption->optimization->variables->other[i]->var[j]->name != "")
699 osolStr << " name=" << writeStringData(m_OSOption->optimization->variables->other[i]->var[j]->name);
700 if (m_OSOption->optimization->variables->other[i]->var[j]->value != "")
701 osolStr << " value=\"" << m_OSOption->optimization->variables->other[i]->var[j]->value << "\"";
702 if (m_OSOption->optimization->variables->other[i]->var[j]->lbValue != "")
703 osolStr << " lbValue=\"" << m_OSOption->optimization->variables->other[i]->var[j]->lbValue << "\"";
704 if (m_OSOption->optimization->variables->other[i]->var[j]->ubValue != "")
705 osolStr << " ubValue=\"" << m_OSOption->optimization->variables->other[i]->var[j]->ubValue << "\"";
706 osolStr << "/>" << endl;
707 }
708// else
709 {
710// if (m_OSOption->optimization->variables->other[i]->numberOfEnumerations > 0)
711 for (int j=0; j < m_OSOption->optimization->variables->other[i]->numberOfEnumerations; j++)
712 osolStr << writeOtherOptionOrResultEnumeration(m_OSOption->optimization->variables->other[i]->enumeration[j], m_bWhiteSpace, m_bWriteBase64);
713 }
714 osolStr << "</other>" << endl;
715 }
716 osolStr << "</variables>" << endl;
717 }
718 if (m_OSOption->optimization->objectives != NULL)
719 {
720 osolStr << "<objectives";
721// if (m_OSOption->optimization->objectives->numberOfOtherObjectiveOptions > 0)
722 osolStr << " numberOfOtherObjectiveOptions=\"" << m_OSOption->optimization->objectives->numberOfOtherObjectiveOptions << "\"";
723 osolStr << ">" << endl;
724 if (m_OSOption->optimization->objectives->initialObjectiveValues != NULL)
725 {
726 osolStr << "<initialObjectiveValues numberOfObj=\"";
727 osolStr << m_OSOption->optimization->objectives->initialObjectiveValues->numberOfObj << "\">" << endl;
728 for (int i=0; i < m_OSOption->optimization->objectives->initialObjectiveValues->numberOfObj; i++)
729 {
730 osolStr << "<obj";
731 osolStr << " idx=\"" << m_OSOption->optimization->objectives->initialObjectiveValues->obj[i]->idx << "\"";
732 if (m_OSOption->optimization->objectives->initialObjectiveValues->obj[i]->name != "")
733 osolStr << " name=" << writeStringData(m_OSOption->optimization->objectives->initialObjectiveValues->obj[i]->name);
734 if (!OSIsnan(m_OSOption->optimization->objectives->initialObjectiveValues->obj[i]->value))
735 {
736 osolStr << " value=\"";
737 osolStr << os_dtoa_format(m_OSOption->optimization->objectives->initialObjectiveValues->obj[i]->value);
738 osolStr << "\"";
739 }
740 osolStr << "/>" << endl;
741 }
742 osolStr << "</initialObjectiveValues>" << endl;
743 }
744 if (m_OSOption->optimization->objectives->initialObjectiveBounds != NULL)
745 {
746 osolStr << "<initialObjectiveBounds numberOfObj=\"";
747 osolStr << m_OSOption->optimization->objectives->initialObjectiveBounds->numberOfObj << "\">" << endl;
748 for (int i=0; i < m_OSOption->optimization->objectives->initialObjectiveBounds->numberOfObj; i++)
749 {
750 osolStr << "<obj";
751 osolStr << " idx=\"" << m_OSOption->optimization->objectives->initialObjectiveBounds->obj[i]->idx << "\"";
752 if (m_OSOption->optimization->objectives->initialObjectiveBounds->obj[i]->name != "")
753 osolStr << " name=" << writeStringData(m_OSOption->optimization->objectives->initialObjectiveBounds->obj[i]->name);
754 if (!OSIsnan(m_OSOption->optimization->objectives->initialObjectiveBounds->obj[i]->lbValue))
755 {
756 osolStr << " lbValue=\"";
757 osolStr << os_dtoa_format(m_OSOption->optimization->objectives->initialObjectiveBounds->obj[i]->lbValue);
758 osolStr << "\"";
759 }
760 if (!OSIsnan(m_OSOption->optimization->objectives->initialObjectiveBounds->obj[i]->ubValue))
761 {
762 osolStr << " ubValue=\"";
763 osolStr << os_dtoa_format(m_OSOption->optimization->objectives->initialObjectiveBounds->obj[i]->ubValue);
764 osolStr << "\"";
765 }
766 osolStr << "/>" << endl;
767 }
768 osolStr << "</initialObjectiveBounds>" << endl;
769 }
770
771 if (m_OSOption->optimization->objectives->initialBasisStatus != NULL)
772 {
773#ifndef NDEBUG
775 "output <objectives> <basisStatus>");
776#endif
777 osolStr << "<initialBasisStatus>" << endl;
778 osolStr << writeBasisStatus(m_OSOption->optimization->objectives->initialBasisStatus, m_bWhiteSpace, m_bWriteBase64);
779 osolStr << "</initialBasisStatus>" << endl;
780 }
781
782#ifndef NDEBUG
783 outStr.str("");
784 outStr.clear();
785 outStr << "Number of other objective options: "
786 << m_OSOption->optimization->objectives->numberOfOtherObjectiveOptions << std::endl;
788#endif
789// if (m_OSOption->optimization->objectives->numberOfOtherObjectiveOptions > 0)
790 for (int i=0; i < m_OSOption->optimization->objectives->numberOfOtherObjectiveOptions; i++)
791 {
792 osolStr << "<other name=\"" << m_OSOption->optimization->objectives->other[i]->name << "\"";
793// if (m_OSOption->optimization->objectives->other[i]->numberOfObj > 0)
794 osolStr << " numberOfObj=\"" << m_OSOption->optimization->objectives->other[i]->numberOfObj << "\"";
795// if (m_OSOption->optimization->objectives->other[i]->numberOfEnumerations > 0)
796 osolStr << " numberOfEnumerations=\"" << m_OSOption->optimization->objectives->other[i]->numberOfEnumerations << "\"";
797 if (m_OSOption->optimization->objectives->other[i]->value != "")
798 osolStr << " value=\"" << m_OSOption->optimization->objectives->other[i]->value << "\"";
799 if (m_OSOption->optimization->objectives->other[i]->solver != "")
800 osolStr << " solver=\"" << m_OSOption->optimization->objectives->other[i]->solver << "\"";
801 if (m_OSOption->optimization->objectives->other[i]->category != "")
802 osolStr << " category=\"" << m_OSOption->optimization->objectives->other[i]->category << "\"";
803 if (m_OSOption->optimization->objectives->other[i]->type != "")
804 osolStr << " type=\"" << m_OSOption->optimization->objectives->other[i]->type << "\"";
805 if (m_OSOption->optimization->objectives->other[i]->description != "")
806 osolStr << " description=" << writeStringData(m_OSOption->optimization->objectives->other[i]->description);
807 if (m_OSOption->optimization->objectives->other[i]->objType != "")
808 osolStr << " objType=\"" << m_OSOption->optimization->objectives->other[i]->objType << "\"";
809 if (m_OSOption->optimization->objectives->other[i]->enumType != "")
810 osolStr << " enumType=\"" << m_OSOption->optimization->objectives->other[i]->enumType << "\"";
811 osolStr << ">" << endl;
812// if (m_OSOption->optimization->objectives->other[i]->numberOfObj > 0)
813 for (int j=0; j < m_OSOption->optimization->objectives->other[i]->numberOfObj; j++)
814 {
815 osolStr << "<obj idx=\"" << m_OSOption->optimization->objectives->other[i]->obj[j]->idx << "\"";
816 if (m_OSOption->optimization->objectives->other[i]->obj[j]->name != "")
817 osolStr << " name=" << writeStringData(m_OSOption->optimization->objectives->other[i]->obj[j]->name);
818 if (m_OSOption->optimization->objectives->other[i]->obj[j]->value != "")
819 osolStr << " value=\"" << m_OSOption->optimization->objectives->other[i]->obj[j]->value << "\"";
820 osolStr << "/>" << endl;
821 }
822// else if (m_OSOption->optimization->objectives->other[i]->numberOfEnumerations > 0)
823 for (int j=0; j < m_OSOption->optimization->objectives->other[i]->numberOfEnumerations; j++)
824 osolStr << writeOtherOptionOrResultEnumeration(m_OSOption->optimization->objectives->other[i]->enumeration[j], m_bWhiteSpace, m_bWriteBase64);
825
826 osolStr << "</other>" << endl;
827 }
828 osolStr << "</objectives>" << endl;
829 }
830#ifndef NDEBUG
831 osoutput->OSPrint(ENUM_OUTPUT_AREA_OSoLwriter, ENUM_OUTPUT_LEVEL_trace, "Done with <objectives> element");
832#endif
833 if (m_OSOption->optimization->constraints != NULL)
834 {
835 osolStr << "<constraints";
836// if (m_OSOption->optimization->constraints->numberOfOtherConstraintOptions > 0)
837 osolStr << " numberOfOtherConstraintOptions=\"" << m_OSOption->optimization->constraints->numberOfOtherConstraintOptions << "\"";
838 osolStr << ">" << endl;
839 if (m_OSOption->optimization->constraints->initialConstraintValues != NULL)
840 {
841 osolStr << "<initialConstraintValues numberOfCon=\"";
842 osolStr << m_OSOption->optimization->constraints->initialConstraintValues->numberOfCon << "\">" << endl;
843 for (int i=0; i < m_OSOption->optimization->constraints->initialConstraintValues->numberOfCon; i++)
844 {
845 osolStr << "<con";
846 osolStr << " idx=\"" << m_OSOption->optimization->constraints->initialConstraintValues->con[i]->idx << "\"";
847 if (m_OSOption->optimization->constraints->initialConstraintValues->con[i]->name != "")
848 osolStr << " name=" << writeStringData(m_OSOption->optimization->constraints->initialConstraintValues->con[i]->name);
849 if (!OSIsnan(m_OSOption->optimization->constraints->initialConstraintValues->con[i]->value))
850 {
851 osolStr << " value=\"";
852 osolStr << os_dtoa_format(m_OSOption->optimization->constraints->initialConstraintValues->con[i]->value);
853 osolStr << "\"";
854 }
855 osolStr << "/>" << endl;
856 }
857 osolStr << "</initialConstraintValues>" << endl;
858 }
859
860 if (m_OSOption->optimization->constraints->initialDualValues != NULL)
861 {
862 osolStr << "<initialDualValues numberOfCon=\"";
863 osolStr << m_OSOption->optimization->constraints->initialDualValues->numberOfCon << "\">" << endl;
864 for (int i=0; i < m_OSOption->optimization->constraints->initialDualValues->numberOfCon; i++)
865 {
866 osolStr << "<con";
867 osolStr << " idx=\"" << m_OSOption->optimization->constraints->initialDualValues->con[i]->idx << "\"";
868 if (m_OSOption->optimization->constraints->initialDualValues->con[i]->name != "")
869 osolStr << " name=" << writeStringData(m_OSOption->optimization->constraints->initialDualValues->con[i]->name);
870 if (!OSIsnan(m_OSOption->optimization->constraints->initialDualValues->con[i]->lbDualValue))
871 {
872 osolStr << " lbDualValue=\"";
873 osolStr << os_dtoa_format(m_OSOption->optimization->constraints->initialDualValues->con[i]->lbDualValue);
874 osolStr << "\"";
875 }
876 if (!OSIsnan(m_OSOption->optimization->constraints->initialDualValues->con[i]->ubDualValue))
877 {
878 osolStr << " ubDualValue=\"";
879 osolStr << os_dtoa_format(m_OSOption->optimization->constraints->initialDualValues->con[i]->ubDualValue);
880 osolStr << "\"";
881 }
882 osolStr << "/>" << endl;
883 }
884 osolStr << "</initialDualValues>" << endl;
885 }
886
887 if (m_OSOption->optimization->constraints->initialBasisStatus != NULL)
888 {
889#ifndef NDEBUG
891 "output <constraints> <basisStatus>");
892#endif
893 osolStr << "<initialBasisStatus>" << endl;
894 osolStr << writeBasisStatus(m_OSOption->optimization->constraints->initialBasisStatus, m_bWhiteSpace, m_bWriteBase64);
895 osolStr << "</initialBasisStatus>" << endl;
896 }
897
898#ifndef NDEBUG
899 outStr.str("");
900 outStr.clear();
901 outStr << "Number of other constraint options: "
902 << m_OSOption->optimization->constraints->numberOfOtherConstraintOptions
903 << std::endl;
905#endif
906// if (m_OSOption->optimization->constraints->numberOfOtherConstraintOptions > 0)
907 for (int i=0; i < m_OSOption->optimization->constraints->numberOfOtherConstraintOptions; i++)
908 {
909 osolStr << "<other name=\"" << m_OSOption->optimization->constraints->other[i]->name << "\"";
910
911// if (m_OSOption->optimization->constraints->other[i]->numberOfCon > 0)
912 osolStr << " numberOfCon=\"" << m_OSOption->optimization->constraints->other[i]->numberOfCon << "\"";
913// if (m_OSOption->optimization->constraints->other[i]->numberOfEnumerations > 0)
914 osolStr << " numberOfEnumerations=\"" << m_OSOption->optimization->constraints->other[i]->numberOfEnumerations << "\"";
915 if (m_OSOption->optimization->constraints->other[i]->value != "")
916 osolStr << " value=\"" << m_OSOption->optimization->constraints->other[i]->value << "\"";
917 if (m_OSOption->optimization->constraints->other[i]->solver != "")
918 osolStr << " solver=\"" << m_OSOption->optimization->constraints->other[i]->solver << "\"";
919 if (m_OSOption->optimization->constraints->other[i]->category != "")
920 osolStr << " category=\"" << m_OSOption->optimization->constraints->other[i]->category << "\"";
921 if (m_OSOption->optimization->constraints->other[i]->type != "")
922 osolStr << " type=\"" << m_OSOption->optimization->constraints->other[i]->type << "\"";
923 if (m_OSOption->optimization->constraints->other[i]->description != "")
924 osolStr << " description=" << writeStringData(m_OSOption->optimization->constraints->other[i]->description);
925 if (m_OSOption->optimization->constraints->other[i]->conType != "")
926 osolStr << " conType=\"" << m_OSOption->optimization->constraints->other[i]->conType << "\"";
927 if (m_OSOption->optimization->constraints->other[i]->enumType != "")
928 osolStr << " enumType=\"" << m_OSOption->optimization->constraints->other[i]->enumType << "\"";
929 osolStr << ">" << endl;
930// if (m_OSOption->optimization->constraints->other[i]->numberOfCon > 0)
931 for (int j=0; j < m_OSOption->optimization->constraints->other[i]->numberOfCon; j++)
932 {
933 osolStr << "<con idx=\"" << m_OSOption->optimization->constraints->other[i]->con[j]->idx << "\"";
934 if (m_OSOption->optimization->constraints->other[i]->con[j]->name != "")
935 osolStr << " name=" << writeStringData(m_OSOption->optimization->constraints->other[i]->con[j]->name);
936 if (m_OSOption->optimization->constraints->other[i]->con[j]->value != "")
937 osolStr << " value=\"" << m_OSOption->optimization->constraints->other[i]->con[j]->value << "\"";
938 if (m_OSOption->optimization->constraints->other[i]->con[j]->lbValue != "")
939 osolStr << " lbValue=\"" << m_OSOption->optimization->constraints->other[i]->con[j]->lbValue << "\"";
940 if (m_OSOption->optimization->constraints->other[i]->con[j]->ubValue != "")
941 osolStr << " ubValue=\"" << m_OSOption->optimization->constraints->other[i]->con[j]->ubValue << "\"";
942 osolStr << "/>" << endl;
943 }
944// else if (m_OSOption->optimization->constraints->other[i]->numberOfEnumerations > 0)
945 for (int j=0; j < m_OSOption->optimization->constraints->other[i]->numberOfEnumerations; j++)
946 osolStr << writeOtherOptionOrResultEnumeration(m_OSOption->optimization->constraints->other[i]->enumeration[j], m_bWhiteSpace, m_bWriteBase64);
947
948 osolStr << "</other>" << endl;
949 }
950 osolStr << "</constraints>" << endl;
951 }
952#ifndef NDEBUG
953 osoutput->OSPrint(ENUM_OUTPUT_AREA_OSoLwriter, ENUM_OUTPUT_LEVEL_trace, "Done with <constraint> element");
954#endif
955 if (m_OSOption->optimization->solverOptions != NULL)
956 {
957// if (m_OSOption->optimization->solverOptions->numberOfSolverOptions > 0)
958 {
959 osolStr << "<solverOptions numberOfSolverOptions=\"";
960 osolStr << m_OSOption->optimization->solverOptions->numberOfSolverOptions << "\">" << endl;
961 for (int i=0; i < m_OSOption->optimization->solverOptions->numberOfSolverOptions; i++)
962 {
963 osolStr << "<solverOption name=\"" << m_OSOption->optimization->solverOptions->solverOption[i]->name << "\"";
964 if (m_OSOption->optimization->solverOptions->solverOption[i]->value != "")
965 osolStr << " value=\"" << m_OSOption->optimization->solverOptions->solverOption[i]->value << "\"";
966 if (m_OSOption->optimization->solverOptions->solverOption[i]->solver != "")
967 osolStr << " solver=\"" << m_OSOption->optimization->solverOptions->solverOption[i]->solver << "\"";
968 if (m_OSOption->optimization->solverOptions->solverOption[i]->category != "")
969 osolStr << " category=\"" << m_OSOption->optimization->solverOptions->solverOption[i]->category << "\"";
970 if (m_OSOption->optimization->solverOptions->solverOption[i]->type != "")
971 osolStr << " type=\"" << m_OSOption->optimization->solverOptions->solverOption[i]->type << "\"";
972 if (m_OSOption->optimization->solverOptions->solverOption[i]->description != "")
973 osolStr << " description=" << writeStringData(m_OSOption->optimization->solverOptions->solverOption[i]->description);
974 if (m_OSOption->optimization->solverOptions->solverOption[i]->numberOfItems == 0)
975 osolStr << "/>" << endl;
976 else
977 {
978 osolStr << " numberOfItems=\"" << m_OSOption->optimization->solverOptions->solverOption[i]->numberOfItems << "\">";
979 for (int k=0; k<m_OSOption->optimization->solverOptions->solverOption[i]->numberOfItems; k++)
980 osolStr << "<item>" << m_OSOption->optimization->solverOptions->solverOption[i]->item[k] << "</item>" << endl;
981 osolStr << "</solverOption>" << endl;
982 }
983 }
984 osolStr << "</solverOptions>" << endl;
985 }
986 }
987 osolStr << "</optimization>" << endl;
988 };
989 osolStr << "</osol>" << endl;
990#ifndef NDEBUG
991 osoutput->OSPrint(ENUM_OUTPUT_AREA_OSoLwriter, ENUM_OUTPUT_LEVEL_trace, "Done with <optimization> element");
992#endif
993 return osolStr.str();
994}// end writeOSoL
995
996
997
const OSSmartPtr< OSOutput > osoutput
Definition OSOutput.cpp:39
std::string os_dtoa_format(double x)
bool OSIsnan(double x)
checks whether a given double is NaN
std::string writeStringData(std::string str)
writeStringData
std::string writeGeneralFileHeader(GeneralFileHeader *v, bool addWhiteSpace)
Take a GeneralFileHeader object and write a string that validates against the OSgL schema.
std::string writeOtherOptionOrResultEnumeration(OtherOptionOrResultEnumeration *e, bool addWhiteSpace, bool writeBase64)
Take an OtherOptionOrResultEnumeration object and write a string that validates against the OSgL sche...
std::string writeBasisStatus(BasisStatus *bs, bool addWhiteSpace, bool writeBase64)
Take a BasisStatus object and write a string that validates against the OSgL schema.
The Option Class.
Definition OSOption.h:3565
std::string writeOSoL(OSOption *theosoption)
create an osol string from an OSOption object
bool m_bWriteBase64
m_bWriteBase64 is set to true if we encode the linear constraint coefficients in base64 binary
Definition OSoLWriter.h:62
bool m_bWhiteSpace
m_bWhiteSpace is set to true if we write white space in the file
Definition OSoLWriter.h:66
OSoLWriter()
Default constructor.
~OSoLWriter()
Class destructor.
const OSOption * m_OSOption
m_OSOption is an object in the class OSOption
Definition OSoLWriter.h:35
#define OS_SCHEMA_VERSION
@ ENUM_OUTPUT_LEVEL_detailed_trace
@ ENUM_OUTPUT_LEVEL_debug
@ ENUM_OUTPUT_LEVEL_trace
@ ENUM_OUTPUT_AREA_OSoLwriter