00001
00018
00019
00020 #include "OSoLWriter.h"
00021 #include "OSOption.h"
00022 #include "OSParameters.h"
00023 #include "OSConfig.h"
00024 #include "OSBase64.h"
00025 #include "OSMathUtil.h"
00026 #include <sstream>
00027 #include <iostream>
00028 #include <stdio.h>
00029
00030 using std::cout;
00031 using std::endl;
00032 using std::ostringstream;
00033
00034 OSoLWriter::OSoLWriter( ) {
00035 }
00036
00037 OSoLWriter::~OSoLWriter(){
00038 }
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051 std::string OSoLWriter::writeOSoL( OSOption *theosoption)
00052 { m_OSOption = theosoption;
00053 std::ostringstream outStr;
00054 #ifdef WIN_
00055 const char dirsep='\\';
00056 #else
00057 const char dirsep='/';
00058 #endif
00059
00060 std::string xsltDir;
00061 xsltDir = dirsep == '/' ? "../stylesheets/" : "..\\stylesheets\\";
00062
00063 xsltDir = "../stylesheets/";
00064 if(m_OSOption == NULL) return outStr.str();
00065 outStr << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" ;
00066 outStr << "<?xml-stylesheet type=\"text/xsl\" href=\"";
00067 outStr << xsltDir;
00068 outStr << "OSoL.xslt\"?>";
00069 outStr << "<osol xmlns=\"os.optimizationservices.org\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" ";
00070 outStr << "xsi:schemaLocation=\"os.optimizationservices.org http://www.optimizationservices.org/schemas/";
00071 outStr << OS_SCHEMA_VERSION;
00072 outStr <<"/OSoL.xsd\" >" ;
00073 outStr << endl;
00074
00078 if(m_OSOption->general != NULL)
00079 { outStr << "<general>" << endl;
00080 if (m_OSOption->general->serviceURI != "")
00081 outStr << "<serviceURI>" << m_OSOption->general->serviceURI << "</serviceURI>" << endl;
00082 if (m_OSOption->general->serviceName != "")
00083 outStr << "<serviceName>" << m_OSOption->general->serviceName << "</serviceName>" << endl;
00084 if (m_OSOption->general->instanceName != "")
00085 outStr << "<instanceName>" << m_OSOption->general->instanceName << "</instanceName>" << endl;
00086 if (m_OSOption->general->instanceLocation != NULL)
00087 { if (m_OSOption->general->instanceLocation->locationType == "")
00088 { outStr << "<instanceLocation>";
00089 }
00090 else
00091 { outStr << "<instanceLocation locationType=\"" << m_OSOption->general->instanceLocation->locationType << "\">";
00092 };
00093 outStr << m_OSOption->general->instanceLocation->value << "</instanceLocation>" << endl;
00094 };
00095 if (m_OSOption->general->jobID != "")
00096 { outStr << "<jobID>" << m_OSOption->general->jobID << "</jobID>" << endl;
00097 };
00098 if (m_OSOption->general->solverToInvoke != "")
00099 { outStr << "<solverToInvoke>" << m_OSOption->general->solverToInvoke << "</solverToInvoke>" << endl;
00100 };
00101 if (m_OSOption->general->license != "")
00102 { outStr << "<license>" << m_OSOption->general->license << "</license>" << endl;
00103 };
00104 if (m_OSOption->general->userName != "")
00105 { outStr << "<userName>" << m_OSOption->general->userName << "</userName>" << endl;
00106 };
00107 if (m_OSOption->general->password != "")
00108 { outStr << "<password>" << m_OSOption->general->password << "</password>" << endl;
00109 };
00110 if (m_OSOption->general->contact != NULL)
00111 { if (m_OSOption->general->contact->transportType == "")
00112 { outStr << "<contact>";
00113 }
00114 else
00115 { outStr << "<contact transportType=\"" << m_OSOption->general->contact->transportType << "\">";
00116 };
00117 outStr << m_OSOption->general->contact->value << "</contact>" << endl;
00118 };
00119 if (m_OSOption->general->otherOptions != NULL)
00120 { if (m_OSOption->general->otherOptions->numberOfOtherOptions > 0)
00121 { outStr << "<otherOptions numberOfOtherOptions=\"";
00122 outStr << m_OSOption->general->otherOptions->numberOfOtherOptions << "\">" << endl;
00123 for (int i=0; i < m_OSOption->general->otherOptions->numberOfOtherOptions; i++)
00124 { outStr << "<other name=\"" << m_OSOption->general->otherOptions->other[i]->name << "\"";
00125 if (m_OSOption->general->otherOptions->other[i]->value != "")
00126 outStr << " value=\"" << m_OSOption->general->otherOptions->other[i]->value << "\"";
00127 if (m_OSOption->general->otherOptions->other[i]->description != "")
00128 outStr << " description=\"" << m_OSOption->general->otherOptions->other[i]->description << "\"";
00129 outStr << "/>" << endl;
00130 }
00131 outStr << "</otherOptions>" << endl;
00132 }
00133 }
00134 outStr << "</general>" << endl;
00135
00136 };
00137
00141 if(m_OSOption->system != NULL)
00142 { outStr << "<system>" << endl;
00143 if (m_OSOption->system->minDiskSpace != NULL)
00144 { if (m_OSOption->system->minDiskSpace->unit == "")
00145 m_OSOption->system->minDiskSpace->unit = "byte";
00146 outStr << "<minDiskSpace unit=\"" << m_OSOption->system->minDiskSpace->unit << "\">";
00147 outStr << os_dtoa_format(m_OSOption->system->minDiskSpace->value) << "</minDiskSpace>" << endl;
00148 }
00149 if (m_OSOption->system->minMemorySize != NULL)
00150 { if (m_OSOption->system->minMemorySize->unit == "")
00151 m_OSOption->system->minMemorySize->unit = "byte";
00152 outStr << "<minMemorySize unit=\"" << m_OSOption->system->minMemorySize->unit << "\">";
00153 outStr << os_dtoa_format(m_OSOption->system->minMemorySize->value) << "</minMemorySize>" << endl;
00154 }
00155 if (m_OSOption->system->minCPUSpeed != NULL)
00156 { if (m_OSOption->system->minCPUSpeed->unit == "")
00157 m_OSOption->system->minCPUSpeed->unit = "hertz";
00158 outStr << "<minCPUSpeed unit=\"" << m_OSOption->system->minCPUSpeed->unit << "\">";
00159 outStr << os_dtoa_format(m_OSOption->system->minCPUSpeed->value) << "</minCPUSpeed>" << endl;
00160 }
00161 if (m_OSOption->system->minCPUNumber != 1.0)
00162 { outStr << "<minCPUNumber>" << m_OSOption->system->minCPUNumber << "</minCPUNumber>";
00163 };
00164 if (m_OSOption->system->otherOptions != NULL)
00165 { if (m_OSOption->system->otherOptions->numberOfOtherOptions > 0)
00166 { outStr << "<otherOptions numberOfOtherOptions=\"";
00167 outStr << m_OSOption->system->otherOptions->numberOfOtherOptions << "\">" << endl;
00168 for (int i=0; i < m_OSOption->system->otherOptions->numberOfOtherOptions; i++)
00169 { outStr << "<other name=\"" << m_OSOption->system->otherOptions->other[i]->name << "\"";
00170 if (m_OSOption->system->otherOptions->other[i]->value != "")
00171 outStr << " value=\"" << m_OSOption->system->otherOptions->other[i]->value << "\"";
00172 if (m_OSOption->system->otherOptions->other[i]->description != "")
00173 outStr << " description=\"" << m_OSOption->system->otherOptions->other[i]->description << "\"";
00174 outStr << "/>" << endl;
00175 }
00176 outStr << "</otherOptions>" << endl;
00177 }
00178 }
00179 outStr << "</system>" << endl;
00180 cout << "Done with <system> element" << endl;
00181 };
00182
00186 if(m_OSOption->service != NULL)
00187 { outStr << "<service>" << endl;
00188 if (m_OSOption->service->type != "")
00189 { outStr << "<type>" << m_OSOption->service->type << "</type>" << endl;
00190 };
00191 if (m_OSOption->service->otherOptions != NULL)
00192 { if (m_OSOption->service->otherOptions->numberOfOtherOptions > 0)
00193 { outStr << "<otherOptions numberOfOtherOptions=\"";
00194 outStr << m_OSOption->service->otherOptions->numberOfOtherOptions << "\">" << endl;
00195 for (int i=0; i < m_OSOption->service->otherOptions->numberOfOtherOptions; i++)
00196 { outStr << "<other name=\"" << m_OSOption->service->otherOptions->other[i]->name << "\"";
00197 if (m_OSOption->service->otherOptions->other[i]->value != "")
00198 outStr << " value=\"" << m_OSOption->service->otherOptions->other[i]->value << "\"";
00199 if (m_OSOption->service->otherOptions->other[i]->description != "")
00200 outStr << " description=\"" << m_OSOption->service->otherOptions->other[i]->description << "\"";
00201 outStr << "/>" << endl;
00202 }
00203 outStr << "</otherOptions>" << endl;
00204 }
00205 }
00206 outStr << "</service>" << endl;
00207 cout << "Done with <service> element" << endl;
00208 };
00209
00213 if(m_OSOption->job != NULL)
00214 { outStr << "<job>" << endl;
00215 if (m_OSOption->job->maxTime != NULL)
00216 { if (m_OSOption->job->maxTime->unit == "")
00217 m_OSOption->job->maxTime->unit = "second";
00218 outStr << "<maxTime unit=\"" << m_OSOption->job->maxTime->unit << "\">";
00219 if (m_OSOption->job->maxTime->value == OSDBL_MAX)
00220 outStr << "INF" << "</maxTime>" << endl;
00221 else
00222 outStr << os_dtoa_format(m_OSOption->job->maxTime->value) << "</maxTime>" << endl;
00223 }
00224 if (m_OSOption->job->requestedStartTime != "")
00225 outStr << "<requestedStartTime>" << m_OSOption->job->requestedStartTime << "</requestedStartTime>" << endl;
00226 if (m_OSOption->job->dependencies != NULL)
00227 { if (m_OSOption->job->dependencies->numberOfJobIDs > 0)
00228 { outStr << "<dependencies numberOfJobIDs=\"";
00229 outStr << m_OSOption->job->dependencies->numberOfJobIDs << "\">" << endl;
00230 for (int i=0; i < m_OSOption->job->dependencies->numberOfJobIDs; i++)
00231 { outStr << "<jobID>" << m_OSOption->job->dependencies->jobID[i] << "</jobID>" << endl;
00232 }
00233 outStr << "</dependencies>" << endl;
00234 }
00235 }
00236 if (m_OSOption->job->requiredDirectories != NULL)
00237 { if (m_OSOption->job->requiredDirectories->numberOfPaths > 0)
00238 { outStr << "<requiredDirectories numberOfPaths=\"";
00239 outStr << m_OSOption->job->requiredDirectories->numberOfPaths << "\">" << endl;
00240 for (int i=0; i < m_OSOption->job->requiredDirectories->numberOfPaths; i++)
00241 outStr << "<path>" << m_OSOption->job->requiredDirectories->path[i] << "</path>" << endl;
00242 outStr << "</requiredDirectories>" << endl;
00243 }
00244 }
00245 if (m_OSOption->job->requiredFiles != NULL)
00246 { if (m_OSOption->job->requiredFiles->numberOfPaths > 0)
00247 { outStr << "<requiredFiles numberOfPaths=\"";
00248 outStr << m_OSOption->job->requiredFiles->numberOfPaths << "\">" << endl;
00249 for (int i=0; i < m_OSOption->job->requiredFiles->numberOfPaths; i++)
00250 outStr << "<path>" << m_OSOption->job->requiredFiles->path[i] << "</path>" << endl;
00251 outStr << "</requiredFiles>" << endl;
00252 }
00253 }
00254 if (m_OSOption->job->directoriesToMake != NULL)
00255 { if (m_OSOption->job->directoriesToMake->numberOfPaths > 0)
00256 { outStr << "<directoriesToMake numberOfPaths=\"";
00257 outStr << m_OSOption->job->directoriesToMake->numberOfPaths << "\">" << endl;
00258 for (int i=0; i < m_OSOption->job->directoriesToMake->numberOfPaths; i++)
00259 outStr << "<path>" << m_OSOption->job->directoriesToMake->path[i] << "</path>" << endl;
00260 outStr << "</directoriesToMake>" << endl;
00261 }
00262 }
00263 if (m_OSOption->job->filesToMake != NULL)
00264 { if (m_OSOption->job->filesToMake->numberOfPaths > 0)
00265 { outStr << "<filesToMake numberOfPaths=\"";
00266 outStr << m_OSOption->job->filesToMake->numberOfPaths << "\">" << endl;
00267 for (int i=0; i < m_OSOption->job->filesToMake->numberOfPaths; i++)
00268 outStr << "<path>" << m_OSOption->job->filesToMake->path[i] << "</path>" << endl;
00269 outStr << "</filesToMake>" << endl;
00270 }
00271 }
00272 if (m_OSOption->job->inputDirectoriesToMove != NULL)
00273 { if (m_OSOption->job->inputDirectoriesToMove->numberOfPathPairs > 0)
00274 { outStr << "<inputDirectoriesToMove numberOfPathPairs=\"";
00275 outStr << m_OSOption->job->inputDirectoriesToMove->numberOfPathPairs << "\">" << endl;
00276 for (int i=0; i < m_OSOption->job->inputDirectoriesToMove->numberOfPathPairs; i++)
00277 { outStr << "<pathPair";
00278 outStr << " from=\"" << m_OSOption->job->inputDirectoriesToMove->pathPair[i]->from << "\"";
00279 outStr << " to=\"" << m_OSOption->job->inputDirectoriesToMove->pathPair[i]->to << "\"";
00280 if (m_OSOption->job->inputDirectoriesToMove->pathPair[i]->makeCopy)
00281 outStr << " makeCopy=\"true\"";
00282 outStr << "/>" << endl;
00283 }
00284 outStr << "</inputDirectoriesToMove>" << endl;
00285 }
00286 }
00287 if (m_OSOption->job->inputFilesToMove != NULL)
00288 { if (m_OSOption->job->inputFilesToMove->numberOfPathPairs > 0)
00289 { outStr << "<inputFilesToMove numberOfPathPairs=\"";
00290 outStr << m_OSOption->job->inputFilesToMove->numberOfPathPairs << "\">" << endl;
00291 for (int i=0; i < m_OSOption->job->inputFilesToMove->numberOfPathPairs; i++)
00292 { outStr << "<pathPair";
00293 outStr << " from=\"" << m_OSOption->job->inputFilesToMove->pathPair[i]->from << "\"";
00294 outStr << " to=\"" << m_OSOption->job->inputFilesToMove->pathPair[i]->to << "\"";
00295 if (m_OSOption->job->inputFilesToMove->pathPair[i]->makeCopy)
00296 outStr << " makeCopy=\"true\"";
00297 outStr << "/>" << endl;
00298 }
00299 outStr << "</inputFilesToMove>" << endl;
00300 }
00301 }
00302 if (m_OSOption->job->outputFilesToMove != NULL)
00303 { if (m_OSOption->job->outputFilesToMove->numberOfPathPairs > 0)
00304 { outStr << "<outputFilesToMove numberOfPathPairs=\"";
00305 outStr << m_OSOption->job->outputFilesToMove->numberOfPathPairs << "\">" << endl;
00306 for (int i=0; i < m_OSOption->job->outputFilesToMove->numberOfPathPairs; i++)
00307 { outStr << "<pathPair";
00308 outStr << " from=\"" << m_OSOption->job->outputFilesToMove->pathPair[i]->from << "\"";
00309 outStr << " to=\"" << m_OSOption->job->outputFilesToMove->pathPair[i]->to << "\"";
00310 if (m_OSOption->job->outputFilesToMove->pathPair[i]->makeCopy)
00311 outStr << " makeCopy=\"true\"";
00312 outStr << "/>" << endl;
00313 }
00314 outStr << "</outputFilesToMove>" << endl;
00315 }
00316 }
00317 if (m_OSOption->job->outputDirectoriesToMove != NULL)
00318 { if (m_OSOption->job->outputDirectoriesToMove->numberOfPathPairs > 0)
00319 { outStr << "<outputDirectoriesToMove numberOfPathPairs=\"";
00320 outStr << m_OSOption->job->outputDirectoriesToMove->numberOfPathPairs << "\">" << endl;
00321 for (int i=0; i < m_OSOption->job->outputDirectoriesToMove->numberOfPathPairs; i++)
00322 { outStr << "<pathPair";
00323 outStr << " from=\"" << m_OSOption->job->outputDirectoriesToMove->pathPair[i]->from << "\"";
00324 outStr << " to=\"" << m_OSOption->job->outputDirectoriesToMove->pathPair[i]->to << "\"";
00325 if (m_OSOption->job->outputDirectoriesToMove->pathPair[i]->makeCopy)
00326 outStr << " makeCopy=\"true\"";
00327 outStr << "/>" << endl;
00328 }
00329 outStr << "</outputDirectoriesToMove>" << endl;
00330 }
00331 }
00332 if (m_OSOption->job->filesToDelete != NULL)
00333 { if (m_OSOption->job->filesToDelete->numberOfPaths > 0)
00334 { outStr << "<filesToDelete numberOfPaths=\"";
00335 outStr << m_OSOption->job->filesToDelete->numberOfPaths << "\">" << endl;
00336 for (int i=0; i < m_OSOption->job->filesToDelete->numberOfPaths; i++)
00337 outStr << "<path>" << m_OSOption->job->filesToDelete->path[i] << "</path>" << endl;
00338 outStr << "</filesToDelete>" << endl;
00339 }
00340 }
00341 if (m_OSOption->job->directoriesToDelete != NULL)
00342 { if (m_OSOption->job->directoriesToDelete->numberOfPaths > 0)
00343 { outStr << "<directoriesToDelete numberOfPaths=\"";
00344 outStr << m_OSOption->job->directoriesToDelete->numberOfPaths << "\">" << endl;
00345 for (int i=0; i < m_OSOption->job->directoriesToDelete->numberOfPaths; i++)
00346 outStr << "<path>" << m_OSOption->job->directoriesToDelete->path[i] << "</path>" << endl;
00347 outStr << "</directoriesToDelete>" << endl;
00348 }
00349 }
00350 if (m_OSOption->job->processesToKill != NULL)
00351 { if (m_OSOption->job->processesToKill->numberOfProcesses > 0)
00352 { outStr << "<processesToKill numberOfProcesses=\"";
00353 outStr << m_OSOption->job->processesToKill->numberOfProcesses << "\">" << endl;
00354 for (int i=0; i < m_OSOption->job->processesToKill->numberOfProcesses; i++)
00355 outStr << "<process>" << m_OSOption->job->processesToKill->process[i] << "</process>" << endl;
00356 outStr << "</processesToKill>" << endl;
00357 }
00358 }
00359 if (m_OSOption->job->otherOptions != NULL)
00360 { if (m_OSOption->job->otherOptions->numberOfOtherOptions > 0)
00361 { outStr << "<otherOptions numberOfOtherOptions=\"";
00362 outStr << m_OSOption->job->otherOptions->numberOfOtherOptions << "\">" << endl;
00363 for (int i=0; i < m_OSOption->job->otherOptions->numberOfOtherOptions; i++)
00364 { outStr << "<other name=\"" << m_OSOption->job->otherOptions->other[i]->name << "\"";
00365 if (m_OSOption->job->otherOptions->other[i]->value != "")
00366 outStr << " value=\"" << m_OSOption->job->otherOptions->other[i]->value << "\"";
00367 if (m_OSOption->job->otherOptions->other[i]->description != "")
00368 outStr << " description=\"" << m_OSOption->job->otherOptions->other[i]->description << "\"";
00369 outStr << "/>" << endl;
00370 }
00371 outStr << "</otherOptions>" << endl;
00372 }
00373 }
00374 outStr << "</job>" << endl;
00375 cout << "Done with <job> element" << endl;
00376 };
00377
00381 if (m_OSOption->optimization != NULL)
00382 { outStr << "<optimization";
00383 if (m_OSOption->optimization->numberOfVariables >= 0)
00384 outStr << " numberOfVariables=\"" << m_OSOption->optimization->numberOfVariables << "\" ";
00385 if (m_OSOption->optimization->numberOfObjectives >= 0)
00386 outStr << " numberOfObjectives=\"" << m_OSOption->optimization->numberOfObjectives << "\" ";
00387 if (m_OSOption->optimization->numberOfConstraints >= 0)
00388 outStr << " numberOfConstraints=\"" << m_OSOption->optimization->numberOfConstraints << "\" ";
00389 outStr << ">" << endl;
00390 if (m_OSOption->optimization->variables != NULL)
00391 { outStr << "<variables";
00392 if (m_OSOption->optimization->variables->numberOfOtherVariableOptions > 0)
00393 outStr << " numberOfOtherVariableOptions=\"" << m_OSOption->optimization->variables->numberOfOtherVariableOptions << "\"";
00394 outStr << ">" << endl;
00395 #ifdef DEBUG
00396 cout << "initialVariableValues: " << (m_OSOption->optimization->variables->initialVariableValues != NULL) << endl;
00397 #endif
00398 if (m_OSOption->optimization->variables->initialVariableValues != NULL)
00399 { outStr << "<initialVariableValues numberOfVar=\"";
00400 outStr << m_OSOption->optimization->variables->initialVariableValues->numberOfVar << "\">" << endl;
00401 for (int i=0; i < m_OSOption->optimization->variables->initialVariableValues->numberOfVar; i++)
00402 { outStr << "<var";
00403 outStr << " idx=\"" << m_OSOption->optimization->variables->initialVariableValues->var[i]->idx << "\"";
00404 if (m_OSOption->optimization->variables->initialVariableValues->var[i]->value != OSNAN)
00405 { outStr << " value=\"";
00406 if (m_OSOption->optimization->variables->initialVariableValues->var[i]->value == OSDBL_MAX)
00407 outStr << "INF";
00408 else if (m_OSOption->optimization->variables->initialVariableValues->var[i]->value == -OSDBL_MAX)
00409 outStr << "-INF";
00410 else
00411 outStr << os_dtoa_format(m_OSOption->optimization->variables->initialVariableValues->var[i]->value);
00412 }
00413 outStr << "\"/>" << endl;
00414 }
00415 outStr << "</initialVariableValues>" << endl;
00416 }
00417 #ifdef DEBUG
00418 cout << "initialVariableValuesString: " << (m_OSOption->optimization->variables->initialVariableValuesString != NULL) << endl;
00419 #endif
00420 if (m_OSOption->optimization->variables->initialVariableValuesString != NULL)
00421 { outStr << "<initialVariableValuesString numberOfVar=\"";
00422 outStr << m_OSOption->optimization->variables->initialVariableValuesString->numberOfVar << "\">" << endl;
00423 for (int i=0; i < m_OSOption->optimization->variables->initialVariableValuesString->numberOfVar; i++)
00424 { outStr << "<var";
00425 outStr << " idx=\"" << m_OSOption->optimization->variables->initialVariableValuesString->var[i]->idx << "\"";
00426 outStr << " value=\"" << m_OSOption->optimization->variables->initialVariableValuesString->var[i]->value << "\"";
00427 outStr << "/>" << endl;
00428 }
00429 outStr << "</initialVariableValuesString>" << endl;
00430 }
00431 #ifdef DEBUG
00432 cout << "initialBasisStatus: " << (m_OSOption->optimization->variables->initialBasisStatus != NULL) << endl;
00433 #endif
00434 if (m_OSOption->optimization->variables->initialBasisStatus != NULL)
00435 { outStr << "<initialBasisStatus numberOfVar=\"";
00436 outStr << m_OSOption->optimization->variables->initialBasisStatus->numberOfVar << "\">" << endl;
00437 for (int i=0; i < m_OSOption->optimization->variables->initialBasisStatus->numberOfVar; i++)
00438 { outStr << "<var";
00439 outStr << " idx=\"" << m_OSOption->optimization->variables->initialBasisStatus->var[i]->idx << "\"";
00440 outStr << " value=\"" << m_OSOption->optimization->variables->initialBasisStatus->var[i]->value << "\"";
00441 outStr << "/>" << endl;
00442 }
00443 outStr << "</initialBasisStatus>" << endl;
00444 }
00445 #ifdef DEBUG
00446 cout << "integerVariableBranchingWeights: " << (m_OSOption->optimization->variables->integerVariableBranchingWeights != NULL) << endl;
00447 #endif
00448 if (m_OSOption->optimization->variables->integerVariableBranchingWeights != NULL)
00449 { outStr << "<integerVariableBranchingWeights numberOfVar=\"";
00450 outStr << m_OSOption->optimization->variables->integerVariableBranchingWeights->numberOfVar << "\">" << endl;
00451 for (int i=0; i < m_OSOption->optimization->variables->integerVariableBranchingWeights->numberOfVar; i++)
00452 { outStr << "<var";
00453 outStr << " idx=\"" << m_OSOption->optimization->variables->integerVariableBranchingWeights->var[i]->idx << "\"";
00454 outStr << " value=\"" << os_dtoa_format(m_OSOption->optimization->variables->integerVariableBranchingWeights->var[i]->value) << "\"";
00455 outStr << "/>" << endl;
00456 }
00457 outStr << "</integerVariableBranchingWeights>" << endl;
00458 }
00459 #ifdef DEBUG
00460 cout << "sosVariableBranchingWeights: " << (m_OSOption->optimization->variables->sosVariableBranchingWeights != NULL) << endl;
00461 #endif
00462 if (m_OSOption->optimization->variables->sosVariableBranchingWeights != NULL)
00463 { outStr << "<sosVariableBranchingWeights numberOfSOS=\"";
00464 #ifdef DEBUG
00465 cout << "start: numberOfSOS" << endl;
00466 #endif
00467 outStr << m_OSOption->optimization->variables->sosVariableBranchingWeights->numberOfSOS << "\">" << endl;
00468 for (int i=0; i < m_OSOption->optimization->variables->sosVariableBranchingWeights->numberOfSOS; i++)
00469 { outStr << "<sos";
00470 #ifdef DEBUG
00471 cout << "sosIdx - nvar: " << m_OSOption->optimization->variables->sosVariableBranchingWeights->sos[i]->numberOfVar << endl;
00472 #endif
00473 outStr << " sosIdx=\"" << m_OSOption->optimization->variables->sosVariableBranchingWeights->sos[i]->sosIdx << "\"";
00474 outStr << " numberOfVar=\"" << m_OSOption->optimization->variables->sosVariableBranchingWeights->sos[i]->numberOfVar << "\"";
00475 outStr << " groupWeight=\"" << os_dtoa_format(m_OSOption->optimization->variables->sosVariableBranchingWeights->sos[i]->groupWeight) << "\">" << endl;
00476 for (int j=0; j < m_OSOption->optimization->variables->sosVariableBranchingWeights->sos[i]->numberOfVar; j++)
00477 { outStr << "<var";
00478 #ifdef DEBUG
00479 cout << "idx" << endl;
00480 #endif
00481 outStr << " idx=\"" << m_OSOption->optimization->variables->sosVariableBranchingWeights->sos[i]->var[j]->idx << "\"";
00482 outStr << " value=\"" << os_dtoa_format(m_OSOption->optimization->variables->sosVariableBranchingWeights->sos[i]->var[j]->value) << "\"";
00483 outStr << "/>" << endl;
00484 }
00485 outStr << "</sos>" << endl;
00486 }
00487 outStr << "</sosVariableBranchingWeights>" << endl;
00488 }
00489 #ifdef DEBUG
00490 printf("\n%s%d\n","Number of other variable options: ",m_OSOption->optimization->variables->numberOfOtherVariableOptions);
00491 #endif
00492 if (m_OSOption->optimization->variables->numberOfOtherVariableOptions > 0)
00493 for (int i=0; i < m_OSOption->optimization->variables->numberOfOtherVariableOptions; i++)
00494 { outStr << "<other name=\"" << m_OSOption->optimization->variables->other[i]->name << "\"";
00495 #ifdef DEBUG
00496 cout << "option " << i << ":" << endl;
00497 cout << " numberOfVar \'" << m_OSOption->optimization->variables->other[i]->numberOfVar << "\'" << endl;
00498 cout << " value \'" << m_OSOption->optimization->variables->other[i]->value << "\'" << endl;
00499 cout << " solver \'" << m_OSOption->optimization->variables->other[i]->solver << "\'" << endl;
00500 cout << " category \'" << m_OSOption->optimization->variables->other[i]->category << "\'" << endl;
00501 cout << " type \'" << m_OSOption->optimization->variables->other[i]->type << "\'" << endl;
00502 cout << " description \'" << m_OSOption->optimization->variables->other[i]->description << "\'" << endl;
00503 #endif
00504
00505 outStr << " numberOfVar=\"" << m_OSOption->optimization->variables->other[i]->numberOfVar << "\"";
00506 if (m_OSOption->optimization->variables->other[i]->value != "")
00507 outStr << " value=\"" << m_OSOption->optimization->variables->other[i]->value << "\"";
00508 if (m_OSOption->optimization->variables->other[i]->solver != "")
00509 outStr << " solver=\"" << m_OSOption->optimization->variables->other[i]->solver << "\"";
00510 if (m_OSOption->optimization->variables->other[i]->category != "")
00511 outStr << " category=\"" << m_OSOption->optimization->variables->other[i]->category << "\"";
00512 if (m_OSOption->optimization->variables->other[i]->type != "")
00513 outStr << " type=\"" << m_OSOption->optimization->variables->other[i]->type << "\"";
00514 if (m_OSOption->optimization->variables->other[i]->description != "")
00515 outStr << " description=\"" << m_OSOption->optimization->variables->other[i]->description << "\"";
00516 outStr << ">" << endl;
00517 if (m_OSOption->optimization->variables->other[i]->numberOfVar > 0)
00518 for (int j=0; j < m_OSOption->optimization->variables->other[i]->numberOfVar; j++)
00519 { outStr << "<var idx=\"" << m_OSOption->optimization->variables->other[i]->var[j]->idx << "\"";
00520 if (m_OSOption->optimization->variables->other[i]->var[j]->value != "")
00521 outStr << " value=\"" << m_OSOption->optimization->variables->other[i]->var[j]->value << "\"";
00522 if (m_OSOption->optimization->variables->other[i]->var[j]->lbValue != "")
00523 outStr << " lbValue=\"" << m_OSOption->optimization->variables->other[i]->var[j]->lbValue << "\"";
00524 if (m_OSOption->optimization->variables->other[i]->var[j]->ubValue != "")
00525 outStr << " ubValue=\"" << m_OSOption->optimization->variables->other[i]->var[j]->ubValue << "\"";
00526 outStr << "/>" << endl;
00527 }
00528 outStr << "</other>" << endl;
00529 }
00530 outStr << "</variables>" << endl;
00531 }
00532 if (m_OSOption->optimization->objectives != NULL)
00533 { outStr << "<objectives";
00534 if (m_OSOption->optimization->objectives->numberOfOtherObjectiveOptions > 0)
00535 outStr << " numberOfOtherObjectiveOptions=\"" << m_OSOption->optimization->objectives->numberOfOtherObjectiveOptions << "\"";
00536 outStr << ">" << endl;
00537 if (m_OSOption->optimization->objectives->initialObjectiveValues != NULL)
00538 { outStr << "<initialObjectiveValues numberOfObj=\"";
00539 outStr << m_OSOption->optimization->objectives->initialObjectiveValues->numberOfObj << "\">" << endl;
00540 for (int i=0; i < m_OSOption->optimization->objectives->initialObjectiveValues->numberOfObj; i++)
00541 { outStr << "<obj";
00542 outStr << " idx=\"" << m_OSOption->optimization->objectives->initialObjectiveValues->obj[i]->idx << "\"";
00543 if (m_OSOption->optimization->objectives->initialObjectiveValues->obj[i]->value != OSNAN)
00544 { outStr << " value=\"";
00545 if (m_OSOption->optimization->objectives->initialObjectiveValues->obj[i]->value == OSDBL_MAX)
00546 outStr << "INF";
00547 else if (m_OSOption->optimization->objectives->initialObjectiveValues->obj[i]->value == -OSDBL_MAX)
00548 outStr << "-INF";
00549 else
00550 outStr << os_dtoa_format(m_OSOption->optimization->objectives->initialObjectiveValues->obj[i]->value);
00551 }
00552 outStr << "\"/>" << endl;
00553 }
00554 outStr << "</initialObjectiveValues>" << endl;
00555 }
00556 if (m_OSOption->optimization->objectives->initialObjectiveBounds != NULL)
00557 { outStr << "<initialObjectiveBounds numberOfObj=\"";
00558 outStr << m_OSOption->optimization->objectives->initialObjectiveBounds->numberOfObj << "\">" << endl;
00559 for (int i=0; i < m_OSOption->optimization->objectives->initialObjectiveBounds->numberOfObj; i++)
00560 { outStr << "<obj";
00561 outStr << " idx=\"" << m_OSOption->optimization->objectives->initialObjectiveBounds->obj[i]->idx << "\"";
00562 outStr << " lbValue=\"";
00563 if (m_OSOption->optimization->objectives->initialObjectiveBounds->obj[i]->lbValue == OSDBL_MAX)
00564 outStr << "INF";
00565 else if (m_OSOption->optimization->objectives->initialObjectiveBounds->obj[i]->lbValue == -OSDBL_MAX)
00566 outStr << "-INF";
00567 else
00568 outStr << os_dtoa_format(m_OSOption->optimization->objectives->initialObjectiveBounds->obj[i]->lbValue);
00569 outStr << "\" ubValue=\"";
00570 if (m_OSOption->optimization->objectives->initialObjectiveBounds->obj[i]->ubValue == OSDBL_MAX)
00571 outStr << "INF";
00572 else if (m_OSOption->optimization->objectives->initialObjectiveBounds->obj[i]->ubValue == -OSDBL_MAX)
00573 outStr << "-INF";
00574 else
00575 outStr << os_dtoa_format(m_OSOption->optimization->objectives->initialObjectiveBounds->obj[i]->ubValue);
00576 outStr << "\"/>" << endl;
00577 }
00578 outStr << "</initialObjectiveBounds>" << endl;
00579 }
00580 #ifdef DEBUG
00581 printf("\n%s%d\n","Number of other objective options: ",m_OSOption->optimization->objectives->numberOfOtherObjectiveOptions);
00582 #endif
00583 if (m_OSOption->optimization->objectives->numberOfOtherObjectiveOptions > 0)
00584 for (int i=0; i < m_OSOption->optimization->objectives->numberOfOtherObjectiveOptions; i++)
00585 { outStr << "<other name=\"" << m_OSOption->optimization->objectives->other[i]->name << "\"";
00586 #ifdef DEBUG
00587 cout << "option " << i << ":" << endl;
00588 cout << " numberOfObj \'" << m_OSOption->optimization->objectives->other[i]->numberOfObj << "\'" << endl;
00589 cout << " value \'" << m_OSOption->optimization->objectives->other[i]->value << "\'" << endl;
00590 cout << " solver \'" << m_OSOption->optimization->objectives->other[i]->solver << "\'" << endl;
00591 cout << " category \'" << m_OSOption->optimization->objectives->other[i]->category << "\'" << endl;
00592 cout << " type \'" << m_OSOption->optimization->objectives->other[i]->type << "\'" << endl;
00593 cout << " description \'" << m_OSOption->optimization->objectives->other[i]->description << "\'" << endl;
00594 #endif
00595
00596
00597 outStr << " numberOfObj=\"" << m_OSOption->optimization->objectives->other[i]->numberOfObj << "\"";
00598 if (m_OSOption->optimization->objectives->other[i]->value != "")
00599 outStr << " value=\"" << m_OSOption->optimization->objectives->other[i]->value << "\"";
00600 if (m_OSOption->optimization->objectives->other[i]->solver != "")
00601 outStr << " solver=\"" << m_OSOption->optimization->objectives->other[i]->solver << "\"";
00602 if (m_OSOption->optimization->objectives->other[i]->category != "")
00603 outStr << " category=\"" << m_OSOption->optimization->objectives->other[i]->category << "\"";
00604 if (m_OSOption->optimization->objectives->other[i]->type != "")
00605 outStr << " type=\"" << m_OSOption->optimization->objectives->other[i]->type << "\"";
00606 if (m_OSOption->optimization->objectives->other[i]->description != "")
00607 outStr << " description=\"" << m_OSOption->optimization->objectives->other[i]->description << "\"";
00608 outStr << ">" << endl;
00609 if (m_OSOption->optimization->objectives->other[i]->numberOfObj > 0)
00610 for (int j=0; j < m_OSOption->optimization->objectives->other[i]->numberOfObj; j++)
00611 { outStr << "<var idx=\"" << m_OSOption->optimization->objectives->other[i]->obj[j]->idx << "\"";
00612 if (m_OSOption->optimization->objectives->other[i]->obj[j]->value != "")
00613 outStr << " value=\"" << m_OSOption->optimization->objectives->other[i]->obj[j]->value << "\"";
00614 outStr << "/>" << endl;
00615 }
00616 outStr << "</other>" << endl;
00617 }
00618 outStr << "</objectives>" << endl;
00619 }
00620 if (m_OSOption->optimization->constraints != NULL)
00621 { outStr << "<constraints";
00622 if (m_OSOption->optimization->constraints->numberOfOtherConstraintOptions > 0)
00623 outStr << " numberOfOtherConstraintOptions=\"" << m_OSOption->optimization->constraints->numberOfOtherConstraintOptions << "\"";
00624 outStr << ">" << endl;
00625 if (m_OSOption->optimization->constraints->initialConstraintValues != NULL)
00626 { outStr << "<initialConstraintValues numberOfCon=\"";
00627 outStr << m_OSOption->optimization->constraints->initialConstraintValues->numberOfCon << "\">" << endl;
00628 for (int i=0; i < m_OSOption->optimization->constraints->initialConstraintValues->numberOfCon; i++)
00629 { outStr << "<con";
00630 outStr << " idx=\"" << m_OSOption->optimization->constraints->initialConstraintValues->con[i]->idx << "\"";
00631 if (m_OSOption->optimization->constraints->initialConstraintValues->con[i]->value != OSNAN)
00632 { outStr << " value=\"";
00633 if (m_OSOption->optimization->constraints->initialConstraintValues->con[i]->value == OSDBL_MAX)
00634 outStr << "INF";
00635 else if (m_OSOption->optimization->constraints->initialConstraintValues->con[i]->value == -OSDBL_MAX)
00636 outStr << "-INF";
00637 else
00638 outStr << os_dtoa_format(m_OSOption->optimization->constraints->initialConstraintValues->con[i]->value);
00639 }
00640 outStr << "\"/>" << endl;
00641 }
00642 outStr << "</initialConstraintValues>" << endl;
00643 }
00644 if (m_OSOption->optimization->constraints->initialDualValues != NULL)
00645 { outStr << "<initialDualValues numberOfCon=\"";
00646 outStr << m_OSOption->optimization->constraints->initialDualValues->numberOfCon << "\">" << endl;
00647 for (int i=0; i < m_OSOption->optimization->constraints->initialDualValues->numberOfCon; i++)
00648 { outStr << "<con";
00649 outStr << " idx=\"" << m_OSOption->optimization->constraints->initialDualValues->con[i]->idx << "\"";
00650 outStr << " lbDualValue=\"";
00651 if (m_OSOption->optimization->constraints->initialDualValues->con[i]->lbDualValue == OSDBL_MAX)
00652 outStr << "INF";
00653 else if (m_OSOption->optimization->constraints->initialDualValues->con[i]->lbDualValue == -OSDBL_MAX)
00654 outStr << "-INF";
00655 else
00656 outStr << os_dtoa_format(m_OSOption->optimization->constraints->initialDualValues->con[i]->lbDualValue);
00657 outStr << "\" ubDualValue=\"";
00658 if (m_OSOption->optimization->constraints->initialDualValues->con[i]->ubDualValue == OSDBL_MAX)
00659 outStr << "INF";
00660 else if (m_OSOption->optimization->constraints->initialDualValues->con[i]->ubDualValue == -OSDBL_MAX)
00661 outStr << "-INF";
00662 else
00663 outStr << os_dtoa_format(m_OSOption->optimization->constraints->initialDualValues->con[i]->ubDualValue);
00664 outStr << "\"/>" << endl;
00665 }
00666 outStr << "</initialDualValues>" << endl;
00667 }
00668 #ifdef DEBUG
00669 printf("\n%s%d\n","Number of other constraint options: ",m_OSOption->optimization->constraints->numberOfOtherConstraintOptions);
00670 #endif
00671 if (m_OSOption->optimization->constraints->numberOfOtherConstraintOptions > 0)
00672 for (int i=0; i < m_OSOption->optimization->constraints->numberOfOtherConstraintOptions; i++)
00673 { outStr << "<other name=\"" << m_OSOption->optimization->constraints->other[i]->name << "\"";
00674 #ifdef DEBUG
00675 cout << "option " << i << ":" << endl;
00676 cout << " numberOfCon \'" << m_OSOption->optimization->constraints->other[i]->numberOfCon << "\'" << endl;
00677 cout << " value \'" << m_OSOption->optimization->constraints->other[i]->value << "\'" << endl;
00678 cout << " solver \'" << m_OSOption->optimization->constraints->other[i]->solver << "\'" << endl;
00679 cout << " category \'" << m_OSOption->optimization->constraints->other[i]->category << "\'" << endl;
00680 cout << " type \'" << m_OSOption->optimization->constraints->other[i]->type << "\'" << endl;
00681 cout << " description \'" << m_OSOption->optimization->constraints->other[i]->description << "\'" << endl;
00682 #endif
00683
00684
00685 outStr << " numberOfCon=\"" << m_OSOption->optimization->constraints->other[i]->numberOfCon << "\"";
00686 if (m_OSOption->optimization->constraints->other[i]->value != "")
00687 outStr << " value=\"" << m_OSOption->optimization->constraints->other[i]->value << "\"";
00688 if (m_OSOption->optimization->constraints->other[i]->solver != "")
00689 outStr << " solver=\"" << m_OSOption->optimization->constraints->other[i]->solver << "\"";
00690 if (m_OSOption->optimization->constraints->other[i]->category != "")
00691 outStr << " category=\"" << m_OSOption->optimization->constraints->other[i]->category << "\"";
00692 if (m_OSOption->optimization->constraints->other[i]->type != "")
00693 outStr << " type=\"" << m_OSOption->optimization->constraints->other[i]->type << "\"";
00694 if (m_OSOption->optimization->constraints->other[i]->description != "")
00695 outStr << " description=\"" << m_OSOption->optimization->constraints->other[i]->description << "\"";
00696 outStr << ">" << endl;
00697 if (m_OSOption->optimization->constraints->other[i]->numberOfCon > 0)
00698 for (int j=0; j < m_OSOption->optimization->constraints->other[i]->numberOfCon; j++)
00699 { outStr << "<con idx=\"" << m_OSOption->optimization->constraints->other[i]->con[j]->idx << "\"";
00700 if (m_OSOption->optimization->constraints->other[i]->con[j]->value != "")
00701 outStr << " value=\"" << m_OSOption->optimization->constraints->other[i]->con[j]->value << "\"";
00702 if (m_OSOption->optimization->constraints->other[i]->con[j]->lbValue != "")
00703 outStr << " lbValue=\"" << m_OSOption->optimization->constraints->other[i]->con[j]->lbValue << "\"";
00704 if (m_OSOption->optimization->constraints->other[i]->con[j]->ubValue != "")
00705 outStr << " ubValue=\"" << m_OSOption->optimization->constraints->other[i]->con[j]->ubValue << "\"";
00706 outStr << "/>" << endl;
00707 }
00708 outStr << "</other>" << endl;
00709 }
00710 outStr << "</constraints>" << endl;
00711 }
00712 if (m_OSOption->optimization->solverOptions != NULL)
00713 { if (m_OSOption->optimization->solverOptions->numberOfSolverOptions > 0)
00714 { outStr << "<solverOptions numberOfSolverOptions=\"";
00715 outStr << m_OSOption->optimization->solverOptions->numberOfSolverOptions << "\">" << endl;
00716 for (int i=0; i < m_OSOption->optimization->solverOptions->numberOfSolverOptions; i++)
00717 { outStr << "<solverOption name=\"" << m_OSOption->optimization->solverOptions->solverOption[i]->name << "\"";
00718 if (m_OSOption->optimization->solverOptions->solverOption[i]->value != "")
00719 outStr << " value=\"" << m_OSOption->optimization->solverOptions->solverOption[i]->value << "\"";
00720 if (m_OSOption->optimization->solverOptions->solverOption[i]->solver != "")
00721 outStr << " solver=\"" << m_OSOption->optimization->solverOptions->solverOption[i]->solver << "\"";
00722 if (m_OSOption->optimization->solverOptions->solverOption[i]->category != "")
00723 outStr << " category=\"" << m_OSOption->optimization->solverOptions->solverOption[i]->category << "\"";
00724 if (m_OSOption->optimization->solverOptions->solverOption[i]->type != "")
00725 outStr << " type=\"" << m_OSOption->optimization->solverOptions->solverOption[i]->type << "\"";
00726 if (m_OSOption->optimization->solverOptions->solverOption[i]->description != "")
00727 outStr << " description=\"" << m_OSOption->optimization->solverOptions->solverOption[i]->description << "\"";
00728 outStr << "/>" << endl;
00729 }
00730 outStr << "</solverOptions>" << endl;
00731 }
00732 }
00733 outStr << "</optimization>" << endl;
00734 };
00735 outStr << "</osol>" << endl;
00736 return outStr.str();
00737 }
00738
00739
00740