OSoLWriter.cpp
Go to the documentation of this file.
1 
17 #define DEBUG
18 
19 #include "OSoLWriter.h"
20 #include "OSOption.h"
21 #include "OSParameters.h"
22 #include "OSCommonUtil.h"
23 #include "OSConfig.h"
24 #include "OSBase64.h"
25 #include "OSMathUtil.h"
26 #include <sstream>
27 #include <iostream>
28 #include <stdio.h>
29 
30 using std::cout;
31 using std::endl;
32 using std::ostringstream;
33 
35 }
36 
38 }
39 
40 
41 /*char* OSoLWriter::writeOSoLWrap( OSOption *theosoption){
42  std::string sTmp = writeOSoL( theosoption);
43  char *ch;
44  ch = new char[sTmp.size() + 1];
45  strcpy(ch, sTmp.c_str());
46  return ch;
47 }
48 */
49 
50 
51 std::string OSoLWriter::writeOSoL( OSOption *theosoption)
52 { m_OSOption = theosoption;
53  std::ostringstream outStr;
54  #ifdef WIN_
55  const char dirsep='\\';
56  #else
57  const char dirsep='/';
58  #endif
59  // Set directory containing stylesheet files.
60  std::string xsltDir;
61  xsltDir = dirsep == '/' ? "../stylesheets/" : "..\\stylesheets\\";
62  // always go with '/' -- it is a hypertext reference
63  xsltDir = "../stylesheets/";
64  if(m_OSOption == NULL) return outStr.str();
65  outStr << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" ;
66  outStr << "<?xml-stylesheet type=\"text/xsl\" href=\"";
67  outStr << xsltDir;
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/";
71  outStr << OS_SCHEMA_VERSION;
72  outStr <<"/OSoL.xsd\" >" ;
73  outStr << endl;
74 
78  if(m_OSOption->general != NULL)
79  { outStr << "<general>" << endl;
80  if (m_OSOption->general->serviceURI != "")
81  outStr << "<serviceURI>" << m_OSOption->general->serviceURI << "</serviceURI>" << endl;
82  if (m_OSOption->general->serviceName != "")
83  outStr << "<serviceName>" << m_OSOption->general->serviceName << "</serviceName>" << endl;
84  if (m_OSOption->general->instanceName != "")
85  outStr << "<instanceName>" << m_OSOption->general->instanceName << "</instanceName>" << endl;
86  if (m_OSOption->general->instanceLocation != NULL)
88  { outStr << "<instanceLocation>";
89  }
90  else
91  { outStr << "<instanceLocation locationType=\"" << m_OSOption->general->instanceLocation->locationType << "\">";
92  };
93  outStr << m_OSOption->general->instanceLocation->value << "</instanceLocation>" << endl;
94  };
95  if (m_OSOption->general->jobID != "")
96  { outStr << "<jobID>" << m_OSOption->general->jobID << "</jobID>" << endl;
97  };
98  if (m_OSOption->general->solverToInvoke != "")
99  { outStr << "<solverToInvoke>" << m_OSOption->general->solverToInvoke << "</solverToInvoke>" << endl;
100  };
101  if (m_OSOption->general->license != "")
102  { outStr << "<license>" << m_OSOption->general->license << "</license>" << endl;
103  };
104  if (m_OSOption->general->userName != "")
105  { outStr << "<userName>" << m_OSOption->general->userName << "</userName>" << endl;
106  };
107  if (m_OSOption->general->password != "")
108  { outStr << "<password>" << m_OSOption->general->password << "</password>" << endl;
109  };
110  if (m_OSOption->general->contact != NULL)
111  { if (m_OSOption->general->contact->transportType == "")
112  { outStr << "<contact>";
113  }
114  else
115  { outStr << "<contact transportType=\"" << m_OSOption->general->contact->transportType << "\">";
116  };
117  outStr << m_OSOption->general->contact->value << "</contact>" << endl;
118  };
119  if (m_OSOption->general->otherOptions != NULL)
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 << "\"";
128  outStr << " description=\"" << m_OSOption->general->otherOptions->other[i]->description << "\"";
129  outStr << "/>" << endl;
130  }
131  outStr << "</otherOptions>" << endl;
132  }
133  }
134  outStr << "</general>" << endl;
135 // cout << "Done with <general> element" << endl;
136  };
137 
141  if(m_OSOption->system != NULL)
142  { outStr << "<system>" << endl;
143  if (m_OSOption->system->minDiskSpace != NULL)
144  { if (m_OSOption->system->minDiskSpace->unit == "")
145  m_OSOption->system->minDiskSpace->unit = "byte";
146  outStr << "<minDiskSpace unit=\"" << m_OSOption->system->minDiskSpace->unit << "\">";
147  outStr << os_dtoa_format(m_OSOption->system->minDiskSpace->value) << "</minDiskSpace>" << endl;
148  }
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 << "\">";
153  outStr << os_dtoa_format(m_OSOption->system->minMemorySize->value) << "</minMemorySize>" << endl;
154  }
155  if (m_OSOption->system->minCPUSpeed != NULL)
156  { if (m_OSOption->system->minCPUSpeed->unit == "")
157  m_OSOption->system->minCPUSpeed->unit = "hertz";
158  outStr << "<minCPUSpeed unit=\"" << m_OSOption->system->minCPUSpeed->unit << "\">";
159  outStr << os_dtoa_format(m_OSOption->system->minCPUSpeed->value) << "</minCPUSpeed>" << endl;
160  }
161  if (m_OSOption->system->minCPUNumber != 1.0)
162  { outStr << "<minCPUNumber>" << m_OSOption->system->minCPUNumber << "</minCPUNumber>";
163  };
164  if (m_OSOption->system->otherOptions != NULL)
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 << "\"";
173  outStr << " description=\"" << m_OSOption->system->otherOptions->other[i]->description << "\"";
174  outStr << "/>" << endl;
175  }
176  outStr << "</otherOptions>" << endl;
177  }
178  }
179  outStr << "</system>" << endl;
180  cout << "Done with <system> element" << endl;
181  };
182 
186  if(m_OSOption->service != NULL)
187  { outStr << "<service>" << endl;
188  if (m_OSOption->service->type != "")
189  { outStr << "<type>" << m_OSOption->service->type << "</type>" << endl;
190  };
191  if (m_OSOption->service->otherOptions != NULL)
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 << "\"";
200  outStr << " description=\"" << m_OSOption->service->otherOptions->other[i]->description << "\"";
201  outStr << "/>" << endl;
202  }
203  outStr << "</otherOptions>" << endl;
204  }
205  }
206  outStr << "</service>" << endl;
207  cout << "Done with <service> element" << endl;
208  };
209 
213  if(m_OSOption->job != NULL)
214  { outStr << "<job>" << endl;
215  if (m_OSOption->job->maxTime != NULL)
216  { if (m_OSOption->job->maxTime->unit == "")
217  m_OSOption->job->maxTime->unit = "second";
218  outStr << "<maxTime unit=\"" << m_OSOption->job->maxTime->unit << "\">";
220  outStr << "INF" << "</maxTime>" << endl;
221  else
222  outStr << os_dtoa_format(m_OSOption->job->maxTime->value) << "</maxTime>" << endl;
223  }
224  if (m_OSOption->job->requestedStartTime != "")
225  outStr << "<requestedStartTime>" << m_OSOption->job->requestedStartTime << "</requestedStartTime>" << endl;
226  if (m_OSOption->job->dependencies != NULL)
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;
232  }
233  outStr << "</dependencies>" << endl;
234  }
235  }
236  if (m_OSOption->job->requiredDirectories != NULL)
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;
243  }
244  }
245  if (m_OSOption->job->requiredFiles != NULL)
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;
252  }
253  }
254  if (m_OSOption->job->directoriesToMake != NULL)
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;
261  }
262  }
263  if (m_OSOption->job->filesToMake != NULL)
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;
270  }
271  }
272  if (m_OSOption->job->inputDirectoriesToMove != NULL)
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 << "\"";
281  outStr << " makeCopy=\"true\"";
282  outStr << "/>" << endl;
283  }
284  outStr << "</inputDirectoriesToMove>" << endl;
285  }
286  }
287  if (m_OSOption->job->inputFilesToMove != NULL)
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 << "\"";
296  outStr << " makeCopy=\"true\"";
297  outStr << "/>" << endl;
298  }
299  outStr << "</inputFilesToMove>" << endl;
300  }
301  }
302  if (m_OSOption->job->outputFilesToMove != NULL)
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 << "\"";
311  outStr << " makeCopy=\"true\"";
312  outStr << "/>" << endl;
313  }
314  outStr << "</outputFilesToMove>" << endl;
315  }
316  }
317  if (m_OSOption->job->outputDirectoriesToMove != NULL)
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 << "\"";
326  outStr << " makeCopy=\"true\"";
327  outStr << "/>" << endl;
328  }
329  outStr << "</outputDirectoriesToMove>" << endl;
330  }
331  }
332  if (m_OSOption->job->filesToDelete != NULL)
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;
339  }
340  }
341  if (m_OSOption->job->directoriesToDelete != NULL)
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;
348  }
349  }
350  if (m_OSOption->job->processesToKill != NULL)
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;
357  }
358  }
359  if (m_OSOption->job->otherOptions != NULL)
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;
370  }
371  outStr << "</otherOptions>" << endl;
372  }
373  }
374  outStr << "</job>" << endl;
375  cout << "Done with <job> element" << endl;
376  };
377 
381  if (m_OSOption->optimization != NULL)
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";
390  outStr << " numberOfOtherVariableOptions=\"" << m_OSOption->optimization->variables->numberOfOtherVariableOptions << "\"";
391  outStr << ">" << endl;
392 #ifdef DEBUG
393  cout << "initialVariableValues: " << (m_OSOption->optimization->variables->initialVariableValues != NULL) << endl;
394 #endif
396  { outStr << "<initialVariableValues numberOfVar=\"";
397  outStr << m_OSOption->optimization->variables->initialVariableValues->numberOfVar << "\">" << endl;
399  { outStr << "<var";
400  outStr << " idx=\"" << m_OSOption->optimization->variables->initialVariableValues->var[i]->idx << "\"";
402  { outStr << " value=\"";
404  outStr << "INF";
406  outStr << "-INF";
407  else
409  }
410  outStr << "\"/>" << endl;
411  }
412  outStr << "</initialVariableValues>" << endl;
413  }
414 #ifdef DEBUG
415  cout << "initialVariableValuesString: " << (m_OSOption->optimization->variables->initialVariableValuesString != NULL) << endl;
416 #endif
418  { outStr << "<initialVariableValuesString numberOfVar=\"";
421  { outStr << "<var";
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;
425  }
426  outStr << "</initialVariableValuesString>" << endl;
427  }
428 #ifdef DEBUG
429  cout << "initialBasisStatus: " << (m_OSOption->optimization->variables->initialBasisStatus != NULL) << endl;
430 #endif
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++)
435  { outStr << "<var";
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;
439  }
440  outStr << "</initialBasisStatus>" << endl;
441  }
442 #ifdef DEBUG
443  cout << "integerVariableBranchingWeights: " << (m_OSOption->optimization->variables->integerVariableBranchingWeights != NULL) << endl;
444 #endif
446  { outStr << "<integerVariableBranchingWeights numberOfVar=\"";
449  { outStr << "<var";
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;
453  }
454  outStr << "</integerVariableBranchingWeights>" << endl;
455  }
456 #ifdef DEBUG
457  cout << "sosVariableBranchingWeights: " << (m_OSOption->optimization->variables->sosVariableBranchingWeights != NULL) << endl;
458 #endif
460  { outStr << "<sosVariableBranchingWeights numberOfSOS=\"";
461 #ifdef DEBUG
462  cout << "start: numberOfSOS" << endl;
463 #endif
466  { outStr << "<sos";
467 #ifdef DEBUG
468  cout << "sosIdx - nvar: " << m_OSOption->optimization->variables->sosVariableBranchingWeights->sos[i]->numberOfVar << endl;
469 #endif
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;
474  { outStr << "<var";
475 #ifdef DEBUG
476  cout << "idx" << endl;
477 #endif
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;
481  }
482  outStr << "</sos>" << endl;
483  }
484  outStr << "</sosVariableBranchingWeights>" << endl;
485  }
486 #ifdef DEBUG
487  printf("\n%s%d\n","Number of other variable options: ",m_OSOption->optimization->variables->numberOfOtherVariableOptions);
488 #endif
491  { outStr << "<other name=\"" << m_OSOption->optimization->variables->other[i]->name << "\"";
492 #ifdef DEBUG
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;
500 #endif
501 // if (m_OSOption->optimization->variables->other[i]->numberOfVar > 0)
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 << "\"";
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 << "\"";
512  outStr << " description=\"" << m_OSOption->optimization->variables->other[i]->description << "\"";
513  outStr << ">" << endl;
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;
524  }
525  outStr << "</other>" << endl;
526  }
527  outStr << "</variables>" << endl;
528  }
529  if (m_OSOption->optimization->objectives != NULL)
530  { outStr << "<objectives";
532  outStr << " numberOfOtherObjectiveOptions=\"" << m_OSOption->optimization->objectives->numberOfOtherObjectiveOptions << "\"";
533  outStr << ">" << endl;
535  { outStr << "<initialObjectiveValues numberOfObj=\"";
538  { outStr << "<obj";
539  outStr << " idx=\"" << m_OSOption->optimization->objectives->initialObjectiveValues->obj[i]->idx << "\"";
541  { outStr << " value=\"";
543  outStr << "INF";
545  outStr << "-INF";
546  else
548  }
549  outStr << "\"/>" << endl;
550  }
551  outStr << "</initialObjectiveValues>" << endl;
552  }
554  { outStr << "<initialObjectiveBounds numberOfObj=\"";
557  { outStr << "<obj";
558  outStr << " idx=\"" << m_OSOption->optimization->objectives->initialObjectiveBounds->obj[i]->idx << "\"";
559  outStr << " lbValue=\"";
561  outStr << "INF";
563  outStr << "-INF";
564  else
566  outStr << "\" ubValue=\"";
568  outStr << "INF";
570  outStr << "-INF";
571  else
573  outStr << "\"/>" << endl;
574  }
575  outStr << "</initialObjectiveBounds>" << endl;
576  }
577 #ifdef DEBUG
578  printf("\n%s%d\n","Number of other objective options: ",m_OSOption->optimization->objectives->numberOfOtherObjectiveOptions);
579 #endif
582  { outStr << "<other name=\"" << m_OSOption->optimization->objectives->other[i]->name << "\"";
583 #ifdef DEBUG
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;
591 #endif
592 
593 // if (m_OSOption->optimization->objectives->other[i]->numberOfObj > 0)
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 << "\"";
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 << "\"";
604  outStr << " description=\"" << m_OSOption->optimization->objectives->other[i]->description << "\"";
605  outStr << ">" << endl;
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;
612  }
613  outStr << "</other>" << endl;
614  }
615  outStr << "</objectives>" << endl;
616  }
617  if (m_OSOption->optimization->constraints != NULL)
618  { outStr << "<constraints";
620  outStr << " numberOfOtherConstraintOptions=\"" << m_OSOption->optimization->constraints->numberOfOtherConstraintOptions << "\"";
621  outStr << ">" << endl;
623  { outStr << "<initialConstraintValues numberOfCon=\"";
626  { outStr << "<con";
627  outStr << " idx=\"" << m_OSOption->optimization->constraints->initialConstraintValues->con[i]->idx << "\"";
629  { outStr << " value=\"";
631  outStr << "INF";
633  outStr << "-INF";
634  else
636  }
637  outStr << "\"/>" << endl;
638  }
639  outStr << "</initialConstraintValues>" << endl;
640  }
642  { outStr << "<initialDualValues numberOfCon=\"";
643  outStr << m_OSOption->optimization->constraints->initialDualValues->numberOfCon << "\">" << endl;
645  { outStr << "<con";
646  outStr << " idx=\"" << m_OSOption->optimization->constraints->initialDualValues->con[i]->idx << "\"";
647  outStr << " lbDualValue=\"";
649  outStr << "INF";
651  outStr << "-INF";
652  else
654  outStr << "\" ubDualValue=\"";
656  outStr << "INF";
658  outStr << "-INF";
659  else
661  outStr << "\"/>" << endl;
662  }
663  outStr << "</initialDualValues>" << endl;
664  }
665 #ifdef DEBUG
666  printf("\n%s%d\n","Number of other constraint options: ",m_OSOption->optimization->constraints->numberOfOtherConstraintOptions);
667 #endif
670  { outStr << "<other name=\"" << m_OSOption->optimization->constraints->other[i]->name << "\"";
671 #ifdef DEBUG
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;
679 #endif
680 
681 // if (m_OSOption->optimization->constraints->other[i]->numberOfCon > 0)
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 << "\"";
686  outStr << " solver=\"" << m_OSOption->optimization->constraints->other[i]->solver << "\"";
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 << "\"";
692  outStr << " description=\"" << m_OSOption->optimization->constraints->other[i]->description << "\"";
693  outStr << ">" << endl;
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;
704  }
705  outStr << "</other>" << endl;
706  }
707  outStr << "</constraints>" << endl;
708  }
709  if (m_OSOption->optimization->solverOptions != NULL)
711  { outStr << "<solverOptions numberOfSolverOptions=\"";
712  outStr << m_OSOption->optimization->solverOptions->numberOfSolverOptions << "\">" << endl;
714  { outStr << "<solverOption name=\"" << m_OSOption->optimization->solverOptions->solverOption[i]->name << "\"";
716  outStr << " value=\"" << m_OSOption->optimization->solverOptions->solverOption[i]->value << "\"";
718  outStr << " solver=\"" << m_OSOption->optimization->solverOptions->solverOption[i]->solver << "\"";
720  outStr << " category=\"" << m_OSOption->optimization->solverOptions->solverOption[i]->category << "\"";
722  outStr << " type=\"" << m_OSOption->optimization->solverOptions->solverOption[i]->type << "\"";
724  outStr << " description=\"" << m_OSOption->optimization->solverOptions->solverOption[i]->description << "\"";
725  outStr << "/>" << endl;
726  }
727  outStr << "</solverOptions>" << endl;
728  }
729  }
730  outStr << "</optimization>" << endl;
731  };
732  outStr << "</osol>" << endl;
733  return outStr.str();
734 }// end writeOSoL
735 
736 
737 
std::string unit
the unit in which CPU speed is measured
Definition: OSGeneral.h:817
std::string value
value of the option
Definition: OSOption.h:2003
InitConstraintValues * initialConstraintValues
initial values for the constraints
Definition: OSOption.h:3271
int idx
variable index
Definition: OSOption.h:3096
InitObjectiveValues * initialObjectiveValues
initial values for the objectives
Definition: OSOption.h:2689
std::string * jobID
the list of job IDs
Definition: OSOption.h:717
double ubDualValue
initial upper bound
Definition: OSOption.h:2938
std::string solver
name of the solver to which this option applies
Definition: OSOption.h:3173
InitVarValue ** var
initial value for each variable
Definition: OSOption.h:1226
std::string value
value of the option
Definition: OSOption.h:2520
DirectoriesAndFiles * requiredDirectories
directories required to run the job
Definition: OSOption.h:1078
int numberOfCon
number of &lt;con&gt; children
Definition: OSOption.h:3161
std::string category
name of the category into which this option falls
Definition: OSOption.h:2009
std::string value
the value of the &lt;contact&gt; element
Definition: OSOption.h:104
std::string solver
name of the solver to which this option applies
Definition: OSOption.h:2591
std::string solver
the solver to which the option applies
Definition: OSOption.h:3355
ServiceOption * service
serviceOption holds the third child of the OSOption specified by the OSoL Schema. ...
Definition: OSOption.h:3588
std::string serviceName
the name of the service
Definition: OSOption.h:293
std::string value
value of the option
Definition: OSOption.h:3102
std::string requestedStartTime
the requested time to start the job
Definition: OSOption.h:1072
int numberOfCon
number of &lt;con&gt; children
Definition: OSOption.h:2827
std::string type
the service type
Definition: OSOption.h:615
SOSVariableBranchingWeights * sosVariableBranchingWeights
branching weights for SOS variables and groups
Definition: OSOption.h:2116
JobOption * job
jobOption holds the fourth child of the OSOption specified by the OSoL Schema.
Definition: OSOption.h:3592
OtherOption ** other
the list of other options
Definition: OSOption.h:219
StorageCapacity * minDiskSpace
the minimum disk space required
Definition: OSOption.h:550
int sosIdx
index of the SOS (to match the OSiL file)
Definition: OSOption.h:1780
int numberOfOtherObjectiveOptions
number of &lt;other&gt; child elements
Definition: OSOption.h:2686
std::string * path
the list of directory and file paths
Definition: OSOption.h:788
double value
the number of units
Definition: OSGeneral.h:932
SystemOption * system
systemOption holds the second child of the OSOption specified by the OSoL Schema. ...
Definition: OSOption.h:3584
std::string userName
the username
Definition: OSOption.h:311
int numberOfVariables
the number of variables
Definition: OSOption.h:3500
std::string category
the category to which the option belongs
Definition: OSOption.h:3358
OtherVariableOption ** other
other variable options
Definition: OSOption.h:2119
int idx
variable index
Definition: OSOption.h:1932
std::string type
type of the option value (integer, double, boolean, string)
Definition: OSOption.h:2012
OtherOptions * otherOptions
the list of other general options
Definition: OSOption.h:320
~OSoLWriter()
Class destructor.
Definition: OSoLWriter.cpp:40
InitDualVariableValues * initialDualValues
initial dual values for the constraints
Definition: OSOption.h:3274
std::string solver
name of the solver to which this option applies
Definition: OSOption.h:2006
std::string name
name of the option
Definition: OSOption.h:3167
DirectoriesAndFiles * directoriesToDelete
directories to delete upon completion
Definition: OSOption.h:1105
ConstraintOption * constraints
the options for the constraints
Definition: OSOption.h:3515
std::string category
name of the category into which this option falls
Definition: OSOption.h:2594
std::string name
name of the option
Definition: OSOption.h:2000
StorageCapacity * minMemorySize
the minimum memory required
Definition: OSOption.h:553
std::string lbValue
lower bound of the option
Definition: OSOption.h:3105
std::string category
name of the category into which this option falls
Definition: OSOption.h:3176
int numberOfVar
number of children
Definition: OSOption.h:1786
bool makeCopy
record whether a copy is to be made
Definition: OSOption.h:862
std::string instanceName
the name of the instance
Definition: OSOption.h:296
const OSOption * m_OSOption
m_OSOption is an object in the class OSOption
Definition: OSoLWriter.h:35
PathPairs * outputFilesToMove
output files to move or copy
Definition: OSOption.h:1096
double groupWeight
branching weight for the entire SOS
Definition: OSOption.h:1783
int numberOfCon
number of &lt;con&gt; children
Definition: OSOption.h:2992
static char * j
Definition: OSdtoa.cpp:3622
The Option Class.
Definition: OSOption.h:3564
int numberOfPathPairs
the number of &lt;path&gt; children
Definition: OSOption.h:915
std::string name
name of the option
Definition: OSOption.h:2585
std::string password
the password
Definition: OSOption.h:314
std::string jobID
the job ID
Definition: OSOption.h:302
double lbValue
initial lower bound
Definition: OSOption.h:2354
std::string to
the file or directory to move/copy to
Definition: OSOption.h:859
std::string locationType
the type of the location
Definition: OSOption.h:44
int numberOfObj
number of &lt;obj&gt; children
Definition: OSOption.h:2410
int numberOfSolverOptions
the number of solver options
Definition: OSOption.h:3423
int idx
variable index
Definition: OSOption.h:1164
DirectoriesAndFiles * filesToDelete
files to delete upon completion
Definition: OSOption.h:1102
int numberOfObjectives
the number of objectives
Definition: OSOption.h:3503
int numberOfVar
number of child elements
Definition: OSOption.h:1994
InstanceLocationOption * instanceLocation
the location of the instance
Definition: OSOption.h:299
std::string from
the file or directory to move/copy from
Definition: OSOption.h:856
std::string serviceURI
the service URI
Definition: OSOption.h:290
#define OSNAN
Definition: OSParameters.h:106
BasisStatus * initialBasisStatus
initial basis information
Definition: OSOption.h:2110
#define OS_SCHEMA_VERSION
Definition: OSParameters.h:83
BranchingWeight ** var
branching weights for individual variables
Definition: OSOption.h:1789
int numberOfOtherVariableOptions
number of &lt;other&gt; child elements
Definition: OSOption.h:2101
OSoLWriter()
Default constructor.
Definition: OSoLWriter.cpp:34
std::string description
the description of the option
Definition: OSOption.h:163
int numberOfVar
number of children
Definition: OSOption.h:1384
InitObjValue ** obj
initial value for each objective
Definition: OSOption.h:2249
CPUNumber * minCPUNumber
the minimum number of processors required
Definition: OSOption.h:559
int idx
objective index
Definition: OSOption.h:2348
int idx
objective index
Definition: OSOption.h:2187
int numberOfPaths
the number of &lt;path&gt; children
Definition: OSOption.h:785
std::string name
the name of the option
Definition: OSOption.h:3349
double value
branching weight
Definition: OSOption.h:1622
int numberOfConstraints
the number of constraints
Definition: OSOption.h:3506
double value
initial value
Definition: OSOption.h:1170
std::string value
initial value
Definition: OSOption.h:1331
std::string writeOSoL(OSOption *theosoption)
create an osol string from an OSOption object
Definition: OSoLWriter.cpp:45
std::string description
description of the option
Definition: OSOption.h:2015
DirectoriesAndFiles * directoriesToMake
directories to make during the job
Definition: OSOption.h:1084
int idx
index of the variable
Definition: OSOption.h:1616
PathPairs * inputDirectoriesToMove
input directories to move or copy
Definition: OSOption.h:1090
std::string value
the value of the option
Definition: OSOption.h:3352
int numberOfVar
number of children
Definition: OSOption.h:1223
const double OSDBL_MAX
Definition: OSParameters.h:93
OtherOptions * otherOptions
the list of other service options
Definition: OSOption.h:618
double value
initial value
Definition: OSOption.h:2193
std::string unit
the unit in which storage capacity is measured
Definition: OSGeneral.h:759
int numberOfProcesses
the number of &lt;process&gt; children
Definition: OSOption.h:998
double lbDualValue
initial lower bound
Definition: OSOption.h:2935
SolverOptions * solverOptions
other solver options
Definition: OSOption.h:3518
std::string value
value of the option
Definition: OSOption.h:1938
InitVarValueString ** var
initial value for each variable
Definition: OSOption.h:1387
InitConValue ** con
initial value for each constraint
Definition: OSOption.h:2830
DirectoriesAndFiles * filesToMake
files to make during the job
Definition: OSOption.h:1087
int idx
variable index
Definition: OSOption.h:1325
OtherOptions * otherOptions
the list of other system options
Definition: OSOption.h:562
PathPairs * outputDirectoriesToMove
output directories to move or copy
Definition: OSOption.h:1099
int numberOfObj
number of &lt;obj&gt; children
Definition: OSOption.h:2246
CPUSpeed * minCPUSpeed
the minimum CPU speed required
Definition: OSOption.h:556
std::string description
description of the option
Definition: OSOption.h:3182
VariableOption * variables
the options for the variables
Definition: OSOption.h:3509
OtherVarOption ** var
array of option values
Definition: OSOption.h:2018
Processes * processesToKill
processes to kill upon completion
Definition: OSOption.h:1108
std::string value
value of the option
Definition: OSOption.h:2588
std::string name
the name of the option
Definition: OSOption.h:157
InitVariableValuesString * initialVariableValuesString
initial values for string-valued variables
Definition: OSOption.h:2107
std::string license
the license information
Definition: OSOption.h:308
double value
the CPU speed (expressed in multiples of unit)
Definition: OSGeneral.h:823
ContactOption * contact
the contact method
Definition: OSOption.h:317
OtherConOption ** con
array of option values
Definition: OSOption.h:3185
PathPair ** pathPair
the list of directory and file paths
Definition: OSOption.h:918
TimeSpan * maxTime
the maximum time allowed
Definition: OSOption.h:1069
SOSWeights ** sos
branching weights for the SOS
Definition: OSOption.h:1861
std::string type
the type of the option value (integer, double, boolean, string)
Definition: OSOption.h:3361
double ubValue
initial upper bound
Definition: OSOption.h:2357
std::string value
value of the option
Definition: OSOption.h:3170
InitDualVarValue ** con
initial dual values for each constraint
Definition: OSOption.h:2995
OtherObjectiveOption ** other
other information about the objectives
Definition: OSOption.h:2698
std::string type
type of the option value (integer, double, boolean, string)
Definition: OSOption.h:2597
int numberOfSOS
number of &lt;sos&gt; children
Definition: OSOption.h:1858
std::string solverToInvoke
the solver to invoke
Definition: OSOption.h:305
PathPairs * inputFilesToMove
input files to move or copy
Definition: OSOption.h:1093
std::string ubValue
lower bound on the value
Definition: OSOption.h:1944
std::string os_dtoa_format(double x)
Definition: OSMathUtil.cpp:154
int numberOfVar
number of children
Definition: OSOption.h:1676
int numberOfObj
number of &lt;obj&gt; children
Definition: OSOption.h:2579
int numberOfJobIDs
the number of entries in the list of job dependencies
Definition: OSOption.h:714
std::string type
type of the option value (integer, double, boolean, string)
Definition: OSOption.h:3179
OptimizationOption * optimization
optimizationOption holds the fifth child of the OSOption specified by the OSoL Schema.
Definition: OSOption.h:3596
int numberOfOtherConstraintOptions
number of &lt;other&gt; child elements
Definition: OSOption.h:3268
std::string value
the value of the &lt;instanceLocation&gt; element
Definition: OSOption.h:47
GeneralOption * general
generalOption holds the first child of the OSOption specified by the OSoL Schema. ...
Definition: OSOption.h:3580
IntegerVariableBranchingWeights * integerVariableBranchingWeights
branching weights for integer variables
Definition: OSOption.h:2113
std::string transportType
the contact mechanism
Definition: OSOption.h:101
std::string lbValue
lower bound on the value
Definition: OSOption.h:1941
std::string value
the value of the option
Definition: OSOption.h:160
std::string description
description of the option
Definition: OSOption.h:2600
std::string ubValue
upper bound of the option
Definition: OSOption.h:3108
int idx
constraint index
Definition: OSOption.h:2768
ObjectiveOption * objectives
the options for the objectives
Definition: OSOption.h:3512
int numberOfOtherOptions
the number of other options
Definition: OSOption.h:216
SolverOption ** solverOption
the list of solver options
Definition: OSOption.h:3426
double value
initial value
Definition: OSOption.h:2774
InitObjectiveBounds * initialObjectiveBounds
initial bounds for the objectives
Definition: OSOption.h:2692
int idx
constraint index
Definition: OSOption.h:2929
BranchingWeight ** var
branching weight for each variable
Definition: OSOption.h:1679
OtherObjOption ** obj
array of option values
Definition: OSOption.h:2603
InitObjBound ** obj
initial bounds for each objective
Definition: OSOption.h:2413
std::string description
the description of the option
Definition: OSOption.h:3364
int idx
variable index
Definition: OSOption.h:2514
std::string * process
the list of processes
Definition: OSOption.h:1001
OtherOptions * otherOptions
list of other job options
Definition: OSOption.h:1111
std::string unit
the unit in which time is measured
Definition: OSGeneral.h:929
double value
the number of units of storage capacity
Definition: OSGeneral.h:765
OtherConstraintOption ** other
other information about the constraints
Definition: OSOption.h:3280
JobDependencies * dependencies
the dependency set
Definition: OSOption.h:1075
InitVariableValues * initialVariableValues
initial values for the variables
Definition: OSOption.h:2104
DirectoriesAndFiles * requiredFiles
files required to run the job
Definition: OSOption.h:1081