22#include "OSCommonUtil.h"
32using std::ostringstream;
53 std::ostringstream outStr;
55 const char dirsep=
'\\';
57 const char dirsep=
'/';
61 xsltDir = dirsep ==
'/' ?
"../stylesheets/" :
"..\\stylesheets\\";
63 xsltDir =
"../stylesheets/";
65 outStr <<
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>" ;
66 outStr <<
"<?xml-stylesheet type=\"text/xsl\" href=\"";
68 outStr <<
"OSoL.xslt\"?>";
69 outStr <<
"<osol xmlns=\"os.optimizationservices.org\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" ";
70 outStr <<
"xsi:schemaLocation=\"os.optimizationservices.org http://www.optimizationservices.org/schemas/";
72 outStr <<
"/OSoL.xsd\" >" ;
79 { outStr <<
"<general>" << endl;
81 outStr <<
"<serviceURI>" <<
m_OSOption->general->serviceURI <<
"</serviceURI>" << endl;
83 outStr <<
"<serviceName>" <<
m_OSOption->general->serviceName <<
"</serviceName>" << endl;
85 outStr <<
"<instanceName>" <<
m_OSOption->general->instanceName <<
"</instanceName>" << endl;
86 if (
m_OSOption->general->instanceLocation != NULL)
87 {
if (
m_OSOption->general->instanceLocation->locationType ==
"")
88 { outStr <<
"<instanceLocation>";
91 { outStr <<
"<instanceLocation locationType=\"" <<
m_OSOption->general->instanceLocation->locationType <<
"\">";
93 outStr <<
m_OSOption->general->instanceLocation->value <<
"</instanceLocation>" << endl;
96 { outStr <<
"<jobID>" <<
m_OSOption->general->jobID <<
"</jobID>" << endl;
99 { outStr <<
"<solverToInvoke>" <<
m_OSOption->general->solverToInvoke <<
"</solverToInvoke>" << endl;
102 { outStr <<
"<license>" <<
m_OSOption->general->license <<
"</license>" << endl;
105 { outStr <<
"<userName>" <<
m_OSOption->general->userName <<
"</userName>" << endl;
108 { outStr <<
"<password>" <<
m_OSOption->general->password <<
"</password>" << endl;
111 {
if (
m_OSOption->general->contact->transportType ==
"")
112 { outStr <<
"<contact>";
115 { outStr <<
"<contact transportType=\"" <<
m_OSOption->general->contact->transportType <<
"\">";
117 outStr <<
m_OSOption->general->contact->value <<
"</contact>" << endl;
119 if (
m_OSOption->general->otherOptions != NULL)
120 {
if (
m_OSOption->general->otherOptions->numberOfOtherOptions > 0)
121 { outStr <<
"<otherOptions numberOfOtherOptions=\"";
122 outStr <<
m_OSOption->general->otherOptions->numberOfOtherOptions <<
"\">" << endl;
123 for (
int i=0; i <
m_OSOption->general->otherOptions->numberOfOtherOptions; i++)
124 { outStr <<
"<other name=\"" <<
m_OSOption->general->otherOptions->other[i]->name <<
"\"";
125 if (
m_OSOption->general->otherOptions->other[i]->value !=
"")
126 outStr <<
" value=\"" <<
m_OSOption->general->otherOptions->other[i]->value <<
"\"";
127 if (
m_OSOption->general->otherOptions->other[i]->description !=
"")
128 outStr <<
" description=\"" <<
m_OSOption->general->otherOptions->other[i]->description <<
"\"";
129 outStr <<
"/>" << endl;
131 outStr <<
"</otherOptions>" << endl;
134 outStr <<
"</general>" << endl;
142 { outStr <<
"<system>" << endl;
144 {
if (
m_OSOption->system->minDiskSpace->unit ==
"")
145 m_OSOption->system->minDiskSpace->unit =
"byte";
146 outStr <<
"<minDiskSpace unit=\"" <<
m_OSOption->system->minDiskSpace->unit <<
"\">";
149 if (
m_OSOption->system->minMemorySize != NULL)
150 {
if (
m_OSOption->system->minMemorySize->unit ==
"")
151 m_OSOption->system->minMemorySize->unit =
"byte";
152 outStr <<
"<minMemorySize unit=\"" <<
m_OSOption->system->minMemorySize->unit <<
"\">";
156 {
if (
m_OSOption->system->minCPUSpeed->unit ==
"")
157 m_OSOption->system->minCPUSpeed->unit =
"hertz";
158 outStr <<
"<minCPUSpeed unit=\"" <<
m_OSOption->system->minCPUSpeed->unit <<
"\">";
162 { outStr <<
"<minCPUNumber>" <<
m_OSOption->system->minCPUNumber <<
"</minCPUNumber>";
165 {
if (
m_OSOption->system->otherOptions->numberOfOtherOptions > 0)
166 { outStr <<
"<otherOptions numberOfOtherOptions=\"";
167 outStr <<
m_OSOption->system->otherOptions->numberOfOtherOptions <<
"\">" << endl;
168 for (
int i=0; i <
m_OSOption->system->otherOptions->numberOfOtherOptions; i++)
169 { outStr <<
"<other name=\"" <<
m_OSOption->system->otherOptions->other[i]->name <<
"\"";
170 if (
m_OSOption->system->otherOptions->other[i]->value !=
"")
171 outStr <<
" value=\"" <<
m_OSOption->system->otherOptions->other[i]->value <<
"\"";
172 if (
m_OSOption->system->otherOptions->other[i]->description !=
"")
173 outStr <<
" description=\"" <<
m_OSOption->system->otherOptions->other[i]->description <<
"\"";
174 outStr <<
"/>" << endl;
176 outStr <<
"</otherOptions>" << endl;
179 outStr <<
"</system>" << endl;
180 cout <<
"Done with <system> element" << endl;
187 { outStr <<
"<service>" << endl;
189 { outStr <<
"<type>" <<
m_OSOption->service->type <<
"</type>" << endl;
191 if (
m_OSOption->service->otherOptions != NULL)
192 {
if (
m_OSOption->service->otherOptions->numberOfOtherOptions > 0)
193 { outStr <<
"<otherOptions numberOfOtherOptions=\"";
194 outStr <<
m_OSOption->service->otherOptions->numberOfOtherOptions <<
"\">" << endl;
195 for (
int i=0; i <
m_OSOption->service->otherOptions->numberOfOtherOptions; i++)
196 { outStr <<
"<other name=\"" <<
m_OSOption->service->otherOptions->other[i]->name <<
"\"";
197 if (
m_OSOption->service->otherOptions->other[i]->value !=
"")
198 outStr <<
" value=\"" <<
m_OSOption->service->otherOptions->other[i]->value <<
"\"";
199 if (
m_OSOption->service->otherOptions->other[i]->description !=
"")
200 outStr <<
" description=\"" <<
m_OSOption->service->otherOptions->other[i]->description <<
"\"";
201 outStr <<
"/>" << endl;
203 outStr <<
"</otherOptions>" << endl;
206 outStr <<
"</service>" << endl;
207 cout <<
"Done with <service> element" << endl;
214 { outStr <<
"<job>" << endl;
218 outStr <<
"<maxTime unit=\"" <<
m_OSOption->job->maxTime->unit <<
"\">";
220 outStr <<
"INF" <<
"</maxTime>" << endl;
224 if (
m_OSOption->job->requestedStartTime !=
"")
225 outStr <<
"<requestedStartTime>" <<
m_OSOption->job->requestedStartTime <<
"</requestedStartTime>" << endl;
227 {
if (
m_OSOption->job->dependencies->numberOfJobIDs > 0)
228 { outStr <<
"<dependencies numberOfJobIDs=\"";
229 outStr <<
m_OSOption->job->dependencies->numberOfJobIDs <<
"\">" << endl;
230 for (
int i=0; i <
m_OSOption->job->dependencies->numberOfJobIDs; i++)
231 { outStr <<
"<jobID>" <<
m_OSOption->job->dependencies->jobID[i] <<
"</jobID>" << endl;
233 outStr <<
"</dependencies>" << endl;
236 if (
m_OSOption->job->requiredDirectories != NULL)
237 {
if (
m_OSOption->job->requiredDirectories->numberOfPaths > 0)
238 { outStr <<
"<requiredDirectories numberOfPaths=\"";
239 outStr <<
m_OSOption->job->requiredDirectories->numberOfPaths <<
"\">" << endl;
240 for (
int i=0; i <
m_OSOption->job->requiredDirectories->numberOfPaths; i++)
241 outStr <<
"<path>" <<
m_OSOption->job->requiredDirectories->path[i] <<
"</path>" << endl;
242 outStr <<
"</requiredDirectories>" << endl;
246 {
if (
m_OSOption->job->requiredFiles->numberOfPaths > 0)
247 { outStr <<
"<requiredFiles numberOfPaths=\"";
248 outStr <<
m_OSOption->job->requiredFiles->numberOfPaths <<
"\">" << endl;
249 for (
int i=0; i <
m_OSOption->job->requiredFiles->numberOfPaths; i++)
250 outStr <<
"<path>" <<
m_OSOption->job->requiredFiles->path[i] <<
"</path>" << endl;
251 outStr <<
"</requiredFiles>" << endl;
254 if (
m_OSOption->job->directoriesToMake != NULL)
255 {
if (
m_OSOption->job->directoriesToMake->numberOfPaths > 0)
256 { outStr <<
"<directoriesToMake numberOfPaths=\"";
257 outStr <<
m_OSOption->job->directoriesToMake->numberOfPaths <<
"\">" << endl;
258 for (
int i=0; i <
m_OSOption->job->directoriesToMake->numberOfPaths; i++)
259 outStr <<
"<path>" <<
m_OSOption->job->directoriesToMake->path[i] <<
"</path>" << endl;
260 outStr <<
"</directoriesToMake>" << endl;
264 {
if (
m_OSOption->job->filesToMake->numberOfPaths > 0)
265 { outStr <<
"<filesToMake numberOfPaths=\"";
266 outStr <<
m_OSOption->job->filesToMake->numberOfPaths <<
"\">" << endl;
267 for (
int i=0; i <
m_OSOption->job->filesToMake->numberOfPaths; i++)
268 outStr <<
"<path>" <<
m_OSOption->job->filesToMake->path[i] <<
"</path>" << endl;
269 outStr <<
"</filesToMake>" << endl;
272 if (
m_OSOption->job->inputDirectoriesToMove != NULL)
273 {
if (
m_OSOption->job->inputDirectoriesToMove->numberOfPathPairs > 0)
274 { outStr <<
"<inputDirectoriesToMove numberOfPathPairs=\"";
275 outStr <<
m_OSOption->job->inputDirectoriesToMove->numberOfPathPairs <<
"\">" << endl;
276 for (
int i=0; i <
m_OSOption->job->inputDirectoriesToMove->numberOfPathPairs; i++)
277 { outStr <<
"<pathPair";
278 outStr <<
" from=\"" <<
m_OSOption->job->inputDirectoriesToMove->pathPair[i]->from <<
"\"";
279 outStr <<
" to=\"" <<
m_OSOption->job->inputDirectoriesToMove->pathPair[i]->to <<
"\"";
280 if (
m_OSOption->job->inputDirectoriesToMove->pathPair[i]->makeCopy)
281 outStr <<
" makeCopy=\"true\"";
282 outStr <<
"/>" << endl;
284 outStr <<
"</inputDirectoriesToMove>" << endl;
287 if (
m_OSOption->job->inputFilesToMove != NULL)
288 {
if (
m_OSOption->job->inputFilesToMove->numberOfPathPairs > 0)
289 { outStr <<
"<inputFilesToMove numberOfPathPairs=\"";
290 outStr <<
m_OSOption->job->inputFilesToMove->numberOfPathPairs <<
"\">" << endl;
291 for (
int i=0; i <
m_OSOption->job->inputFilesToMove->numberOfPathPairs; i++)
292 { outStr <<
"<pathPair";
293 outStr <<
" from=\"" <<
m_OSOption->job->inputFilesToMove->pathPair[i]->from <<
"\"";
294 outStr <<
" to=\"" <<
m_OSOption->job->inputFilesToMove->pathPair[i]->to <<
"\"";
295 if (
m_OSOption->job->inputFilesToMove->pathPair[i]->makeCopy)
296 outStr <<
" makeCopy=\"true\"";
297 outStr <<
"/>" << endl;
299 outStr <<
"</inputFilesToMove>" << endl;
302 if (
m_OSOption->job->outputFilesToMove != NULL)
303 {
if (
m_OSOption->job->outputFilesToMove->numberOfPathPairs > 0)
304 { outStr <<
"<outputFilesToMove numberOfPathPairs=\"";
305 outStr <<
m_OSOption->job->outputFilesToMove->numberOfPathPairs <<
"\">" << endl;
306 for (
int i=0; i <
m_OSOption->job->outputFilesToMove->numberOfPathPairs; i++)
307 { outStr <<
"<pathPair";
308 outStr <<
" from=\"" <<
m_OSOption->job->outputFilesToMove->pathPair[i]->from <<
"\"";
309 outStr <<
" to=\"" <<
m_OSOption->job->outputFilesToMove->pathPair[i]->to <<
"\"";
310 if (
m_OSOption->job->outputFilesToMove->pathPair[i]->makeCopy)
311 outStr <<
" makeCopy=\"true\"";
312 outStr <<
"/>" << endl;
314 outStr <<
"</outputFilesToMove>" << endl;
317 if (
m_OSOption->job->outputDirectoriesToMove != NULL)
318 {
if (
m_OSOption->job->outputDirectoriesToMove->numberOfPathPairs > 0)
319 { outStr <<
"<outputDirectoriesToMove numberOfPathPairs=\"";
320 outStr <<
m_OSOption->job->outputDirectoriesToMove->numberOfPathPairs <<
"\">" << endl;
321 for (
int i=0; i <
m_OSOption->job->outputDirectoriesToMove->numberOfPathPairs; i++)
322 { outStr <<
"<pathPair";
323 outStr <<
" from=\"" <<
m_OSOption->job->outputDirectoriesToMove->pathPair[i]->from <<
"\"";
324 outStr <<
" to=\"" <<
m_OSOption->job->outputDirectoriesToMove->pathPair[i]->to <<
"\"";
325 if (
m_OSOption->job->outputDirectoriesToMove->pathPair[i]->makeCopy)
326 outStr <<
" makeCopy=\"true\"";
327 outStr <<
"/>" << endl;
329 outStr <<
"</outputDirectoriesToMove>" << endl;
333 {
if (
m_OSOption->job->filesToDelete->numberOfPaths > 0)
334 { outStr <<
"<filesToDelete numberOfPaths=\"";
335 outStr <<
m_OSOption->job->filesToDelete->numberOfPaths <<
"\">" << endl;
336 for (
int i=0; i <
m_OSOption->job->filesToDelete->numberOfPaths; i++)
337 outStr <<
"<path>" <<
m_OSOption->job->filesToDelete->path[i] <<
"</path>" << endl;
338 outStr <<
"</filesToDelete>" << endl;
341 if (
m_OSOption->job->directoriesToDelete != NULL)
342 {
if (
m_OSOption->job->directoriesToDelete->numberOfPaths > 0)
343 { outStr <<
"<directoriesToDelete numberOfPaths=\"";
344 outStr <<
m_OSOption->job->directoriesToDelete->numberOfPaths <<
"\">" << endl;
345 for (
int i=0; i <
m_OSOption->job->directoriesToDelete->numberOfPaths; i++)
346 outStr <<
"<path>" <<
m_OSOption->job->directoriesToDelete->path[i] <<
"</path>" << endl;
347 outStr <<
"</directoriesToDelete>" << endl;
351 {
if (
m_OSOption->job->processesToKill->numberOfProcesses > 0)
352 { outStr <<
"<processesToKill numberOfProcesses=\"";
353 outStr <<
m_OSOption->job->processesToKill->numberOfProcesses <<
"\">" << endl;
354 for (
int i=0; i <
m_OSOption->job->processesToKill->numberOfProcesses; i++)
355 outStr <<
"<process>" <<
m_OSOption->job->processesToKill->process[i] <<
"</process>" << endl;
356 outStr <<
"</processesToKill>" << endl;
360 {
if (
m_OSOption->job->otherOptions->numberOfOtherOptions > 0)
361 { outStr <<
"<otherOptions numberOfOtherOptions=\"";
362 outStr <<
m_OSOption->job->otherOptions->numberOfOtherOptions <<
"\">" << endl;
363 for (
int i=0; i <
m_OSOption->job->otherOptions->numberOfOtherOptions; i++)
364 { outStr <<
"<other name=\"" <<
m_OSOption->job->otherOptions->other[i]->name <<
"\"";
365 if (
m_OSOption->job->otherOptions->other[i]->value !=
"")
366 outStr <<
" value=\"" <<
m_OSOption->job->otherOptions->other[i]->value <<
"\"";
367 if (
m_OSOption->job->otherOptions->other[i]->description !=
"")
368 outStr <<
" description=\"" <<
m_OSOption->job->otherOptions->other[i]->description <<
"\"";
369 outStr <<
"/>" << endl;
371 outStr <<
"</otherOptions>" << endl;
374 outStr <<
"</job>" << endl;
375 cout <<
"Done with <job> element" << endl;
382 { outStr <<
"<optimization";
383 outStr <<
" numberOfVariables=\"" <<
m_OSOption->optimization->numberOfVariables <<
"\" ";
384 outStr <<
" numberOfObjectives=\"" <<
m_OSOption->optimization->numberOfObjectives <<
"\" ";
385 outStr <<
" numberOfConstraints=\"" <<
m_OSOption->optimization->numberOfConstraints <<
"\" ";
386 outStr <<
">" << endl;
387 if (
m_OSOption->optimization->variables != NULL)
388 { outStr <<
"<variables";
389 if (
m_OSOption->optimization->variables->numberOfOtherVariableOptions > 0)
390 outStr <<
" numberOfOtherVariableOptions=\"" <<
m_OSOption->optimization->variables->numberOfOtherVariableOptions <<
"\"";
391 outStr <<
">" << endl;
393 cout <<
"initialVariableValues: " << (
m_OSOption->optimization->variables->initialVariableValues != NULL) << endl;
395 if (
m_OSOption->optimization->variables->initialVariableValues != NULL)
396 { outStr <<
"<initialVariableValues numberOfVar=\"";
397 outStr <<
m_OSOption->optimization->variables->initialVariableValues->numberOfVar <<
"\">" << endl;
398 for (
int i=0; i <
m_OSOption->optimization->variables->initialVariableValues->numberOfVar; i++)
400 outStr <<
" idx=\"" <<
m_OSOption->optimization->variables->initialVariableValues->var[i]->idx <<
"\"";
401 if (
m_OSOption->optimization->variables->initialVariableValues->var[i]->value !=
OSNAN)
402 { outStr <<
" value=\"";
403 if (
m_OSOption->optimization->variables->initialVariableValues->var[i]->value ==
OSDBL_MAX)
405 else if (
m_OSOption->optimization->variables->initialVariableValues->var[i]->value == -
OSDBL_MAX)
410 outStr <<
"\"/>" << endl;
412 outStr <<
"</initialVariableValues>" << endl;
415 cout <<
"initialVariableValuesString: " << (
m_OSOption->optimization->variables->initialVariableValuesString != NULL) << endl;
417 if (
m_OSOption->optimization->variables->initialVariableValuesString != NULL)
418 { outStr <<
"<initialVariableValuesString numberOfVar=\"";
419 outStr <<
m_OSOption->optimization->variables->initialVariableValuesString->numberOfVar <<
"\">" << endl;
420 for (
int i=0; i <
m_OSOption->optimization->variables->initialVariableValuesString->numberOfVar; i++)
422 outStr <<
" idx=\"" <<
m_OSOption->optimization->variables->initialVariableValuesString->var[i]->idx <<
"\"";
423 outStr <<
" value=\"" <<
m_OSOption->optimization->variables->initialVariableValuesString->var[i]->value <<
"\"";
424 outStr <<
"/>" << endl;
426 outStr <<
"</initialVariableValuesString>" << endl;
429 cout <<
"initialBasisStatus: " << (
m_OSOption->optimization->variables->initialBasisStatus != NULL) << endl;
431 if (
m_OSOption->optimization->variables->initialBasisStatus != NULL)
432 { outStr <<
"<initialBasisStatus numberOfVar=\"";
433 outStr <<
m_OSOption->optimization->variables->initialBasisStatus->numberOfVar <<
"\">" << endl;
434 for (
int i=0; i <
m_OSOption->optimization->variables->initialBasisStatus->numberOfVar; i++)
436 outStr <<
" idx=\"" <<
m_OSOption->optimization->variables->initialBasisStatus->var[i]->idx <<
"\"";
437 outStr <<
" value=\"" <<
m_OSOption->optimization->variables->initialBasisStatus->var[i]->value <<
"\"";
438 outStr <<
"/>" << endl;
440 outStr <<
"</initialBasisStatus>" << endl;
443 cout <<
"integerVariableBranchingWeights: " << (
m_OSOption->optimization->variables->integerVariableBranchingWeights != NULL) << endl;
445 if (
m_OSOption->optimization->variables->integerVariableBranchingWeights != NULL)
446 { outStr <<
"<integerVariableBranchingWeights numberOfVar=\"";
447 outStr <<
m_OSOption->optimization->variables->integerVariableBranchingWeights->numberOfVar <<
"\">" << endl;
448 for (
int i=0; i <
m_OSOption->optimization->variables->integerVariableBranchingWeights->numberOfVar; i++)
450 outStr <<
" idx=\"" <<
m_OSOption->optimization->variables->integerVariableBranchingWeights->var[i]->idx <<
"\"";
451 outStr <<
" value=\"" <<
os_dtoa_format(
m_OSOption->optimization->variables->integerVariableBranchingWeights->var[i]->value) <<
"\"";
452 outStr <<
"/>" << endl;
454 outStr <<
"</integerVariableBranchingWeights>" << endl;
457 cout <<
"sosVariableBranchingWeights: " << (
m_OSOption->optimization->variables->sosVariableBranchingWeights != NULL) << endl;
459 if (
m_OSOption->optimization->variables->sosVariableBranchingWeights != NULL)
460 { outStr <<
"<sosVariableBranchingWeights numberOfSOS=\"";
462 cout <<
"start: numberOfSOS" << endl;
464 outStr <<
m_OSOption->optimization->variables->sosVariableBranchingWeights->numberOfSOS <<
"\">" << endl;
465 for (
int i=0; i <
m_OSOption->optimization->variables->sosVariableBranchingWeights->numberOfSOS; i++)
468 cout <<
"sosIdx - nvar: " <<
m_OSOption->optimization->variables->sosVariableBranchingWeights->sos[i]->numberOfVar << endl;
470 outStr <<
" sosIdx=\"" <<
m_OSOption->optimization->variables->sosVariableBranchingWeights->sos[i]->sosIdx <<
"\"";
471 outStr <<
" numberOfVar=\"" <<
m_OSOption->optimization->variables->sosVariableBranchingWeights->sos[i]->numberOfVar <<
"\"";
472 outStr <<
" groupWeight=\"" <<
os_dtoa_format(
m_OSOption->optimization->variables->sosVariableBranchingWeights->sos[i]->groupWeight) <<
"\">" << endl;
473 for (
int j=0; j <
m_OSOption->optimization->variables->sosVariableBranchingWeights->sos[i]->numberOfVar; j++)
476 cout <<
"idx" << endl;
478 outStr <<
" idx=\"" <<
m_OSOption->optimization->variables->sosVariableBranchingWeights->sos[i]->var[j]->idx <<
"\"";
479 outStr <<
" value=\"" <<
os_dtoa_format(
m_OSOption->optimization->variables->sosVariableBranchingWeights->sos[i]->var[j]->value) <<
"\"";
480 outStr <<
"/>" << endl;
482 outStr <<
"</sos>" << endl;
484 outStr <<
"</sosVariableBranchingWeights>" << endl;
487 printf(
"\n%s%d\n",
"Number of other variable options: ",
m_OSOption->optimization->variables->numberOfOtherVariableOptions);
489 if (
m_OSOption->optimization->variables->numberOfOtherVariableOptions > 0)
490 for (
int i=0; i <
m_OSOption->optimization->variables->numberOfOtherVariableOptions; i++)
491 { outStr <<
"<other name=\"" <<
m_OSOption->optimization->variables->other[i]->name <<
"\"";
493 cout <<
"option " << i <<
":" << endl;
494 cout <<
" numberOfVar \'" <<
m_OSOption->optimization->variables->other[i]->numberOfVar <<
"\'" << endl;
495 cout <<
" value \'" <<
m_OSOption->optimization->variables->other[i]->value <<
"\'" << endl;
496 cout <<
" solver \'" <<
m_OSOption->optimization->variables->other[i]->solver <<
"\'" << endl;
497 cout <<
" category \'" <<
m_OSOption->optimization->variables->other[i]->category <<
"\'" << endl;
498 cout <<
" type \'" <<
m_OSOption->optimization->variables->other[i]->type <<
"\'" << endl;
499 cout <<
" description \'" <<
m_OSOption->optimization->variables->other[i]->description <<
"\'" << endl;
502 outStr <<
" numberOfVar=\"" <<
m_OSOption->optimization->variables->other[i]->numberOfVar <<
"\"";
503 if (
m_OSOption->optimization->variables->other[i]->value !=
"")
504 outStr <<
" value=\"" <<
m_OSOption->optimization->variables->other[i]->value <<
"\"";
505 if (
m_OSOption->optimization->variables->other[i]->solver !=
"")
506 outStr <<
" solver=\"" <<
m_OSOption->optimization->variables->other[i]->solver <<
"\"";
507 if (
m_OSOption->optimization->variables->other[i]->category !=
"")
508 outStr <<
" category=\"" <<
m_OSOption->optimization->variables->other[i]->category <<
"\"";
509 if (
m_OSOption->optimization->variables->other[i]->type !=
"")
510 outStr <<
" type=\"" <<
m_OSOption->optimization->variables->other[i]->type <<
"\"";
511 if (
m_OSOption->optimization->variables->other[i]->description !=
"")
512 outStr <<
" description=\"" <<
m_OSOption->optimization->variables->other[i]->description <<
"\"";
513 outStr <<
">" << endl;
514 if (
m_OSOption->optimization->variables->other[i]->numberOfVar > 0)
515 for (
int j=0; j <
m_OSOption->optimization->variables->other[i]->numberOfVar; j++)
516 { outStr <<
"<var idx=\"" <<
m_OSOption->optimization->variables->other[i]->var[j]->idx <<
"\"";
517 if (
m_OSOption->optimization->variables->other[i]->var[j]->value !=
"")
518 outStr <<
" value=\"" <<
m_OSOption->optimization->variables->other[i]->var[j]->value <<
"\"";
519 if (
m_OSOption->optimization->variables->other[i]->var[j]->lbValue !=
"")
520 outStr <<
" lbValue=\"" <<
m_OSOption->optimization->variables->other[i]->var[j]->lbValue <<
"\"";
521 if (
m_OSOption->optimization->variables->other[i]->var[j]->ubValue !=
"")
522 outStr <<
" ubValue=\"" <<
m_OSOption->optimization->variables->other[i]->var[j]->ubValue <<
"\"";
523 outStr <<
"/>" << endl;
525 outStr <<
"</other>" << endl;
527 outStr <<
"</variables>" << endl;
529 if (
m_OSOption->optimization->objectives != NULL)
530 { outStr <<
"<objectives";
531 if (
m_OSOption->optimization->objectives->numberOfOtherObjectiveOptions > 0)
532 outStr <<
" numberOfOtherObjectiveOptions=\"" <<
m_OSOption->optimization->objectives->numberOfOtherObjectiveOptions <<
"\"";
533 outStr <<
">" << endl;
534 if (
m_OSOption->optimization->objectives->initialObjectiveValues != NULL)
535 { outStr <<
"<initialObjectiveValues numberOfObj=\"";
536 outStr <<
m_OSOption->optimization->objectives->initialObjectiveValues->numberOfObj <<
"\">" << endl;
537 for (
int i=0; i <
m_OSOption->optimization->objectives->initialObjectiveValues->numberOfObj; i++)
539 outStr <<
" idx=\"" <<
m_OSOption->optimization->objectives->initialObjectiveValues->obj[i]->idx <<
"\"";
540 if (
m_OSOption->optimization->objectives->initialObjectiveValues->obj[i]->value !=
OSNAN)
541 { outStr <<
" value=\"";
542 if (
m_OSOption->optimization->objectives->initialObjectiveValues->obj[i]->value ==
OSDBL_MAX)
544 else if (
m_OSOption->optimization->objectives->initialObjectiveValues->obj[i]->value == -
OSDBL_MAX)
549 outStr <<
"\"/>" << endl;
551 outStr <<
"</initialObjectiveValues>" << endl;
553 if (
m_OSOption->optimization->objectives->initialObjectiveBounds != NULL)
554 { outStr <<
"<initialObjectiveBounds numberOfObj=\"";
555 outStr <<
m_OSOption->optimization->objectives->initialObjectiveBounds->numberOfObj <<
"\">" << endl;
556 for (
int i=0; i <
m_OSOption->optimization->objectives->initialObjectiveBounds->numberOfObj; i++)
558 outStr <<
" idx=\"" <<
m_OSOption->optimization->objectives->initialObjectiveBounds->obj[i]->idx <<
"\"";
559 outStr <<
" lbValue=\"";
560 if (
m_OSOption->optimization->objectives->initialObjectiveBounds->obj[i]->lbValue ==
OSDBL_MAX)
562 else if (
m_OSOption->optimization->objectives->initialObjectiveBounds->obj[i]->lbValue == -
OSDBL_MAX)
566 outStr <<
"\" ubValue=\"";
567 if (
m_OSOption->optimization->objectives->initialObjectiveBounds->obj[i]->ubValue ==
OSDBL_MAX)
569 else if (
m_OSOption->optimization->objectives->initialObjectiveBounds->obj[i]->ubValue == -
OSDBL_MAX)
573 outStr <<
"\"/>" << endl;
575 outStr <<
"</initialObjectiveBounds>" << endl;
578 printf(
"\n%s%d\n",
"Number of other objective options: ",
m_OSOption->optimization->objectives->numberOfOtherObjectiveOptions);
580 if (
m_OSOption->optimization->objectives->numberOfOtherObjectiveOptions > 0)
581 for (
int i=0; i <
m_OSOption->optimization->objectives->numberOfOtherObjectiveOptions; i++)
582 { outStr <<
"<other name=\"" <<
m_OSOption->optimization->objectives->other[i]->name <<
"\"";
584 cout <<
"option " << i <<
":" << endl;
585 cout <<
" numberOfObj \'" <<
m_OSOption->optimization->objectives->other[i]->numberOfObj <<
"\'" << endl;
586 cout <<
" value \'" <<
m_OSOption->optimization->objectives->other[i]->value <<
"\'" << endl;
587 cout <<
" solver \'" <<
m_OSOption->optimization->objectives->other[i]->solver <<
"\'" << endl;
588 cout <<
" category \'" <<
m_OSOption->optimization->objectives->other[i]->category <<
"\'" << endl;
589 cout <<
" type \'" <<
m_OSOption->optimization->objectives->other[i]->type <<
"\'" << endl;
590 cout <<
" description \'" <<
m_OSOption->optimization->objectives->other[i]->description <<
"\'" << endl;
594 outStr <<
" numberOfObj=\"" <<
m_OSOption->optimization->objectives->other[i]->numberOfObj <<
"\"";
595 if (
m_OSOption->optimization->objectives->other[i]->value !=
"")
596 outStr <<
" value=\"" <<
m_OSOption->optimization->objectives->other[i]->value <<
"\"";
597 if (
m_OSOption->optimization->objectives->other[i]->solver !=
"")
598 outStr <<
" solver=\"" <<
m_OSOption->optimization->objectives->other[i]->solver <<
"\"";
599 if (
m_OSOption->optimization->objectives->other[i]->category !=
"")
600 outStr <<
" category=\"" <<
m_OSOption->optimization->objectives->other[i]->category <<
"\"";
601 if (
m_OSOption->optimization->objectives->other[i]->type !=
"")
602 outStr <<
" type=\"" <<
m_OSOption->optimization->objectives->other[i]->type <<
"\"";
603 if (
m_OSOption->optimization->objectives->other[i]->description !=
"")
604 outStr <<
" description=\"" <<
m_OSOption->optimization->objectives->other[i]->description <<
"\"";
605 outStr <<
">" << endl;
606 if (
m_OSOption->optimization->objectives->other[i]->numberOfObj > 0)
607 for (
int j=0; j <
m_OSOption->optimization->objectives->other[i]->numberOfObj; j++)
608 { outStr <<
"<var idx=\"" <<
m_OSOption->optimization->objectives->other[i]->obj[j]->idx <<
"\"";
609 if (
m_OSOption->optimization->objectives->other[i]->obj[j]->value !=
"")
610 outStr <<
" value=\"" <<
m_OSOption->optimization->objectives->other[i]->obj[j]->value <<
"\"";
611 outStr <<
"/>" << endl;
613 outStr <<
"</other>" << endl;
615 outStr <<
"</objectives>" << endl;
617 if (
m_OSOption->optimization->constraints != NULL)
618 { outStr <<
"<constraints";
619 if (
m_OSOption->optimization->constraints->numberOfOtherConstraintOptions > 0)
620 outStr <<
" numberOfOtherConstraintOptions=\"" <<
m_OSOption->optimization->constraints->numberOfOtherConstraintOptions <<
"\"";
621 outStr <<
">" << endl;
622 if (
m_OSOption->optimization->constraints->initialConstraintValues != NULL)
623 { outStr <<
"<initialConstraintValues numberOfCon=\"";
624 outStr <<
m_OSOption->optimization->constraints->initialConstraintValues->numberOfCon <<
"\">" << endl;
625 for (
int i=0; i <
m_OSOption->optimization->constraints->initialConstraintValues->numberOfCon; i++)
627 outStr <<
" idx=\"" <<
m_OSOption->optimization->constraints->initialConstraintValues->con[i]->idx <<
"\"";
628 if (
m_OSOption->optimization->constraints->initialConstraintValues->con[i]->value !=
OSNAN)
629 { outStr <<
" value=\"";
630 if (
m_OSOption->optimization->constraints->initialConstraintValues->con[i]->value ==
OSDBL_MAX)
632 else if (
m_OSOption->optimization->constraints->initialConstraintValues->con[i]->value == -
OSDBL_MAX)
637 outStr <<
"\"/>" << endl;
639 outStr <<
"</initialConstraintValues>" << endl;
641 if (
m_OSOption->optimization->constraints->initialDualValues != NULL)
642 { outStr <<
"<initialDualValues numberOfCon=\"";
643 outStr <<
m_OSOption->optimization->constraints->initialDualValues->numberOfCon <<
"\">" << endl;
644 for (
int i=0; i <
m_OSOption->optimization->constraints->initialDualValues->numberOfCon; i++)
646 outStr <<
" idx=\"" <<
m_OSOption->optimization->constraints->initialDualValues->con[i]->idx <<
"\"";
647 outStr <<
" lbDualValue=\"";
648 if (
m_OSOption->optimization->constraints->initialDualValues->con[i]->lbDualValue ==
OSDBL_MAX)
650 else if (
m_OSOption->optimization->constraints->initialDualValues->con[i]->lbDualValue == -
OSDBL_MAX)
654 outStr <<
"\" ubDualValue=\"";
655 if (
m_OSOption->optimization->constraints->initialDualValues->con[i]->ubDualValue ==
OSDBL_MAX)
657 else if (
m_OSOption->optimization->constraints->initialDualValues->con[i]->ubDualValue == -
OSDBL_MAX)
661 outStr <<
"\"/>" << endl;
663 outStr <<
"</initialDualValues>" << endl;
666 printf(
"\n%s%d\n",
"Number of other constraint options: ",
m_OSOption->optimization->constraints->numberOfOtherConstraintOptions);
668 if (
m_OSOption->optimization->constraints->numberOfOtherConstraintOptions > 0)
669 for (
int i=0; i <
m_OSOption->optimization->constraints->numberOfOtherConstraintOptions; i++)
670 { outStr <<
"<other name=\"" <<
m_OSOption->optimization->constraints->other[i]->name <<
"\"";
672 cout <<
"option " << i <<
":" << endl;
673 cout <<
" numberOfCon \'" <<
m_OSOption->optimization->constraints->other[i]->numberOfCon <<
"\'" << endl;
674 cout <<
" value \'" <<
m_OSOption->optimization->constraints->other[i]->value <<
"\'" << endl;
675 cout <<
" solver \'" <<
m_OSOption->optimization->constraints->other[i]->solver <<
"\'" << endl;
676 cout <<
" category \'" <<
m_OSOption->optimization->constraints->other[i]->category <<
"\'" << endl;
677 cout <<
" type \'" <<
m_OSOption->optimization->constraints->other[i]->type <<
"\'" << endl;
678 cout <<
" description \'" <<
m_OSOption->optimization->constraints->other[i]->description <<
"\'" << endl;
682 outStr <<
" numberOfCon=\"" <<
m_OSOption->optimization->constraints->other[i]->numberOfCon <<
"\"";
683 if (
m_OSOption->optimization->constraints->other[i]->value !=
"")
684 outStr <<
" value=\"" <<
m_OSOption->optimization->constraints->other[i]->value <<
"\"";
685 if (
m_OSOption->optimization->constraints->other[i]->solver !=
"")
686 outStr <<
" solver=\"" <<
m_OSOption->optimization->constraints->other[i]->solver <<
"\"";
687 if (
m_OSOption->optimization->constraints->other[i]->category !=
"")
688 outStr <<
" category=\"" <<
m_OSOption->optimization->constraints->other[i]->category <<
"\"";
689 if (
m_OSOption->optimization->constraints->other[i]->type !=
"")
690 outStr <<
" type=\"" <<
m_OSOption->optimization->constraints->other[i]->type <<
"\"";
691 if (
m_OSOption->optimization->constraints->other[i]->description !=
"")
692 outStr <<
" description=\"" <<
m_OSOption->optimization->constraints->other[i]->description <<
"\"";
693 outStr <<
">" << endl;
694 if (
m_OSOption->optimization->constraints->other[i]->numberOfCon > 0)
695 for (
int j=0; j <
m_OSOption->optimization->constraints->other[i]->numberOfCon; j++)
696 { outStr <<
"<con idx=\"" <<
m_OSOption->optimization->constraints->other[i]->con[j]->idx <<
"\"";
697 if (
m_OSOption->optimization->constraints->other[i]->con[j]->value !=
"")
698 outStr <<
" value=\"" <<
m_OSOption->optimization->constraints->other[i]->con[j]->value <<
"\"";
699 if (
m_OSOption->optimization->constraints->other[i]->con[j]->lbValue !=
"")
700 outStr <<
" lbValue=\"" <<
m_OSOption->optimization->constraints->other[i]->con[j]->lbValue <<
"\"";
701 if (
m_OSOption->optimization->constraints->other[i]->con[j]->ubValue !=
"")
702 outStr <<
" ubValue=\"" <<
m_OSOption->optimization->constraints->other[i]->con[j]->ubValue <<
"\"";
703 outStr <<
"/>" << endl;
705 outStr <<
"</other>" << endl;
707 outStr <<
"</constraints>" << endl;
709 if (
m_OSOption->optimization->solverOptions != NULL)
710 {
if (
m_OSOption->optimization->solverOptions->numberOfSolverOptions > 0)
711 { outStr <<
"<solverOptions numberOfSolverOptions=\"";
712 outStr <<
m_OSOption->optimization->solverOptions->numberOfSolverOptions <<
"\">" << endl;
713 for (
int i=0; i <
m_OSOption->optimization->solverOptions->numberOfSolverOptions; i++)
714 { outStr <<
"<solverOption name=\"" <<
m_OSOption->optimization->solverOptions->solverOption[i]->name <<
"\"";
715 if (
m_OSOption->optimization->solverOptions->solverOption[i]->value !=
"")
716 outStr <<
" value=\"" <<
m_OSOption->optimization->solverOptions->solverOption[i]->value <<
"\"";
717 if (
m_OSOption->optimization->solverOptions->solverOption[i]->solver !=
"")
718 outStr <<
" solver=\"" <<
m_OSOption->optimization->solverOptions->solverOption[i]->solver <<
"\"";
719 if (
m_OSOption->optimization->solverOptions->solverOption[i]->category !=
"")
720 outStr <<
" category=\"" <<
m_OSOption->optimization->solverOptions->solverOption[i]->category <<
"\"";
721 if (
m_OSOption->optimization->solverOptions->solverOption[i]->type !=
"")
722 outStr <<
" type=\"" <<
m_OSOption->optimization->solverOptions->solverOption[i]->type <<
"\"";
723 if (
m_OSOption->optimization->solverOptions->solverOption[i]->description !=
"")
724 outStr <<
" description=\"" <<
m_OSOption->optimization->solverOptions->solverOption[i]->description <<
"\"";
725 outStr <<
"/>" << endl;
727 outStr <<
"</solverOptions>" << endl;
730 outStr <<
"</optimization>" << endl;
732 outStr <<
"</osol>" << endl;
std::string os_dtoa_format(double x)
std::string writeOSoL(OSOption *theosoption)
create an osol string from an OSOption object
OSoLWriter()
Default constructor.
~OSoLWriter()
Class destructor.
const OSOption * m_OSOption
m_OSOption is an object in the class OSOption
#define OS_SCHEMA_VERSION