OSiLWriter.cpp
Go to the documentation of this file.
1 /* $Id: OSiLWriter.cpp 5284 2017-12-08 13:52:50Z stefan $ */
16 #include "OSiLWriter.h"
17 #include "OSStringUtil.h"
18 #include "OSInstance.h"
19 #include "OSParameters.h"
20 #include "OSBase64.h"
21 #include "OSMathUtil.h"
22 #include "CoinFinite.hpp"
23 
24 #include <sstream>
25 
26 using std::endl;
27 using std::ostringstream;
28 
29 
31 {
32  m_bWriteBase64 = false;
33  m_bWhiteSpace = false;
34 }
35 
37 {
38 }
39 
40 std::string OSiLWriter::writeOSiL( const OSInstance *theosinstance)
41 {
42  m_OSInstance = theosinstance;
43  ostringstream outStr;
44  int i, j, k, kk;
45  int mult;
46  int incr;
47  std::string tmpname, tmpsense;
48  double tmplb, tmpub, tmpconst, tmpweight;
49  char tmptype;
50  int tmpnum;
51 
52  if(m_OSInstance == NULL) return outStr.str();
53  outStr << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" ;
54  if( m_bWhiteSpace == true) outStr << endl;
55  outStr << "<osil xmlns=\"os.optimizationservices.org\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" ";
56  outStr << "xsi:schemaLocation=\"os.optimizationservices.org http://www.optimizationservices.org/schemas/";
57  outStr << OS_SCHEMA_VERSION;
58  outStr << "/OSiL.xsd\" >" ;
59  if( m_bWhiteSpace == true) outStr << endl;
60  outStr << "<instanceHeader>";
61  if( m_bWhiteSpace == true) outStr << endl;
62  if(m_OSInstance->instanceHeader != NULL)
63  {
64  if(m_OSInstance->instanceHeader->name.length() > 0)
65  {
66  outStr << "<name>" + m_OSInstance->instanceHeader->name + "</name>" ;
67  if( m_bWhiteSpace == true) outStr << endl;
68  }
69 
70  if(m_OSInstance->instanceHeader->source.length() > 0)
71  {
72  outStr << "<source>" + m_OSInstance->instanceHeader->source + "</source>" ;
73  if( m_bWhiteSpace == true) outStr << endl;
74  }
75  if(m_OSInstance->instanceHeader->description.length() > 0)
76  {
77  outStr << "<description>" + m_OSInstance->instanceHeader->description + "</description>";
78  if( m_bWhiteSpace == true) outStr << endl;
79  }
80  if(m_OSInstance->instanceHeader->fileCreator.length() > 0)
81  {
82  outStr << "<fileCreator>" + m_OSInstance->instanceHeader->fileCreator + "</fileCreator>";
83  if( m_bWhiteSpace == true) outStr << endl;
84  }
85  if(m_OSInstance->instanceHeader->licence.length() > 0)
86  {
87  outStr << "<licence>" + m_OSInstance->instanceHeader->licence + "</licence>";
88  if( m_bWhiteSpace == true) outStr << endl;
89  }
90  }
91  outStr << "</instanceHeader>" ;
92  if( m_bWhiteSpace == true) outStr << endl;
93  outStr << "<instanceData>" ;
94  if(m_OSInstance->instanceData != NULL)
95  {
96  if( m_bWhiteSpace == true) outStr << endl;
98  {
99  outStr << "<variables " ;
100  outStr << "numberOfVariables=\"";
102  outStr << "\"" ;
103  outStr << ">" ;
104  if (m_bWhiteSpace == true) outStr << endl;
105  // get variable information
107  {
108  mult = 1;
109  if (m_OSInstance->instanceData->variables->var[i] != NULL)
110  {
111  if (i < m_OSInstance->instanceData->variables->numberOfVariables - 1)
112  {
113  tmpname = m_OSInstance->instanceData->variables->var[i]->name;
114  tmptype = m_OSInstance->instanceData->variables->var[i]->type;
115  tmplb = m_OSInstance->instanceData->variables->var[i]->lb;
116  tmpub = m_OSInstance->instanceData->variables->var[i]->ub;
117  for (k=i+1; k < m_OSInstance->instanceData->variables->numberOfVariables; k++)
118  {
119  if (tmpname != m_OSInstance->instanceData->variables->var[k]->name) break;
120  if (tmptype != m_OSInstance->instanceData->variables->var[k]->type) break;
121  if (tmplb != m_OSInstance->instanceData->variables->var[k]->lb) break;
122  if (tmpub != m_OSInstance->instanceData->variables->var[k]->ub) break;
123  mult++;
124  }
125  }
126  outStr << "<var" ;
127  if (m_OSInstance->instanceData->variables->var[i]->name.length() > 0)
128  {
129  outStr << " name=" ;
131  }
132  if( m_OSInstance->instanceData->variables->var[i]->type != 'C')
133  {
134  outStr << " type=\"" ;
135  outStr << m_OSInstance->instanceData->variables->var[i]->type ;
136  outStr << "\"";
137  }
138  if( m_OSInstance->instanceData->variables->var[i]->lb != 0.0)
139  {
140  outStr << " lb=\"" ;
142  outStr << "\"";
143  }
145  && m_OSInstance->instanceData->variables->var[i]->ub != OSNaN() )
146  {
147  outStr << " ub=\"" ;
149  outStr << "\"";
150  }
151  if (mult > 1)
152  outStr << " mult=\"" << mult << "\"";
153  outStr << "/>" ;
154  if( m_bWhiteSpace == true) outStr << endl;
155  }
156  i += mult;
157  } // end the for loop
158  outStr << "</variables>" ;
159  if( m_bWhiteSpace == true) outStr << endl;
160  }
162  {
163  outStr << "<objectives " ;
164  outStr << "numberOfObjectives=\"";
166  outStr << "\"" ;
167  outStr << ">" ;
168  if( m_bWhiteSpace == true) outStr << endl;
170  {
171  mult = 1;
172  if(m_OSInstance->instanceData->objectives->obj[j] != NULL)
173  {
174  if (j < m_OSInstance->instanceData->objectives->numberOfObjectives - 1)
175  {
176  tmpname = m_OSInstance->instanceData->objectives->obj[j]->name;
179  tmpweight = m_OSInstance->instanceData->objectives->obj[j]->weight;
181  for (k=j+1; k < m_OSInstance->instanceData->objectives->numberOfObjectives; k++)
182  {
183  if (tmpname != m_OSInstance->instanceData->objectives->obj[k]->name) break;
184  if (tmpsense != m_OSInstance->instanceData->objectives->obj[k]->maxOrMin) break;
185  if (tmpconst != m_OSInstance->instanceData->objectives->obj[k]->constant) break;
186  if (!OSIsEqual(tmpweight, m_OSInstance->instanceData->objectives->obj[k]->weight)) break;
187  if (tmpnum != m_OSInstance->instanceData->objectives->obj[k]->numberOfObjCoef) break;
188  for (kk=0; kk < tmpnum; kk++)
189  {
190  if (m_OSInstance->instanceData->objectives->obj[k]->coef[kk]->idx !=
191  m_OSInstance->instanceData->objectives->obj[j]->coef[kk]->idx) break;
192  if (m_OSInstance->instanceData->objectives->obj[k]->coef[kk]->value !=
193  m_OSInstance->instanceData->objectives->obj[j]->coef[kk]->value) break;
194  }
195  if ( kk < tmpnum) break;
196  mult++;
197  }
198  }
199  outStr << "<obj" ;
200  if(m_OSInstance->instanceData->objectives->obj[j]->maxOrMin.length() > 0)
201  {
202  outStr << " maxOrMin=\"" ;
204  outStr << "\"";
205  }
207  {
208  outStr << " constant=\"" ;
210  outStr << "\"";
211  }
213  {
214  outStr << " weight=\"" ;
216  outStr << "\"";
217  }
218  if(m_OSInstance->instanceData->objectives->obj[j]->name.length() > 0)
219  {
220  outStr << " name=" ;
222  }
223  outStr << " numberOfObjCoef=\"" ;
225  outStr << "\"";
226  if (mult > 1)
227  outStr << " mult=\"" << mult << "\"";
228  outStr << ">" ;
229  if( m_bWhiteSpace == true) outStr << endl;
230  if(m_OSInstance->instanceData->objectives->obj[j]->coef != NULL)
231  {
232  for (i = 0; i < m_OSInstance->instanceData->objectives->obj[ j]->numberOfObjCoef; i++)
233  {
234  if(m_OSInstance->instanceData->objectives->obj[j]->coef[i]->idx > -1 )
235  {
236  outStr << "<coef" ;
237  outStr << " idx=\"" ;
238  outStr << m_OSInstance->instanceData->objectives->obj[j]->coef[i]->idx ;
239  outStr << "\"";
240  outStr << ">";
241  //
242  //
244  //outStr << m_OSInstance->instanceData->objectives->obj[j]->coef[i]->value ;
245  outStr << "</coef>" ;
246  if( m_bWhiteSpace == true) outStr << endl;
247  }
248  }
249  }
250  outStr << "</obj>" ;
251  if( m_bWhiteSpace == true) outStr << endl;
252  }
253  j += mult;
254  }
255  outStr << "</objectives>" ;
256  if( m_bWhiteSpace == true) outStr << endl;
257  }
258  // Now the constraints
260  {
261  outStr << "<constraints " ;
262  outStr << "numberOfConstraints=\"";
264  outStr << "\"" ;
265  outStr << ">" ;
266  if( m_bWhiteSpace == true) outStr << endl;
268  {
269  mult = 1;
270  if(m_OSInstance->instanceData->constraints->con[i] != NULL)
271  {
272  if (i < m_OSInstance->instanceData->constraints->numberOfConstraints - 1)
273  {
274  tmpname = m_OSInstance->instanceData->constraints->con[i]->name;
276  tmplb = m_OSInstance->instanceData->constraints->con[i]->lb;
277  tmpub = m_OSInstance->instanceData->constraints->con[i]->ub;
279  {
280  if (tmpname != m_OSInstance->instanceData->constraints->con[k]->name) break;
281  if (tmpconst != m_OSInstance->instanceData->constraints->con[k]->constant) break;
282  if (tmplb != m_OSInstance->instanceData->constraints->con[k]->lb) break;
283  if (tmpub != m_OSInstance->instanceData->constraints->con[k]->ub) break;
284  mult++;
285  }
286  }
287  outStr << "<con" ;
288  if(m_OSInstance->instanceData->constraints->con[i]->name.length())
289  {
290  outStr << " name=" ;
292  }
294  {
295  outStr << " constant=\"" ;
297  outStr << "\"";
298  }
300  {
301  outStr << " lb=\"" ;
303  outStr << "\"";
304  }
306  {
307  outStr << " ub=\"" ;
309  outStr << "\"";
310  }
311  if (mult > 1)
312  outStr << " mult=\"" << mult << "\"";
313  outStr << "/>" ;
314  if( m_bWhiteSpace == true) outStr << endl;
315  }
316  i += mult;
317  }
318  outStr << "</constraints>" ;
319  if( m_bWhiteSpace == true) outStr << endl;
320  }
321  // now the linearConstraintsCoefficients
323  {
324  outStr << "<linearConstraintCoefficients " ;
325  outStr << "numberOfValues=\"";
327  outStr << "\"" ;
328  outStr << ">" ;
329  if( m_bWhiteSpace == true) outStr << endl;
332  {
334  {
335  outStr << "<start>" ;
336  if( m_bWhiteSpace == true) outStr << endl;
338  {
339  if(m_bWriteBase64 == false)
340  {
342  {
344  &mult, &incr, (m_OSInstance->instanceData->variables->numberOfVariables) + 1-i,1);
345  if (mult == 1)
346  outStr << "<el>" ;
347  else if (incr == 0)
348  outStr << "<el mult=\"" << mult << "\">";
349  else
350  outStr << "<el mult=\"" << mult << "\" incr=\"" << incr << "\">";
352  outStr << "</el>" ;
353  if( m_bWhiteSpace == true) outStr << endl;
354  i += mult;
355  }
356  }
357  else
358  {
359  outStr << "<base64BinaryData sizeOf=\"" << sizeof(int) << "\" >" ;
361  (m_OSInstance->instanceData->variables->numberOfVariables + 1)*sizeof(int) );
362  outStr << "</base64BinaryData>" ;
363  if( m_bWhiteSpace == true) outStr << endl;
364  }
365  }
366  outStr << "</start>" ;
367  if( m_bWhiteSpace == true) outStr << endl;
368  }
369  outStr << "<rowIdx>" ;
370  if( m_bWhiteSpace == true) outStr << endl;
371  if(m_bWriteBase64 == false)
372  {
374  {
377  if (mult == 1)
378  outStr << "<el>" ;
379  else if (incr == 0)
380  outStr << "<el mult=\"" << mult << "\">";
381  else
382  outStr << "<el mult=\"" << mult << "\" incr=\"" << incr << "\">";
384  outStr << "</el>" ;
385  if( m_bWhiteSpace == true) outStr << endl;
386  i += mult;
387  }
388  }
389  else
390  {
391  //outStr << "<base64BinaryData sizeOf=\"4\" numericType=\"int\" >" ;
392  outStr << "<base64BinaryData sizeOf=\"" << sizeof(int) << "\" >" ;
395  outStr << "</base64BinaryData>" ;
396  if( m_bWhiteSpace == true) outStr << endl;
397  }
398  outStr << "</rowIdx>" ;
399  if( m_bWhiteSpace == true) outStr << endl;
400  }
401  else
402  {
405  {
407  {
408  outStr << "<start>" ;
409  if( m_bWhiteSpace == true) outStr << endl;
411  {
412  if(m_bWriteBase64 == false)
413  {
415  {
417  &mult, &incr, (m_OSInstance->instanceData->constraints->numberOfConstraints) + 1-i,1);
418  if (mult == 1)
419  outStr << "<el>" ;
420  else if (incr == 0)
421  outStr << "<el mult=\"" << mult << "\">";
422  else
423  outStr << "<el mult=\"" << mult << "\" incr=\"" << incr << "\">";
425  outStr << "</el>" ;
426  if( m_bWhiteSpace == true) outStr << endl;
427  i += mult;
428  }
429  }
430  else
431  {
432  outStr << "<base64BinaryData sizeOf=\"" << sizeof(int) << "\" >" ;
434  (m_OSInstance->instanceData->variables->numberOfVariables + 1)*sizeof(int) );
435  outStr << "</base64BinaryData>" ;
436  if( m_bWhiteSpace == true) outStr << endl;
437  }
438  }
439  outStr << "</start>" ;
440  if( m_bWhiteSpace == true) outStr << endl;
441  }
442  outStr << "<colIdx>";
443  if( m_bWhiteSpace == true) outStr << endl;
444  if(m_bWriteBase64 == false)
445  {
447  {
450  if (mult == 1)
451  outStr << "<el>" ;
452  else if (incr == 0)
453  outStr << "<el mult=\"" << mult << "\">";
454  else
455  outStr << "<el mult=\"" << mult << "\" incr=\"" << incr << "\">";
457  outStr << "</el>" ;
458  if( m_bWhiteSpace == true) outStr << endl;
459  i += mult;
460  }
461  }
462  else
463  {
464  outStr << "<base64BinaryData sizeOf=\"" << sizeof(int) << "\" >" ;
467  outStr << "</base64BinaryData>" ;
468  if( m_bWhiteSpace == true) outStr << endl;
469  }
470  outStr << "</colIdx>" ;
471  if( m_bWhiteSpace == true) outStr << endl;
472  }
473  }
475  {
476  outStr << "<value>" ;
477  if( m_bWhiteSpace == true) outStr << endl;
479  {
480  if(m_bWriteBase64 == false)
481  {
483  {
486  if (mult == 1)
487  outStr << "<el>" ;
488  else
489  outStr << "<el mult=\"" << mult << "\">";
491  outStr << "</el>" ;
492  if( m_bWhiteSpace == true) outStr << endl;
493  i += mult;
494  }
495  }
496  else
497  {
498  outStr << "<base64BinaryData sizeOf=\"" << sizeof(double) << "\" >" ;
501  outStr << "</base64BinaryData>" ;
502  if( m_bWhiteSpace == true) outStr << endl;
503  }
504  }
505  outStr << "</value>" ;
506  if( m_bWhiteSpace == true) outStr << endl;
507  }
508  outStr << "</linearConstraintCoefficients>" ;
509  if( m_bWhiteSpace == true) outStr << endl;
510  }
512  {
513  outStr << "<quadraticCoefficients";
514  outStr << " numberOfQuadraticTerms=\"";
516  outStr << "\">" ;
517  if( m_bWhiteSpace == true) outStr << endl;
519  {
521  {
522  outStr << "<qTerm" ;
523  // the following attributes are required
524  outStr << " idx=\"";
526  outStr << "\"";
527  outStr << " idxOne=\"";
529  outStr << "\"";
530  outStr << " idxTwo=\"";
532  outStr << "\"";
534  {
535  outStr << " coef=\"";
537  outStr << "\"";
538  }
539  outStr << "/>" ;
540  if( m_bWhiteSpace == true) outStr << endl;
541  }
542  }
543  outStr << "</quadraticCoefficients>";
544  if( m_bWhiteSpace == true) outStr << endl;
545  }
546  //Now the nonlinear expressions
548  {
549  outStr << "<nonlinearExpressions";
550  outStr << " numberOfNonlinearExpressions=\"";
552  outStr << "\">" ;
553  if( m_bWhiteSpace == true) outStr << endl;
555  {
557  {
558  outStr << "<nl" ;
559  // the following attribute is required
560  outStr << " idx=\"";
562  outStr << "\"";
563 
564  // shape is an optional attribute, new since stable 2.9
566  if (tempStr != "" && tempStr != "general")
567  {
568  outStr << " shape=\"" << tempStr << "\"";
569  }
570  outStr << ">";
573  outStr << "</nl>";
574  }
575  if( m_bWhiteSpace == true) outStr << endl;
576  }
577  outStr << "</nonlinearExpressions>";
578  if( m_bWhiteSpace == true) outStr << endl;
579  }
580  // Now the matrices element
582  {
583  outStr << "<matrices";
584  outStr << " numberOfMatrices=\"";
586  outStr << "\"" ;
587  outStr << ">" ;
588  if( m_bWhiteSpace == true) outStr << endl;
589  for (i = 0; i < m_OSInstance->instanceData->matrices->numberOfMatrices;i++)
590  {
591  if (m_OSInstance->instanceData->matrices->matrix[i] != NULL)
593  }
594  if( m_bWhiteSpace == true) outStr << endl;
595  outStr << "</matrices>" << endl;
596  }
597  // Now the cones element
599  {
600  outStr << "<cones";
601  outStr << " numberOfCones=\"";
603  outStr << "\"" ;
604  outStr << ">" ;
605  if( m_bWhiteSpace == true) outStr << endl;
606  for (i = 0; i < m_OSInstance->instanceData->cones->numberOfCones;i++)
607  {
608  if (m_OSInstance->instanceData->cones->cone[i] != NULL)
609  {
610  switch ( m_OSInstance->instanceData->cones->cone[i]->coneType )
611  {
613  outStr << ((NonnegativeCone*)m_OSInstance->instanceData->cones->cone[i])->getConeInXML();
614  break;
616  outStr << ((NonpositiveCone*)m_OSInstance->instanceData->cones->cone[i])->getConeInXML();
617  break;
619  outStr << ((OrthantCone*)m_OSInstance->instanceData->cones->cone[i])->getConeInXML();
620  break;
622  outStr << ((QuadraticCone*)m_OSInstance->instanceData->cones->cone[i])->getConeInXML();
623  break;
625  outStr << ((RotatedQuadraticCone*)m_OSInstance->instanceData->cones->cone[i])->getConeInXML();
626  break;
628  outStr << ((SemidefiniteCone*)m_OSInstance->instanceData->cones->cone[i])->getConeInXML();
629  break;
631  outStr << ((ProductCone*)m_OSInstance->instanceData->cones->cone[i])->getConeInXML();
632  break;
634  outStr << ((IntersectionCone*)m_OSInstance->instanceData->cones->cone[i])->getConeInXML();
635  break;
636  }
637  }
638  }
639  if( m_bWhiteSpace == true) outStr << endl;
640  outStr << "</cones>" << endl;
641  }
642  // Now the matrixProgramming element
644  {
645  outStr << "<matrixProgramming>";
646 
648  {
649  outStr << "<matrixVariables";
650  outStr << " numberOfMatrixVar=\"";
653  {
654  outStr << "<matrixVar";
655  outStr << " numberOfRows=\"";
657  outStr << " numberOfColumns=\"";
659 
661  {
662  outStr << " templateMatrixIdx=\"";
664  }
665 
667  {
668  outStr << " varReferenceMatrixIdx=\"";
670  }
671 
673  {
674  outStr << " lbMatrixIdx=\"";
676  }
677 
679  {
680  outStr << " lbConeIdx=\"";
682  }
683 
685  {
686  outStr << " ubMatrixIdx=\"";
688  }
689 
691  {
692  outStr << " ubConeIdx=\"";
694  }
695 
697  {
698  outStr << " name=\"";
700  }
701 
703  {
704  outStr << " varType=\"";
706  }
707 
708  outStr << "/>" << endl;
709  }
710  outStr << "</matrixVariables>" << endl;
711  }
712 
714  {
715  outStr << "<matrixObjectives";
716  outStr << " numberOfMatrixObj=\"";
719  {
720  outStr << "<matrixObj";
721  outStr << " numberOfRows=\"";
723  outStr << " numberOfColumns=\"";
725 
727  {
728  outStr << " templateMatrixIdx=\"";
730  }
731 
733  {
734  outStr << " objReferenceMatrixIdx=\"";
736  }
737 
739  {
740  outStr << " orderConeIdx=\"";
742  }
743 
745  {
746  outStr << " constantMatrixIdx=\"";
748  }
749 
751  {
752  outStr << " name=\"";
754  }
755 
756  outStr << "/>" << endl;
757  }
758  outStr << "</matrixObjectives>" << endl;
759  }
760 
762  {
763  outStr << "<matrixConstraints";
764  outStr << " numberOfMatrixCon=\"";
767  {
768  outStr << "<matrixCon";
769  outStr << " numberOfRows=\"";
771  outStr << " numberOfColumns=\"";
773 
775  {
776  outStr << " templateMatrixIdx=\"";
778  }
779 
781  {
782  outStr << " conReferenceMatrixIdx=\"";
784  }
785 
787  {
788  outStr << " lbMatrixIdx=\"";
790  }
791 
793  {
794  outStr << " lbConeIdx=\"";
796  }
797 
799  {
800  outStr << " ubMatrixIdx=\"";
802  }
803 
805  {
806  outStr << " ubConeIdx=\"";
808  }
809 
811  {
812  outStr << " name=\"";
814  }
815 
816  outStr << "/>" << endl;
817  }
818  outStr << "</matrixConstraints>" << endl;
819  }
820 
822  {
823  outStr << "<matrixExpressions";
824  outStr << " numberOfExpr=\"";
826  if( m_bWhiteSpace == true) outStr << endl;
828  {
830  {
831  outStr << "<expr";
832 
833  // the following attribute is required
834  outStr << " idx=\"";
836  outStr << "\"";
837 
838  // shape is an optional attribute, new since stable 2.9
840  if (tempStr != "" && tempStr != "general");
841  {
842  outStr << " shape=\"" << tempStr << "\"";
843  }
844 
845  outStr << ">";
848  outStr << "</expr>";
849  if( m_bWhiteSpace == true) outStr << endl;
850  }
851  }
852  outStr << "</matrixExpressions>";
853  if( m_bWhiteSpace == true) outStr << endl;
854  }
855 
856  outStr << "</matrixProgramming>" << endl;
857  }
858  if( m_bWhiteSpace == true) outStr << endl;
859  } // end instanceData if
860  outStr << "</instanceData>";
861  outStr << "</osil>" ;
862  if( m_bWhiteSpace == true) outStr << endl;
863  outStr << endl;
864  return outStr.str();
865 } // end writeOSiL
int numberOfExpr
numberOfExpr gives the number of expressions
Definition: OSInstance.h:1859
ENUM_NL_EXPR_SHAPE shape
shape holds the shape of the nonlinear expression (linear/quadratic/convex/general) (see further up i...
Definition: OSInstance.h:1826
MatrixVar ** matrixVar
matrixVar is an array of pointers to the &lt;matrixVar&gt; children
Definition: OSInstance.h:1642
int numberOfMatrixCon
numberOfMatrixCon gives the number of &lt;matrixCon&gt; children
Definition: OSInstance.h:1798
std::string name
name corresponds to the optional attribute that holds the variable name, the default value is empty ...
Definition: OSInstance.h:71
Constraints * constraints
constraints is a pointer to a Constraints object
Definition: OSInstance.h:2191
std::string name
the name of the objective function
Definition: OSInstance.h:152
The in-memory representation of a rotated quadratic cone.
Definition: OSInstance.h:951
int numberOfColumns
numberOfColumns gives the number of columns of this matrix
Definition: OSInstance.h:1743
int numberOfMatrixVar
numberOfMatrixVar gives the number of &lt;matrixVar&gt; children
Definition: OSInstance.h:1639
IntVector * rowIdx
a pointer of row indices if the problem is stored by column
Definition: OSInstance.h:309
fint kk
int ubConeIdx
ubConeIdx gives a cone that must contain ubMatrix - matrixCon
Definition: OSInstance.h:1765
NonlinearExpressions * nonlinearExpressions
nonlinearExpressions is a pointer to a NonlinearExpressions object
Definition: OSInstance.h:2206
int orderConeIdx
orderConeIdx gives a cone that expresses preferences during the optimization x is (weakly) preferred ...
Definition: OSInstance.h:1683
bool verifyVarType(char vt)
Definition: OSParameters.h:580
MatrixExpression ** expr
a pointer to an array of linear and nonlinear expressions that evaluate to matrices ...
Definition: OSInstance.h:1864
int numberOfMatrixObj
numberOfMatrixObj gives the number of &lt;matrixObj&gt; children
Definition: OSInstance.h:1719
std::string description
further information about the file or the problem contained within it
Definition: OSGeneral.h:50
IntVector * colIdx
a pointer of column indices if the problem is stored by row
Definition: OSInstance.h:312
std::string maxOrMin
declare the objective function to be a max or a min
Definition: OSInstance.h:157
std::string name
an optional name to this matrixObj
Definition: OSInstance.h:1689
ObjCoef ** coef
coef is pointer to an array of ObjCoef object pointers
Definition: OSInstance.h:176
ENUM_CONE_TYPE coneType
The type of the cone.
Definition: OSInstance.h:556
MatrixCon ** matrixCon
matrixCon is an array of pointers to the &lt;matrixCon&gt; children
Definition: OSInstance.h:1801
std::string fileCreator
name(s) of author(s) who created this file
Definition: OSGeneral.h:55
int idxTwo
idxTwo is the index of the second variable in the quadratic term
Definition: OSInstance.h:363
QuadraticTerm ** qTerm
qTerm is a pointer to an array of QuadraticTerm object pointers
Definition: OSInstance.h:397
Constraint ** con
con is pointer to an array of Constraint object pointers
Definition: OSInstance.h:268
bool m_bWriteBase64
m_bWriteBase64 is set to true if we encode the linear constraint coefficients in base64 binary ...
Definition: OSiLWriter.h:64
MatrixConstraints * matrixConstraints
a pointer to the matrixConstraints object
Definition: OSInstance.h:1898
static std::string encodeb64(char *bytes, int size)
encode the data in base 64
Definition: OSBase64.cpp:33
const OSInstance * m_OSInstance
m_OSInstance is an object in the class OSInstance
Definition: OSiLWriter.h:35
std::string name
used to give a name to the file or the problem contained within it
Definition: OSGeneral.h:39
int numberOfRows
numberOfRows gives the number of rows of this matrix
Definition: OSInstance.h:1665
char type
type corresponds to the attribute that holds the variable type: C (Continuous), B (binary)...
Definition: OSInstance.h:66
int numberOfVariables
numberOfVariables is the number of variables in the instance
Definition: OSInstance.h:94
int lbConeIdx
lbConeIdx gives a cone that must contain matrixCon - lbMatrix
Definition: OSInstance.h:1759
ENUM_NL_EXPR_SHAPE shape
shape holds the shape of the nonlinear expression (linear/quadratic/convex/general) (see further up i...
Definition: OSInstance.h:420
double lb
lb is the lower bound on the constraint
Definition: OSInstance.h:235
int numberOfObjectives
numberOfObjectives is the number of objective functions in the instance
Definition: OSInstance.h:201
OSiLWriter()
Default constructor.
Definition: OSiLWriter.cpp:30
static char * j
Definition: OSdtoa.cpp:3622
IntVector * start
a pointer to the start of each row or column stored in sparse format
Definition: OSInstance.h:306
double ub
ub is the upper bound on the constraint
Definition: OSInstance.h:238
The in-memory representation of an intersection cone.
Definition: OSInstance.h:1324
MatrixObjectives * matrixObjectives
a pointer to the matrixObjectives object
Definition: OSInstance.h:1895
double OSNaN()
returns the value for NaN used in OS
double weight
weight is the weight applied to the given objective function, 1.0 by default
Definition: OSInstance.h:167
std::string name
an optional name to this matrixVar
Definition: OSInstance.h:1611
#define OS_SCHEMA_VERSION
Definition: OSParameters.h:83
Nl ** nl
nl is pointer to an array of Nl object pointers
Definition: OSInstance.h:469
std::string name
an optional name to this MatrixCon
Definition: OSInstance.h:1768
DoubleVector * value
a pointer to the array of nonzero values being stored
Definition: OSInstance.h:315
int constantMatrixIdx
constantMatrixIdx gives a constant added to the matrixObj
Definition: OSInstance.h:1686
double lb
lb corresponds to the optional attribute that holds the variable lower bound.
Definition: OSInstance.h:56
double constant
constant is the constant term added to the objective function, 0 by default
Definition: OSInstance.h:162
int lbMatrixIdx
lbMatrixIdx gives a lower bound for this matrixVar
Definition: OSInstance.h:1599
Variable ** var
Here we define a pointer to an array of var pointers.
Definition: OSInstance.h:97
int lbConeIdx
lbConeIdx gives a cone that must contain matrixVar - lbMatrix
Definition: OSInstance.h:1602
int numberOfColumns
numberOfColumns gives the number of columns of this matrix
Definition: OSInstance.h:1586
The in-memory representation of a quadratic cone.
Definition: OSInstance.h:860
MatrixExpressions * matrixExpressions
a pointer to the matrixExpressions object
Definition: OSInstance.h:1901
double value
value is the value of the objective function coefficient corresponding to the variable with index idx...
Definition: OSInstance.h:128
int idxOne
idxOne is the index of the first variable in the quadratic term
Definition: OSInstance.h:358
void fint fint * k
int numberOfValues
numberOfValues is the number of nonzero elements stored in the &lt;linearConstraintCoefficients&gt; element...
Definition: OSInstance.h:301
MatrixObj ** matrixObj
matrixObj is an array of pointers to the &lt;matrixObj&gt; children
Definition: OSInstance.h:1722
int ubMatrixIdx
ubMatrixIdx gives an upper bound for this matrixCon
Definition: OSInstance.h:1762
const double OSDBL_MAX
Definition: OSParameters.h:93
int getMult(int *i, int size)
getMult
Definition: OSMathUtil.h:246
double ub
ub corresponds to the optional attribute that holds the variable upper bound.
Definition: OSInstance.h:61
Variables * variables
variables is a pointer to a Variables object
Definition: OSInstance.h:2185
void getMultIncr(int *i, int *mult, int *incr, int size, int defaultIncr)
getMultIncr
Definition: OSMathUtil.h:168
MatrixVariables * matrixVariables
a pointer to the matrixVariables object
Definition: OSInstance.h:1892
bool m_bWhiteSpace
m_bWhiteSpace is set to true if we write white space in the file
Definition: OSiLWriter.h:68
static int
Definition: OSdtoa.cpp:2173
int templateMatrixIdx
templateMatrixIdx refers to a matrix that describes the locations in this matrixVar that are allowed ...
Definition: OSInstance.h:1748
GeneralFileHeader * instanceHeader
the instanceHeader is implemented as a general file header object to allow sharing of classes between...
Definition: OSInstance.h:2275
MatrixExpressionTree * matrixExpressionTree
matrixExpressionTree contains the root of the MatrixExpressionTree
Definition: OSInstance.h:1829
int numberOfConstraints
numberOfConstraints is the number of constraints in the instance
Definition: OSInstance.h:264
OSnLNode * m_treeRoot
m_treeRoot holds the root node (of OSnLNode type) of the expression tree.
int varReferenceMatrixIdx
varReferenceMatrixIdx allows some or all of the components of this matrix variable to be copied from ...
Definition: OSInstance.h:1596
int numberOfRows
numberOfRows gives the number of rows of this matrix
Definition: OSInstance.h:1583
InstanceData * instanceData
A pointer to an InstanceData object.
Definition: OSInstance.h:2278
OSnLMNode * m_treeRoot
m_treeRoot holds the root node (of OSnLMNode type) of the expression tree.
std::string returnExprShapeString(ENUM_NL_EXPR_SHAPE shape)
Definition: OSParameters.h:849
static Bigint * mult(Bigint *a, Bigint *b)
Definition: OSdtoa.cpp:857
int idx
idx holds the row index of the nonlinear expression
Definition: OSInstance.h:414
The OrthantCone Class.
Definition: OSInstance.h:726
Objective ** obj
coef is pointer to an array of ObjCoef object pointers
Definition: OSInstance.h:205
std::string source
used when the file or problem appeared in the literature (could be in BiBTeX format or similar) ...
Definition: OSGeneral.h:45
virtual std::string getMatrixNodeInXML()
Definition: OSMatrix.cpp:3683
Matrices * matrices
matrices is a pointer to a Matrices object
Definition: OSInstance.h:2211
std::string writeOSiL(const OSInstance *theosinstance)
create an osil string from an OSInstance object
Definition: OSiLWriter.cpp:40
double coef
coef is the coefficient of the quadratic term
Definition: OSInstance.h:366
int numberOfColumns
numberOfColumns gives the number of columns of this matrix
Definition: OSInstance.h:1668
bool OSIsEqual(double x, double y)
Definition: OSGeneral.h:985
int templateMatrixIdx
templateMatrixIdx refers to a matrix that describes the locations in this matrixObj that are allowed ...
Definition: OSInstance.h:1673
The in-memory representation of a cone of semidefinite matrices.
Definition: OSInstance.h:1046
int ubMatrixIdx
ubMatrixIdx gives an upper bound for this matrixVar
Definition: OSInstance.h:1605
Objectives * objectives
objectives is a pointer to a Objectives object
Definition: OSInstance.h:2188
std::string os_dtoa_format(double x)
Definition: OSMathUtil.cpp:154
ScalarExpressionTree * osExpressionTree
osExpressionTree contains the root of the ScalarExpressionTree
Definition: OSInstance.h:430
MatrixProgramming * matrixProgramming
matrixProgramming is a pointer to a MatrixProgramming object
Definition: OSInstance.h:2221
Cones * cones
cones is a pointer to a Cones object
Definition: OSInstance.h:2216
~OSiLWriter()
Class destructor.
Definition: OSiLWriter.cpp:36
double * el
Definition: OSGeneral.h:621
int numberOfNonlinearExpressions
numberOfNonlinearExpressions is the number of &lt;nl&gt; elements in the &lt;nonlinearExpressions&gt; element...
Definition: OSInstance.h:466
int numberOfObjCoef
numberOfObjCoef is the number of variables with a nonzero objective function coefficient ...
Definition: OSInstance.h:172
virtual std::string getNonlinearExpressionInXML()
The following method writes an OSnLNode or OSnLMNode in OSiL format.
Definition: OSnLNode.cpp:221
int numberOfQuadraticTerms
numberOfQuadraticTerms is the number of quadratic terms in the &lt;quadraticCoefficients&gt; element...
Definition: OSInstance.h:393
int numberOfMatrices
numberOfMatrices is the number of &lt;nl&gt; elements in the &lt;matrices&gt; element.
Definition: OSInstance.h:496
int idx
idx holds the row index of the nonlinear expression
Definition: OSInstance.h:1820
Cone ** cone
cone is pointer to an array of Cone object pointers
Definition: OSInstance.h:1549
int conReferenceMatrixIdx
conReferenceMatrixIdx allows some or all of the components of this matrixCon to be copied from constr...
Definition: OSInstance.h:1753
The in-memory representation of an OSiL instance..
Definition: OSInstance.h:2262
int ubConeIdx
ubConeIdx gives a cone that must contain ubMatrix - matrixVar
Definition: OSInstance.h:1608
QuadraticCoefficients * quadraticCoefficients
quadraticCoefficients is a pointer to a QuadraticCoefficients object
Definition: OSInstance.h:2201
int idx
idx is the index of the variable corresponding to the coefficient
Definition: OSInstance.h:123
OSMatrix ** matrix
matrix is a pointer to an array of OSMatrix object pointers
Definition: OSInstance.h:499
char varType
an optional variable type (C, B, I, D, J, S).
Definition: OSInstance.h:1616
int idx
idx is the index of the row in which the quadratic term appears
Definition: OSInstance.h:353
The in-memory representation of a product cone.
Definition: OSInstance.h:1248
LinearConstraintCoefficients * linearConstraintCoefficients
linearConstraintCoefficients is a pointer to a LinearConstraintCoefficients object ...
Definition: OSInstance.h:2196
int numberOfRows
numberOfRows gives the number of rows of this matrix
Definition: OSInstance.h:1740
int numberOfCones
numberOfCones is the number of &lt;nl&gt; elements in the &lt;cones&gt; element.
Definition: OSInstance.h:1546
double constant
constant is a value that is added to the constraint
Definition: OSInstance.h:232
int * el
Definition: OSGeneral.h:484
The NonnegativeCone Class.
Definition: OSInstance.h:609
int templateMatrixIdx
templateMatrixIdx refers to a matrix that describes the locations in this matrixVar that are allowed ...
Definition: OSInstance.h:1591
int objReferenceMatrixIdx
objReferenceMatrixIdx allows some or all of the components of this matrixObj to be copied from object...
Definition: OSInstance.h:1678
std::string name
name is the name of the constraint
Definition: OSInstance.h:229
int lbMatrixIdx
lbMatrixIdx gives a lower bound for this matrixCon
Definition: OSInstance.h:1756
The NonpositiveCone Class.
Definition: OSInstance.h:667
std::string writeStringData(std::string str)
writeStringData
std::string licence
licensing information if applicable
Definition: OSGeneral.h:60