00001
00019
00020
00021
00022
00023 #include "OSrLWriter.h"
00024 #include "OSResult.h"
00025
00026 #include "OSDataStructures.h"
00027 #include "OSParameters.h"
00028 #include "OSMathUtil.h"
00029
00030
00031 #include <sstream>
00032 #include <iostream>
00033
00034 using std::cout;
00035 using std::endl;
00036 using std::ostringstream;
00037
00038 OSrLWriter::OSrLWriter( ) {
00039 }
00040
00041 OSrLWriter::~OSrLWriter(){
00042 }
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058 std::string OSrLWriter::writeOSrL( OSResult *theosresult){
00059 m_OSResult = theosresult;
00060 std::ostringstream outStr;
00061
00062
00063
00064
00065
00066
00067 std::string xsltDir;
00068
00069
00070
00071 xsltDir = "http://www.coin-or.org/OS/stylesheets/";
00072 int i, j;
00073 bool generalTagPrinted;
00074 bool systemTagPrinted;
00075 bool serviceTagPrinted;
00076 bool jobTagPrinted;
00077 #ifdef DEBUG
00078 cout << "in OSrLWriter" << endl;
00079 #endif
00080 if(m_OSResult == NULL) return outStr.str();
00081 outStr << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" ;
00082 outStr << "<?xml-stylesheet type=\"text/xsl\" href=\"";
00083 outStr << xsltDir;
00084 outStr << "OSrL.xslt\"?>";
00085 outStr << endl;
00086 outStr << "<osrl xmlns=\"os.optimizationservices.org\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" ";
00087 outStr << "xsi:schemaLocation=\"os.optimizationservices.org http://www.optimizationservices.org/schemas/";
00088 outStr << OS_SCHEMA_VERSION;
00089 outStr << "/OSrL.xsd\" >" ;
00090 outStr << endl;
00091
00092 #ifdef DEBUG
00093 cout << "output <general>" << endl;
00094 #endif
00095 if(m_OSResult->general != NULL){
00096 generalTagPrinted = false;
00097 if(m_OSResult->general->generalStatus != NULL){
00098 if (generalTagPrinted == false)
00099 {
00100 outStr << "<general>" << endl;
00101 generalTagPrinted = true;
00102 }
00103 outStr << "<generalStatus";
00104 if(m_OSResult->general->generalStatus->type.length() > 0){
00105 outStr << " type=\"";
00106 outStr << m_OSResult->general->generalStatus->type ;
00107 outStr << "\"";
00108 }
00109 if(m_OSResult->general->generalStatus->description.length() > 0){
00110 outStr << " description=\"";
00111 outStr << m_OSResult->general->generalStatus->description ;
00112 outStr << "\"";
00113 }
00114 if (m_OSResult->general->generalStatus->numberOfSubstatuses > 0)
00115 {
00116 outStr << " numberOfSubstatuses=\"";
00117 outStr << m_OSResult->general->generalStatus->numberOfSubstatuses;
00118 outStr << "\"";
00119 }
00120 outStr << ">" << endl;
00121 for (int i=0; i < m_OSResult->general->generalStatus->numberOfSubstatuses; i++)
00122 { outStr << "<substatus";
00123 if (m_OSResult->general->generalStatus->substatus[i]->name.length() > 0)
00124 { outStr << " name=\"";
00125 outStr << m_OSResult->general->generalStatus->substatus[i]->name ;
00126 outStr << "\"";
00127 }
00128 if (m_OSResult->general->generalStatus->substatus[i]->description.length() > 0)
00129 { outStr << " description=\"";
00130 outStr << m_OSResult->general->generalStatus->substatus[i]->description ;
00131 outStr << "\"";
00132 }
00133 outStr << "/>" << endl;
00134 }
00135 outStr << "</generalStatus>" << endl;
00136 }
00137
00138 if(m_OSResult->general->message.length() > 0){
00139 if (generalTagPrinted == false)
00140 {
00141 outStr << "<general>" << endl;
00142 generalTagPrinted = true;
00143 }
00144 outStr << "<message>" + m_OSResult->general->message + "</message>" << endl;
00145 }
00146 if(m_OSResult->general->serviceURI.length() > 0){
00147 if (generalTagPrinted == false)
00148 {
00149 outStr << "<general>" << endl;
00150 generalTagPrinted = true;
00151 }
00152 outStr << "<serviceURI>" + m_OSResult->general->serviceURI + "</serviceURI>" << endl;
00153 }
00154 if(m_OSResult->general->serviceName.length() > 0){
00155 if (generalTagPrinted == false)
00156 {
00157 outStr << "<general>" << endl;
00158 generalTagPrinted = true;
00159 }
00160 outStr << "<serviceName>" + m_OSResult->general->serviceName + "</serviceName>" << endl;
00161 }
00162 if(m_OSResult->general->instanceName.length() > 0){
00163 if (generalTagPrinted == false)
00164 {
00165 outStr << "<general>" << endl;
00166 generalTagPrinted = true;
00167 }
00168 outStr << "<instanceName>" + m_OSResult->general->instanceName + "</instanceName>" << endl;
00169 }
00170 if(m_OSResult->general->jobID.length() > 0){
00171 if (generalTagPrinted == false)
00172 {
00173 outStr << "<general>" << endl;
00174 generalTagPrinted = true;
00175 }
00176 outStr << "<jobID>" + m_OSResult->general->jobID + "</jobID>" << endl;
00177 }
00178 if(m_OSResult->general->solverInvoked.length() > 0){
00179 if (generalTagPrinted == false)
00180 {
00181 outStr << "<general>" << endl;
00182 generalTagPrinted = true;
00183 }
00184 outStr << "<solverInvoked>" + m_OSResult->general->solverInvoked + "</solverInvoked>" << endl;
00185 }
00186 if(m_OSResult->general->timeStamp.length() > 0){
00187 if (generalTagPrinted == false)
00188 {
00189 outStr << "<general>" << endl;
00190 generalTagPrinted = true;
00191 }
00192 outStr << "<timeStamp>" + m_OSResult->general->timeStamp + "</timeStamp>" << endl;
00193 }
00194
00195 if(m_OSResult->general->otherResults != NULL)
00196 { if(m_OSResult->general->otherResults->numberOfOtherResults > 0)
00197 {
00198 if (generalTagPrinted == false)
00199 {
00200 outStr << "<general>" << endl;
00201 generalTagPrinted = true;
00202 }
00203 outStr << "<otherResults numberOfOtherResults=\"";
00204 outStr << m_OSResult->general->otherResults->numberOfOtherResults;
00205 outStr << "\">" << endl;
00206 for (int i=0; i < m_OSResult->general->otherResults->numberOfOtherResults; i++)
00207 { outStr << "<other";
00208 if (m_OSResult->general->otherResults->other[i]->name.length() > 0)
00209 { outStr << " name=\"";
00210 outStr << m_OSResult->general->otherResults->other[i]->name;
00211 outStr << "\"";
00212 }
00213 if (m_OSResult->general->otherResults->other[i]->value.length() > 0)
00214 { outStr << " value=\"";
00215 outStr << m_OSResult->general->otherResults->other[i]->value;
00216 outStr << "\"";
00217 }
00218 if (m_OSResult->general->otherResults->other[i]->description.length() > 0)
00219 { outStr << " description=\"";
00220 outStr << m_OSResult->general->otherResults->other[i]->description;
00221 outStr << "\"";
00222 }
00223 outStr << " />" << endl;
00224 }
00225 outStr << "</otherResults>" << endl;;
00226 }
00227 }
00228 if (generalTagPrinted == true)
00229 outStr << "</general>" << endl;
00230 }
00231
00232
00233 #ifdef DEBUG
00234 cout << "output <system>" << endl;
00235 #endif
00236 if(m_OSResult->system != NULL){
00237 systemTagPrinted = false;
00238 if(m_OSResult->system->systemInformation.length() > 0){
00239 if (systemTagPrinted == false)
00240 {
00241 outStr << "<system>" << endl;
00242 systemTagPrinted = true;
00243 }
00244 outStr << "<systemInformation>" + m_OSResult->system->systemInformation + "</systemInformation>" << endl;
00245 }
00246
00247 if(m_OSResult->system->availableDiskSpace != NULL){
00248 if (systemTagPrinted == false)
00249 {
00250 outStr << "<system>" << endl;
00251 systemTagPrinted = true;
00252 }
00253 outStr << "<availableDiskSpace";
00254 if(m_OSResult->system->availableDiskSpace->unit.length() > 0){
00255 outStr << " unit=\"";
00256 outStr << m_OSResult->system->availableDiskSpace->unit ;
00257 outStr << "\"";
00258 }
00259 if(m_OSResult->system->availableDiskSpace->description.length() > 0){
00260 outStr << " description=\"";
00261 outStr << m_OSResult->system->availableDiskSpace->description ;
00262 outStr << "\"";
00263 }
00264 outStr << ">";
00265 outStr << m_OSResult->system->availableDiskSpace->value ;
00266 outStr << "</availableDiskSpace>" << endl;
00267 }
00268
00269 if(m_OSResult->system->availableMemory != NULL){
00270 if (systemTagPrinted == false)
00271 {
00272 outStr << "<system>" << endl;
00273 systemTagPrinted = true;
00274 }
00275 outStr << "<availableMemory";
00276 if(m_OSResult->system->availableMemory->unit.length() > 0){
00277 outStr << " unit=\"";
00278 outStr << m_OSResult->system->availableMemory->unit ;
00279 outStr << "\"";
00280 }
00281 if(m_OSResult->system->availableMemory->description.length() > 0){
00282 outStr << " description=\"";
00283 outStr << m_OSResult->system->availableMemory->description ;
00284 outStr << "\"";
00285 }
00286 outStr << ">";
00287 outStr << m_OSResult->system->availableMemory->value ;
00288 outStr << "</availableMemory>" << endl;
00289 }
00290
00291 if(m_OSResult->system->availableCPUSpeed != NULL){
00292 if (systemTagPrinted == false)
00293 {
00294 outStr << "<system>" << endl;
00295 systemTagPrinted = true;
00296 }
00297 outStr << "<availableCPUSpeed";
00298 if(m_OSResult->system->availableCPUSpeed->unit.length() > 0){
00299 outStr << " unit=\"";
00300 outStr << m_OSResult->system->availableCPUSpeed->unit ;
00301 outStr << "\"";
00302 }
00303 if(m_OSResult->system->availableCPUSpeed->description.length() > 0){
00304 outStr << " description=\"";
00305 outStr << m_OSResult->system->availableCPUSpeed->description ;
00306 outStr << "\"";
00307 }
00308 outStr << ">";
00309 outStr << m_OSResult->system->availableCPUSpeed->value ;
00310 outStr << "</availableCPUSpeed>" << endl;
00311 }
00312
00313 if(m_OSResult->system->availableCPUNumber != NULL){
00314 if (systemTagPrinted == false)
00315 {
00316 outStr << "<system>" << endl;
00317 systemTagPrinted = true;
00318 }
00319 outStr << "<availableCPUNumber";
00320 if(m_OSResult->system->availableCPUNumber->description.length() > 0){
00321 outStr << " description=\"";
00322 outStr << m_OSResult->system->availableCPUNumber->description ;
00323 outStr << "\"";
00324 }
00325 outStr << ">";
00326 outStr << m_OSResult->system->availableCPUNumber->value;
00327 outStr << "</availableCPUNumber>" << endl;
00328 }
00329
00330 if(m_OSResult->system->otherResults != NULL)
00331 { if(m_OSResult->system->otherResults->numberOfOtherResults > 0)
00332 {
00333 if (systemTagPrinted == false)
00334 {
00335 outStr << "<system>" << endl;
00336 systemTagPrinted = true;
00337 }
00338 outStr << "<otherResults numberOfOtherResults=\"";
00339 outStr << m_OSResult->system->otherResults->numberOfOtherResults;
00340 outStr << "\">" << endl;
00341 for (int i=0; i < m_OSResult->system->otherResults->numberOfOtherResults; i++)
00342 { outStr << "<other";
00343 if (m_OSResult->system->otherResults->other[i]->name.length() > 0)
00344 { outStr << " name=\"";
00345 outStr << m_OSResult->system->otherResults->other[i]->name;
00346 outStr << "\"";
00347 }
00348 if (m_OSResult->system->otherResults->other[i]->value.length() > 0)
00349 { outStr << " value=\"";
00350 outStr << m_OSResult->system->otherResults->other[i]->value;
00351 outStr << "\"";
00352 }
00353 if (m_OSResult->system->otherResults->other[i]->description.length() > 0)
00354 { outStr << " description=\"";
00355 outStr << m_OSResult->system->otherResults->other[i]->description;
00356 outStr << "\"";
00357 }
00358 outStr << " />" << endl;
00359 }
00360 outStr << "</otherResults>" << endl;
00361 }
00362 }
00363 if (systemTagPrinted == true)
00364 outStr << "</system>" << endl;
00365 }
00366
00367
00368 #ifdef DEBUG
00369 cout << "output <service>" << endl;
00370 #endif
00371 if(m_OSResult->service != NULL){
00372 serviceTagPrinted = false;
00373 if(m_OSResult->service->currentState.length() > 0 && m_OSResult->service->currentState != "unknown"){
00374 if (serviceTagPrinted == false)
00375 {
00376 outStr << "<service>" << endl;
00377 serviceTagPrinted = true;
00378 }
00379 outStr << "<currentState>" << m_OSResult->service->currentState << "</currentState>" << endl;
00380 }
00381 if(m_OSResult->service->currentJobCount >= 0){
00382 if (serviceTagPrinted == false)
00383 {
00384 outStr << "<service>" << endl;
00385 serviceTagPrinted = true;
00386 }
00387 outStr << "<currentJobCount>" << m_OSResult->service->currentJobCount << "</currentJobCount>" << endl;
00388 }
00389 if(m_OSResult->service->totalJobsSoFar >= 0){
00390 if (serviceTagPrinted == false)
00391 {
00392 outStr << "<service>" << endl;
00393 serviceTagPrinted = true;
00394 }
00395 outStr << "<totalJobsSoFar>" << m_OSResult->service->totalJobsSoFar << "</totalJobsSoFar>" << endl;
00396 }
00397 if(m_OSResult->service->timeServiceStarted.length() > 0 && m_OSResult->service->timeServiceStarted != "1970-01-01T00:00:00-00:00"){
00398 if (serviceTagPrinted == false)
00399 {
00400 outStr << "<service>" << endl;
00401 serviceTagPrinted = true;
00402 }
00403 outStr << "<timeServiceStarted>" << m_OSResult->service->timeServiceStarted << "</timeServiceStarted>" << endl;
00404 }
00405 if(m_OSResult->service->serviceUtilization >= 0){
00406 if (serviceTagPrinted == false)
00407 {
00408 outStr << "<service>" << endl;
00409 serviceTagPrinted = true;
00410 }
00411 outStr << "<serviceUtilization>" << m_OSResult->service->serviceUtilization << "</serviceUtilization>" << endl;
00412 }
00413
00414 if(m_OSResult->service->otherResults != NULL)
00415 { if(m_OSResult->service->otherResults->numberOfOtherResults > 0)
00416 {
00417 if (serviceTagPrinted == false)
00418 {
00419 outStr << "<service>" << endl;
00420 serviceTagPrinted = true;
00421 }
00422 outStr << "<otherResults numberOfOtherResults=\"";
00423 outStr << m_OSResult->service->otherResults->numberOfOtherResults;
00424 outStr << "\">" << endl;
00425 for (int i=0; i < m_OSResult->service->otherResults->numberOfOtherResults; i++)
00426 { outStr << "<other";
00427 if (m_OSResult->service->otherResults->other[i]->name.length() > 0)
00428 { outStr << " name=\"";
00429 outStr << m_OSResult->service->otherResults->other[i]->name;
00430 outStr << "\"";
00431 }
00432 if (m_OSResult->service->otherResults->other[i]->value.length() > 0)
00433 { outStr << " value=\"";
00434 outStr << m_OSResult->service->otherResults->other[i]->value;
00435 outStr << "\"";
00436 }
00437 if (m_OSResult->service->otherResults->other[i]->description.length() > 0)
00438 { outStr << " description=\"";
00439 outStr << m_OSResult->service->otherResults->other[i]->description;
00440 outStr << "\"";
00441 }
00442 outStr << " />" << endl;
00443 }
00444 outStr << "</otherResults>" << endl;
00445 }
00446 }
00447 if (serviceTagPrinted == true)
00448 outStr << "</service>" << endl;
00449 }
00450
00451
00452 #ifdef DEBUG
00453 cout << "output <job>" << endl;
00454 #endif
00455 if(m_OSResult->job != NULL){
00456 jobTagPrinted = false;
00457
00458 if(m_OSResult->job->status.length() > 0 && m_OSResult->job->status != "finished"){
00459 if (jobTagPrinted == false)
00460 {
00461 outStr << "<job>" << endl;
00462 jobTagPrinted = true;
00463 }
00464 outStr << "<status>" + m_OSResult->job->status + "</status>" << endl;
00465 }
00466 if(m_OSResult->job->submitTime.length() > 0 && m_OSResult->job->submitTime != "1970-01-01T00:00:00-00:00"){
00467 if (jobTagPrinted == false)
00468 {
00469 outStr << "<job>" << endl;
00470 jobTagPrinted = true;
00471 }
00472 outStr << "<submitTime>" + m_OSResult->job->submitTime + "</submitTime>" << endl;
00473 }
00474 if(m_OSResult->job->scheduledStartTime.length() > 0 && m_OSResult->job->scheduledStartTime != "1970-01-01T00:00:00-00:00"){
00475 if (jobTagPrinted == false)
00476 {
00477 outStr << "<job>" << endl;
00478 jobTagPrinted = true;
00479 }
00480 outStr << "<scheduledStartTime>" + m_OSResult->job->scheduledStartTime + "</scheduledStartTime>" << endl;
00481 }
00482 if(m_OSResult->job->actualStartTime.length() > 0 && m_OSResult->job->actualStartTime != "1970-01-01T00:00:00-00:00"){
00483 if (jobTagPrinted == false)
00484 {
00485 outStr << "<job>" << endl;
00486 jobTagPrinted = true;
00487 }
00488 outStr << "<actualStartTime>" + m_OSResult->job->actualStartTime + "</actualStartTime>" << endl;
00489 }
00490 if(m_OSResult->job->endTime.length() > 0 && m_OSResult->job->endTime != "1970-01-01T00:00:00-00:00"){
00491 if (jobTagPrinted == false)
00492 {
00493 outStr << "<job>" << endl;
00494 jobTagPrinted = true;
00495 }
00496 outStr << "<endTime>" + m_OSResult->job->endTime + "</endTime>" << endl;
00497 }
00498
00499 if (m_OSResult->job->timingInformation != NULL)
00500 if (m_OSResult->job->timingInformation->numberOfTimes > 0)
00501 {
00502 if (jobTagPrinted == false)
00503 {
00504 outStr << "<job>" << endl;
00505 jobTagPrinted = true;
00506 }
00507 outStr << "<timingInformation numberOfTimes=\"";
00508 outStr << m_OSResult->job->timingInformation->numberOfTimes << "\">" << endl;
00509 for (i=0; i<m_OSResult->job->timingInformation->numberOfTimes; i++)
00510 { outStr << "<time ";
00511 if (m_OSResult->job->timingInformation->time[i]->type != "")
00512 outStr << "type=\"" << m_OSResult->job->timingInformation->time[i]->type << "\" ";
00513 if (m_OSResult->job->timingInformation->time[i]->unit != "")
00514 outStr << "unit=\"" << m_OSResult->job->timingInformation->time[i]->unit << "\" ";
00515 if (m_OSResult->job->timingInformation->time[i]->category != "")
00516 outStr << "category=\"" << m_OSResult->job->timingInformation->time[i]->category << "\" ";
00517 if (m_OSResult->job->timingInformation->time[i]->description != "")
00518 outStr << "description=\"" << m_OSResult->job->timingInformation->time[i]->description << "\" ";
00519 outStr << ">" << endl;
00520 outStr << os_dtoa_format(m_OSResult->job->timingInformation->time[i]->value);
00521 outStr << "</time>" << endl;
00522 }
00523 outStr << "</timingInformation>" << endl;
00524 }
00525
00526 if(m_OSResult->job->usedDiskSpace != NULL){
00527 if (jobTagPrinted == false)
00528 {
00529 outStr << "<job>" << endl;
00530 jobTagPrinted = true;
00531 }
00532 outStr << "<usedDiskSpace";
00533 if(m_OSResult->job->usedDiskSpace->unit.length() > 0){
00534 outStr << " unit=\"";
00535 outStr << m_OSResult->job->usedDiskSpace->unit ;
00536 outStr << "\"";
00537 }
00538 if(m_OSResult->job->usedDiskSpace->description.length() > 0){
00539 outStr << " description=\"";
00540 outStr << m_OSResult->job->usedDiskSpace->description ;
00541 outStr << "\"";
00542 }
00543 outStr << ">";
00544 outStr << m_OSResult->job->usedDiskSpace->value ;
00545 outStr << "</usedDiskSpace>" << endl;
00546 }
00547
00548 if(m_OSResult->job->usedMemory != NULL){
00549 if (jobTagPrinted == false)
00550 {
00551 outStr << "<job>" << endl;
00552 jobTagPrinted = true;
00553 }
00554 outStr << "<usedMemory";
00555 if(m_OSResult->job->usedMemory->unit.length() > 0){
00556 outStr << " unit=\"";
00557 outStr << m_OSResult->job->usedMemory->unit ;
00558 outStr << "\"";
00559 }
00560 if(m_OSResult->job->usedMemory->description.length() > 0){
00561 outStr << " description=\"";
00562 outStr << m_OSResult->job->usedMemory->description ;
00563 outStr << "\"";
00564 }
00565 outStr << ">";
00566 outStr << m_OSResult->job->usedMemory->value ;
00567 outStr << "</usedMemory>" << endl;
00568 }
00569
00570 if(m_OSResult->job->usedCPUSpeed != NULL){
00571 if (jobTagPrinted == false)
00572 {
00573 outStr << "<job>" << endl;
00574 jobTagPrinted = true;
00575 }
00576 outStr << "<usedCPUSpeed";
00577 if(m_OSResult->job->usedCPUSpeed->unit.length() > 0){
00578 outStr << " unit=\"";
00579 outStr << m_OSResult->job->usedCPUSpeed->unit ;
00580 outStr << "\"";
00581 }
00582 if(m_OSResult->job->usedCPUSpeed->description.length() > 0){
00583 outStr << " description=\"";
00584 outStr << m_OSResult->job->usedCPUSpeed->description;
00585 outStr << "\"";
00586 }
00587 outStr << ">";
00588 outStr << m_OSResult->job->usedCPUSpeed->value ;
00589 outStr << "</usedCPUSpeed>" << endl;
00590 }
00591
00592 if(m_OSResult->job->usedCPUNumber != NULL){
00593 if (jobTagPrinted == false)
00594 {
00595 outStr << "<job>" << endl;
00596 jobTagPrinted = true;
00597 }
00598 outStr << "<usedCPUNumber";
00599 if(m_OSResult->job->usedCPUNumber->description.length() > 0){
00600 outStr << " description=\"";
00601 outStr << m_OSResult->job->usedCPUNumber->description;
00602 outStr << "\"";
00603 }
00604 outStr << ">";
00605 outStr << m_OSResult->job->usedCPUNumber->value;
00606 outStr << "</usedCPUNumber>" << endl;
00607 }
00608
00609 if(m_OSResult->job->otherResults != NULL)
00610 { if(m_OSResult->job->otherResults->numberOfOtherResults > 0)
00611 {
00612 if (jobTagPrinted == false)
00613 {
00614 outStr << "<job>" << endl;
00615 jobTagPrinted = true;
00616 }
00617 outStr << "<otherResults numberOfOtherResults=\"";
00618 outStr << m_OSResult->job->otherResults->numberOfOtherResults;
00619 outStr << "\">" << endl;
00620 for (int i=0; i < m_OSResult->job->otherResults->numberOfOtherResults; i++)
00621 { outStr << "<other";
00622 if (m_OSResult->job->otherResults->other[i]->name.length() > 0)
00623 { outStr << " name=\"";
00624 outStr << m_OSResult->job->otherResults->other[i]->name;
00625 outStr << "\"";
00626 }
00627 if (m_OSResult->job->otherResults->other[i]->value.length() > 0)
00628 { outStr << " value=\"";
00629 outStr << m_OSResult->job->otherResults->other[i]->value;
00630 outStr << "\"";
00631 }
00632 if (m_OSResult->job->otherResults->other[i]->description.length() > 0)
00633 { outStr << " description=\"";
00634 outStr << m_OSResult->job->otherResults->other[i]->description;
00635 outStr << "\"";
00636 }
00637 outStr << " />" << endl;
00638 }
00639 outStr << "</otherResults>" << endl;
00640 }
00641 }
00642 if (jobTagPrinted == true)
00643 outStr << "</job>" << endl;
00644 }
00645
00646
00647 #ifdef DEBUG
00648 cout << "output <optimization>" << endl;
00649 #endif
00650 if(m_OSResult->optimization != NULL && m_OSResult->optimization->numberOfSolutions > 0){
00651 outStr << "<optimization " ;
00652 outStr << "numberOfSolutions=\"";
00653 outStr << m_OSResult->optimization->numberOfSolutions ;
00654 outStr << "\"";
00655 outStr << " numberOfVariables=\"";
00656 outStr << m_OSResult->optimization->numberOfVariables ;
00657 outStr << "\"";
00658 outStr << " numberOfConstraints=\"";
00659 outStr << m_OSResult->optimization->numberOfConstraints ;
00660 outStr << "\"";
00661 outStr << " numberOfObjectives=\"";
00662 outStr << m_OSResult->optimization->numberOfObjectives ;
00663 outStr << "\"" ;
00664 outStr << ">" << endl;
00665
00666 for(i = 0; i < m_OSResult->optimization->numberOfSolutions; i++){
00667 if(m_OSResult->optimization->solution[i] != NULL){
00668 outStr << "<solution" ;
00669 outStr << " targetObjectiveIdx=\"";
00670 outStr << m_OSResult->optimization->solution[i]->targetObjectiveIdx ;
00671 outStr << "\"" ;
00672 if (m_OSResult->optimization->solution[i]->weightedObjectives)
00673 outStr << " weightedObjectives=\"true\"";
00674 outStr << ">" << endl;
00675 if(m_OSResult->optimization->solution[i]->status != NULL){
00676 outStr << "<status";
00677 if (m_OSResult->optimization->solution[i]->status->numberOfSubstatuses > 0)
00678 {
00679 outStr << " numberOfSubstatuses=\"";
00680 outStr << m_OSResult->optimization->solution[i]->status->numberOfSubstatuses ;
00681 outStr << "\"";
00682 }
00683 if(m_OSResult->optimization->solution[i]->status->type.length() > 0){
00684 outStr << " type=\"";
00685 outStr << m_OSResult->optimization->solution[i]->status->type;
00686 outStr << "\"";
00687 }
00688 if(m_OSResult->optimization->solution[i]->status->description.length() > 0){
00689 outStr << " description=\"";
00690 outStr << m_OSResult->optimization->solution[i]->status->description;
00691 outStr << "\"" ;
00692 }
00693 outStr << ">" << endl;
00694 for (int j=0; j < m_OSResult->optimization->solution[i]->status->numberOfSubstatuses; j++)
00695 { outStr << "<substatus";
00696 if(m_OSResult->optimization->solution[i]->status->substatus[j]->type.length() > 0){
00697 outStr << " type=\"";
00698 outStr << m_OSResult->optimization->solution[i]->status->substatus[j]->type;
00699 outStr << "\"";
00700 }
00701 if(m_OSResult->optimization->solution[i]->status->substatus[j]->description.length() > 0){
00702 outStr << " description=\"";
00703 outStr << m_OSResult->optimization->solution[i]->status->substatus[j]->description;
00704 outStr << "\"" ;
00705 }
00706 outStr << "/>" << endl;
00707 }
00708 outStr << "</status>" << endl;
00709 }
00710
00711 if(m_OSResult->optimization->solution[i]->message != ""){
00712 outStr << "<message>";
00713 outStr << m_OSResult->optimization->solution[i]->message;
00714 outStr << "</message>" << endl;
00715 }
00716 if(m_OSResult->optimization->solution[i]->variables != NULL){
00717 outStr << "<variables ";
00718 if (m_OSResult->optimization->solution[i]->variables->numberOfOtherVariableResults > 0)
00719 outStr << "numberOfOtherVariableResults=\"" << m_OSResult->optimization->solution[i]->variables->numberOfOtherVariableResults << "\"";
00720 outStr << ">" << endl;
00721 if(m_OSResult->optimization->solution[i]->variables->values != NULL){
00722 #ifdef DEBUG
00723 cout << "output <variables> <values>" << endl;
00724 #endif
00725 outStr << "<values numberOfVar=\"" << m_OSResult->optimization->solution[i]->variables->values->numberOfVar << "\">" << endl;
00726 for(j = 0; j < m_OSResult->optimization->solution[i]->variables->values->numberOfVar; j++){
00727 if(m_OSResult->optimization->solution[i]->variables->values->var[j] != NULL){
00728 outStr << "<var";
00729 outStr << " idx=\"";
00730 outStr << m_OSResult->optimization->solution[i]->variables->values->var[j]->idx;
00731 outStr << "\">";
00732 outStr << os_dtoa_format( m_OSResult->optimization->solution[i]->variables->values->var[j]->value );
00733 outStr << "</var>" << endl;
00734 }
00735 }
00736 outStr << "</values>" << endl;
00737 }
00738
00739 if(m_OSResult->optimization->solution[i]->variables->valuesString != NULL){
00740 #ifdef DEBUG
00741 cout << "output <variables> <valuesString>" << endl;
00742 #endif
00743 outStr << "<valuesString numberOfVar=\"" << m_OSResult->optimization->solution[i]->variables->valuesString->numberOfVar << "\">" << endl;
00744 for(j = 0; j < m_OSResult->optimization->solution[i]->variables->valuesString->numberOfVar; j++){
00745 if(m_OSResult->optimization->solution[i]->variables->valuesString->var[j] != NULL){
00746 outStr << "<var";
00747 outStr << " idx=\"";
00748 outStr << m_OSResult->optimization->solution[i]->variables->valuesString->var[j]->idx;
00749 outStr << "\">";
00750 outStr << m_OSResult->optimization->solution[i]->variables->valuesString->var[j]->value;
00751 outStr << "</var>" << endl;
00752 }
00753 }
00754 outStr << "</valuesString>" << endl;
00755 }
00756
00757 if(m_OSResult->optimization->solution[i]->variables->basisStatus != NULL){
00758 #ifdef DEBUG
00759 cout << "output <variables> <basisStatus>" << endl;
00760 #endif
00761 outStr << "<basisStatus numberOfVar=\"" << m_OSResult->optimization->solution[i]->variables->basisStatus->numberOfVar << "\">" << endl;
00762 for(j = 0; j < m_OSResult->optimization->solution[i]->variables->basisStatus->numberOfVar; j++){
00763 if(m_OSResult->optimization->solution[i]->variables->basisStatus->var[j] != NULL){
00764 outStr << "<var";
00765 outStr << " idx=\"";
00766 outStr << m_OSResult->optimization->solution[i]->variables->basisStatus->var[j]->idx;
00767 outStr << "\">";
00768 outStr << m_OSResult->optimization->solution[i]->variables->basisStatus->var[j]->value;
00769 outStr << "</var>" << endl;
00770 }
00771 }
00772 outStr << "</basisStatus>" << endl;
00773 }
00774
00775
00776 #ifdef DEBUG
00777 cout << "output <variables> <other>" << endl;
00778 #endif
00779 if(m_OSResult->optimization->solution[i]->variables->other != NULL){
00780 if(m_OSResult->optimization->solution[i]->variables->numberOfOtherVariableResults > 0){
00781 for(int k = 0; k < m_OSResult->optimization->solution[i]->variables->numberOfOtherVariableResults; k++){
00782 outStr << "<other" ;
00783 outStr << " numberOfVar=\"";
00784 outStr << m_OSResult->optimization->solution[i]->variables->other[k]->numberOfVar;
00785 outStr << "\"" ;
00786 if (m_OSResult->optimization->solution[i]->variables->other[k]->name != "")
00787 {
00788 outStr << " name=\"";
00789 outStr << m_OSResult->optimization->solution[i]->variables->other[k]->name;
00790 outStr << "\"" ;
00791 }
00792 if (m_OSResult->optimization->solution[i]->variables->other[k]->value != "")
00793 {
00794 outStr << " value=\"";
00795 outStr << m_OSResult->optimization->solution[i]->variables->other[k]->value;
00796 outStr << "\"" ;
00797 }
00798 if (m_OSResult->optimization->solution[i]->variables->other[k]->description != "")
00799 {
00800 outStr << " description=\"";
00801 outStr << m_OSResult->optimization->solution[i]->variables->other[k]->description;
00802 outStr << "\"" ;
00803 }
00804 outStr << ">" << endl;
00805 if(m_OSResult->optimization->solution[i]->variables->other[k]->numberOfVar > 0){
00806 for(j = 0; j < m_OSResult->optimization->solution[i]->variables->other[k]->numberOfVar; j++){
00807 outStr << "<var";
00808 outStr << " idx=\"";
00809 outStr << m_OSResult->optimization->solution[i]->variables->other[k]->var[j]->idx ;
00810 outStr << "\">";
00811 outStr << m_OSResult->optimization->solution[i]->variables->other[k]->var[j]->value;
00812 outStr << "</var>" << endl;
00813 }
00814 }
00815 outStr << "</other>" << endl;
00816 }
00817 }
00818 }
00819 outStr << "</variables>" << endl;
00820 }
00821
00822
00823
00824 if(m_OSResult->optimization->solution[i]->objectives != NULL){
00825 outStr << "<objectives ";
00826 if (m_OSResult->optimization->solution[i]->objectives->numberOfOtherObjectiveResults > 0)
00827 outStr << "numberOfOtherObjectiveResults=\"" << m_OSResult->optimization->solution[i]->objectives->numberOfOtherObjectiveResults << "\"";
00828 outStr << ">" << endl;
00829 #ifdef DEBUG
00830 cout << "output <objectives> <values>" << endl;
00831 #endif
00832 if(m_OSResult->optimization->solution[i]->objectives->values != NULL){
00833 outStr << "<values numberOfObj=\"" << m_OSResult->optimization->solution[i]->objectives->values->numberOfObj << "\">" << endl;
00834 for(j = 0; j < m_OSResult->optimization->solution[i]->objectives->values->numberOfObj; j++){
00835 if(m_OSResult->optimization->solution[i]->objectives->values->obj[j] != NULL){
00836 outStr << "<obj";
00837 outStr << " idx=\"";
00838 outStr << m_OSResult->optimization->solution[i]->objectives->values->obj[j]->idx;
00839 outStr << "\">";
00840 outStr << os_dtoa_format( m_OSResult->optimization->solution[i]->objectives->values->obj[j]->value);
00841 outStr << "</obj>" << endl;
00842 }
00843 }
00844
00845 outStr << "</values>" << endl;
00846 }
00847 #ifdef DEBUG
00848 cout << "output <objectives> <other>" << endl;
00849 #endif
00850 if(m_OSResult->optimization->solution[i]->objectives->other != NULL){
00851 if(m_OSResult->optimization->solution[i]->objectives->numberOfOtherObjectiveResults > 0){
00852 for(int k = 0; k < m_OSResult->optimization->solution[i]->objectives->numberOfOtherObjectiveResults; k++){
00853 outStr << "<other" ;
00854 outStr << " numberOfObj=\"";
00855 outStr << m_OSResult->optimization->solution[i]->objectives->other[k]->numberOfObj;
00856 outStr << "\"" ;
00857 if (m_OSResult->optimization->solution[i]->objectives->other[k]->name != "")
00858 {
00859 outStr << " name=\"";\
00860 outStr << m_OSResult->optimization->solution[i]->objectives->other[k]->name;
00861 outStr << "\"" ;
00862 };
00863 if (m_OSResult->optimization->solution[i]->objectives->other[k]->value != "")
00864 {
00865 outStr << " value=\"";\
00866 outStr << m_OSResult->optimization->solution[i]->objectives->other[k]->value;
00867 outStr << "\"" ;
00868 };
00869 if (m_OSResult->optimization->solution[i]->objectives->other[k]->description != "")
00870 {
00871 outStr << " description=\"";
00872 outStr << m_OSResult->optimization->solution[i]->objectives->other[k]->description;
00873 outStr << "\"" ;
00874 };
00875 outStr << ">" << endl;
00876 if(m_OSResult->optimization->solution[i]->objectives->other[k]->numberOfObj > 0){
00877 for(j = 0; j < m_OSResult->optimization->solution[i]->objectives->other[k]->numberOfObj; j++){
00878 outStr << "<obj";
00879 outStr << " idx=\"";
00880 outStr << m_OSResult->optimization->solution[i]->objectives->other[k]->obj[j]->idx;
00881 outStr << "\">";
00882 outStr << m_OSResult->optimization->solution[i]->objectives->other[k]->obj[j]->value;
00883 outStr << "</obj>" << endl;
00884 }
00885 }
00886 outStr << "</other>" << endl;
00887 }
00888 }
00889 }
00890 outStr << "</objectives>" << endl;
00891 }
00892 if(m_OSResult->optimization->solution[i]->constraints != NULL){
00893 outStr << "<constraints ";
00894 if (m_OSResult->optimization->solution[i]->constraints->numberOfOtherConstraintResults > 0)
00895 outStr << "numberOfOtherConstraintResults=\"" << m_OSResult->optimization->solution[i]->constraints->numberOfOtherConstraintResults << "\"";
00896 outStr << ">" << endl;
00897 #ifdef DEBUG
00898 cout << "output <constraints> <dualValues>" << endl;
00899 #endif
00900 if(m_OSResult->optimization->solution[i]->constraints->dualValues != NULL){
00901 outStr << "<dualValues numberOfCon=\"" << m_OSResult->optimization->solution[i]->constraints->dualValues->numberOfCon << "\">" << endl;
00902 for(j = 0; j < m_OSResult->optimization->solution[i]->constraints->dualValues->numberOfCon; j++){
00903 if(m_OSResult->optimization->solution[i]->constraints->dualValues->con[j] != NULL){
00904 outStr << "<con";
00905 outStr << " idx=\"";
00906 outStr << m_OSResult->optimization->solution[i]->constraints->dualValues->con[j]->idx;
00907 outStr << "\">";
00908 outStr << os_dtoa_format( m_OSResult->optimization->solution[i]->constraints->dualValues->con[j]->value);
00909 outStr << "</con>" << endl;
00910 }
00911 }
00912 outStr << "</dualValues>" << endl;
00913 }
00914 #ifdef DEBUG
00915 cout << "output <constraints> <other>" << endl;
00916 #endif
00917 if(m_OSResult->optimization->solution[i]->constraints->other != NULL){
00918 if(m_OSResult->optimization->solution[i]->constraints->numberOfOtherConstraintResults > 0){
00919 for(int k = 0; k < m_OSResult->optimization->solution[i]->constraints->numberOfOtherConstraintResults; k++){
00920 outStr << "<other" ;
00921 outStr << " numberOfCon=\"";
00922 outStr << m_OSResult->optimization->solution[i]->constraints->other[k]->numberOfCon;
00923 outStr << "\"" ;
00924 if (m_OSResult->optimization->solution[i]->constraints->other[k]->name != "")
00925 {
00926 outStr << " name=\"";\
00927 outStr << m_OSResult->optimization->solution[i]->constraints->other[k]->name;
00928 outStr << "\"" ;
00929 };
00930 if (m_OSResult->optimization->solution[i]->constraints->other[k]->value != "")
00931 {
00932 outStr << " value=\"";\
00933 outStr << m_OSResult->optimization->solution[i]->constraints->other[k]->value;
00934 outStr << "\"" ;
00935 };
00936 if (m_OSResult->optimization->solution[i]->constraints->other[k]->description != "")
00937 {
00938 outStr << " description=\"";
00939 outStr << m_OSResult->optimization->solution[i]->constraints->other[k]->description;
00940 outStr << "\"" ;
00941 };
00942 outStr << ">" << endl;
00943 if(m_OSResult->optimization->solution[i]->constraints->other[k]->numberOfCon > 0){
00944 for(j = 0; j < m_OSResult->optimization->solution[i]->constraints->other[k]->numberOfCon; j++){
00945 outStr << "<con";
00946 outStr << " idx=\"";
00947 outStr << m_OSResult->optimization->solution[i]->constraints->other[k]->con[j]->idx;
00948 outStr << "\">";
00949 outStr << m_OSResult->optimization->solution[i]->constraints->other[k]->con[j]->value;
00950 outStr << "</con>" << endl;
00951 }
00952 }
00953 outStr << "</other>" << endl;
00954 }
00955 }
00956 }
00957 outStr << "</constraints>" << endl;
00958 }
00959
00960
00961 #ifdef DEBUG
00962 cout << "output <otherSolutionResults>" << endl;
00963 #endif
00964 if (m_OSResult->optimization->solution[i]->otherSolutionResults != NULL)
00965 if (m_OSResult->optimization->solution[i]->otherSolutionResults->numberOfOtherSolutionResults > 0){
00966 outStr << "<otherSolutionResults numberOfOtherSolutionResults=\"";
00967 outStr << m_OSResult->optimization->solution[i]->otherSolutionResults->numberOfOtherSolutionResults;
00968 outStr << "\">" << std::endl;
00969 for(int k = 0; k < m_OSResult->optimization->solution[i]->otherSolutionResults->numberOfOtherSolutionResults; k++){
00970 outStr << "<otherSolutionResult";
00971 outStr << " name=\"";
00972 outStr << m_OSResult->optimization->solution[i]->otherSolutionResults->otherSolutionResult[k]->name;
00973 outStr << "\"";
00974 outStr << " numberOfItems=\"";
00975 outStr << m_OSResult->optimization->solution[i]->otherSolutionResults->otherSolutionResult[k]->numberOfItems;
00976 outStr << "\"";
00977 if (m_OSResult->optimization->solution[i]->otherSolutionResults->otherSolutionResult[k]->category != "")
00978 outStr << " category=\"" << m_OSResult->optimization->solution[i]->otherSolutionResults->otherSolutionResult[k]->category << "\"";
00979 if (m_OSResult->optimization->solution[i]->otherSolutionResults->otherSolutionResult[k]->description != "")
00980 outStr << " description=\"" << m_OSResult->optimization->solution[i]->otherSolutionResults->otherSolutionResult[k]->description << "\"";
00981 outStr << ">" << std::endl;
00982 for(int j = 0; j < m_OSResult->optimization->solution[i]->otherSolutionResults->otherSolutionResult[k]->numberOfItems; j++){
00983 outStr << "<item>" << m_OSResult->optimization->solution[i]->otherSolutionResults->otherSolutionResult[k]->item[j] << "</item>" << std::endl;
00984 }
00985 outStr << "</otherSolutionResult>" << std::endl;
00986 }
00987 outStr << "</otherSolutionResults>" << std::endl;
00988 }
00989 outStr << "</solution>" << endl;
00990 }
00991 }
00992
00993
00994 #ifdef DEBUG
00995 cout << "output <otherSolverOutput>" << endl;
00996 #endif
00997 if (m_OSResult->optimization->otherSolverOutput != NULL)
00998 if (m_OSResult->optimization->otherSolverOutput->numberOfSolverOutputs > 0){
00999 outStr << "<otherSolverOutput numberOfSolverOutputs=\"";
01000 outStr << m_OSResult->optimization->otherSolverOutput->numberOfSolverOutputs;
01001 outStr << "\">" << std::endl;
01002 for(int k = 0; k < m_OSResult->optimization->otherSolverOutput->numberOfSolverOutputs; k++){
01003 outStr << "<solverOutput";
01004 outStr << " name=\"";
01005 outStr << m_OSResult->optimization->otherSolverOutput->solverOutput[k]->name;
01006 outStr << "\"";
01007 outStr << " numberOfItems=\"";
01008 outStr << m_OSResult->optimization->otherSolverOutput->solverOutput[k]->numberOfItems;
01009 outStr << "\"";
01010 if (m_OSResult->optimization->otherSolverOutput->solverOutput[k]->category != "")
01011 outStr << " category=\"" << m_OSResult->optimization->otherSolverOutput->solverOutput[k]->category << "\"";
01012 if (m_OSResult->optimization->otherSolverOutput->solverOutput[k]->description != "")
01013 outStr << " description=\"" << m_OSResult->optimization->otherSolverOutput->solverOutput[k]->description << "\"";
01014 outStr << ">" << std::endl;
01015 for(int j = 0; j < m_OSResult->optimization->otherSolverOutput->solverOutput[k]->numberOfItems; j++){
01016 outStr << "<item>" << m_OSResult->optimization->otherSolverOutput->solverOutput[k]->item[j] << "</item>" << std::endl;
01017 }
01018 outStr << "</solverOutput>" << std::endl;
01019 }
01020 outStr << "</otherSolverOutput>" << std::endl;
01021 }
01022
01023 outStr << "</optimization>" << endl;
01024 }
01025 outStr << "</osrl>" << endl ;
01026 #ifdef DEBUG
01027 cout << "done" << endl;
01028 #endif
01029 return outStr.str();
01030 }
01031
01032