00001
00016
00017
00018 #ifdef DEBUG
00019 #define DEBUG_OSOPTION
00020 #endif
00021
00022 #include "OSOption.h"
00023 #include "OSParameters.h"
00024 #include "OSGeneral.h"
00025 #include "OSErrorClass.h"
00026 #include "CoinFinite.hpp"
00027 #include <iostream>
00028 #include <sstream>
00029 #include <limits>
00030 #include <cstdio>
00031 #include "OSMathUtil.h"
00032
00033 using namespace std;
00034
00035 InstanceLocationOption::InstanceLocationOption():
00036 locationType ("local"),
00037 value ("")
00038 {
00039 #ifdef DEBUG_OSOPTION
00040 cout << "Inside InstanceLocationOption Constructor" << endl;
00041 #endif
00042 }
00043
00044 InstanceLocationOption::~InstanceLocationOption()
00045 {
00046 #ifdef DEBUG_OSOPTION
00047 cout << "InstanceLocationOption Destructor Called" << endl;
00048 #endif
00049 }
00050
00051
00052 ContactOption::ContactOption():
00053 transportType ("osp"),
00054 value ("")
00055 {
00056 #ifdef DEBUG_OSOPTION
00057 cout << "Inside ContactOption Constructor" << endl;
00058 #endif
00059 }
00060
00061 ContactOption::~ContactOption()
00062 {
00063 #ifdef DEBUG_OSOPTION
00064 cout << "ContactOption Destructor Called" << endl;
00065 #endif
00066 }
00067
00068
00069 OtherOption::OtherOption():
00070 name (""),
00071 value (""),
00072 description ("")
00073 {
00074 #ifdef DEBUG_OSOPTION
00075 cout << "Inside OtherOption Constructor" << endl;
00076 #endif
00077 }
00078
00079 OtherOption::~OtherOption()
00080 {
00081 #ifdef DEBUG_OSOPTION
00082 cout << "OtherOption Destructor Called" << endl;
00083 #endif
00084 }
00085
00086
00087 OtherOptions::OtherOptions():
00088 numberOfOtherOptions(0)
00089 {
00090 #ifdef DEBUG_OSOPTION
00091 cout << "Inside OtherOptions Constructor" << endl;
00092 #endif
00093 other = NULL;
00094 }
00095
00096 OtherOptions::~OtherOptions()
00097 {
00098 #ifdef DEBUG_OSOPTION
00099 cout << "OtherOptions Destructor Called" << endl;
00100 #endif
00101
00102 if (other != NULL)
00103 {
00104 int i;
00105 for (i=0; i<numberOfOtherOptions; i++)
00106 {
00107 delete other[i];
00108 other[i] = NULL;
00109 }
00110 delete[] other;
00111 other = NULL;
00112 }
00113 }
00114
00115
00116 GeneralOption::GeneralOption():
00117 serviceURI (""),
00118 serviceName (""),
00119 instanceName (""),
00120 jobID (""),
00121 solverToInvoke (""),
00122 license (""),
00123 userName (""),
00124 password ("")
00125 {
00126 #ifdef DEBUG_OSOPTION
00127 cout << "Inside GeneralOption Constructor" << endl;
00128 #endif
00129 instanceLocation = NULL;
00130 contact = NULL;
00131 otherOptions = NULL;
00132 }
00133
00134 GeneralOption::~GeneralOption()
00135 {
00136 #ifdef DEBUG_OSOPTION
00137 cout << "GeneralOption Destructor Called" << endl;
00138 #endif
00139 if (instanceLocation != NULL) delete instanceLocation;
00140 instanceLocation = NULL;
00141 if (contact != NULL) delete contact;
00142 contact = NULL;
00143 if (otherOptions != NULL) delete otherOptions;
00144 otherOptions = NULL;
00145 }
00146
00147
00148 MinDiskSpace::MinDiskSpace():
00149 unit ("byte"),
00150 description(""),
00151 value (0.0)
00152 {
00153 #ifdef DEBUG_OSOPTION
00154 cout << "Inside MinDiskSpace Constructor" << endl;
00155 #endif
00156 }
00157
00158 MinDiskSpace::~MinDiskSpace()
00159 {
00160 #ifdef DEBUG_OSOPTION
00161 cout << "MinDiskSpace Destructor Called" << endl;
00162 #endif
00163 }
00164
00165
00166 MinMemorySize::MinMemorySize():
00167 unit ("byte"),
00168 description(""),
00169 value (0.0)
00170 {
00171 #ifdef DEBUG_OSOPTION
00172 cout << "Inside MinMemorySize Constructor" << endl;
00173 #endif
00174 }
00175
00176 MinMemorySize::~MinMemorySize()
00177 {
00178 #ifdef DEBUG_OSOPTION
00179 cout << "MinMemorySize Destructor Called" << endl;
00180 #endif
00181 }
00182
00183
00184 MinCPUSpeed::MinCPUSpeed():
00185 unit ("hertz"),
00186 description(""),
00187 value (0.0)
00188 {
00189 #ifdef DEBUG_OSOPTION
00190 cout << "Inside MinCPUSpeed Constructor" << endl;
00191 #endif
00192 }
00193
00194 MinCPUSpeed::~MinCPUSpeed()
00195 {
00196 #ifdef DEBUG_OSOPTION
00197 cout << "MinCPUSpeed Destructor Called" << endl;
00198 #endif
00199 }
00200
00201 MinCPUNumber::MinCPUNumber():
00202 description(""),
00203 value (0)
00204 {
00205 #ifdef DEBUG_OSOPTION
00206 cout << "Inside MinCPUNumber Constructor" << endl;
00207 #endif
00208 }
00209
00210 MinCPUNumber::~MinCPUNumber()
00211 {
00212 #ifdef DEBUG_OSOPTION
00213 cout << "MinCPUNumber Destructor Called" << endl;
00214 #endif
00215 }
00216
00217
00218 SystemOption::SystemOption()
00219 {
00220 #ifdef DEBUG_OSOPTION
00221 cout << "Inside SystemOption Constructor" << endl;
00222 #endif
00223 minDiskSpace = NULL;
00224 minMemorySize = NULL;
00225 minCPUSpeed = NULL;
00226 minCPUNumber = NULL;
00227 otherOptions = NULL;
00228 }
00229
00230 SystemOption::~SystemOption()
00231 {
00232 #ifdef DEBUG_OSOPTION
00233 cout << "SystemOption Destructor Called" << endl;
00234 #endif
00235 if (minDiskSpace != NULL) delete minDiskSpace;
00236 minDiskSpace = NULL;
00237 if (minMemorySize != NULL) delete minMemorySize;
00238 minMemorySize = NULL;
00239 if (minCPUSpeed != NULL) delete minCPUSpeed;
00240 minCPUSpeed = NULL;
00241 if (minCPUNumber != NULL) delete minCPUNumber;
00242 minCPUNumber = NULL;
00243 if (otherOptions != NULL) delete otherOptions;
00244 otherOptions = NULL;
00245 }
00246
00247
00248 ServiceOption::ServiceOption():
00249 type ("solver")
00250 {
00251 #ifdef DEBUG_OSOPTION
00252 cout << "Inside ServiceOption Constructor" << endl;
00253 #endif
00254 otherOptions = NULL;
00255 }
00256
00257 ServiceOption::~ServiceOption()
00258 {
00259 #ifdef DEBUG_OSOPTION
00260 cout << "ServiceOption Destructor Called" << endl;
00261 #endif
00262 if (otherOptions != NULL) delete otherOptions;
00263 otherOptions = NULL;
00264 }
00265
00266
00267 JobDependencies::JobDependencies():
00268 numberOfJobIDs (0)
00269 {
00270 #ifdef DEBUG_OSOPTION
00271 cout << "Inside JobDependencies Constructor" << endl;
00272 #endif
00273 jobID = NULL;
00274 }
00275
00276 JobDependencies::~JobDependencies()
00277 {
00278 #ifdef DEBUG_OSOPTION
00279 cout << "JobDependencies Destructor Called" << endl;
00280 #endif
00281
00282 if (jobID != NULL)
00283 {
00284 delete[] jobID;
00285 jobID = NULL;
00286 }
00287 }
00288
00289
00290 DirectoriesAndFiles::DirectoriesAndFiles():
00291 numberOfPaths (0)
00292 {
00293 #ifdef DEBUG_OSOPTION
00294 cout << "Inside DirectoriesAndFiles Constructor" << endl;
00295 #endif
00296 path = NULL;
00297 }
00298
00299 DirectoriesAndFiles::~DirectoriesAndFiles()
00300 {
00301 #ifdef DEBUG_OSOPTION
00302 cout << "DirectoriesAndFiles Destructor Called" << endl;
00303 #endif
00304 if (path != NULL)
00305 {
00306 delete[] path;
00307 path = NULL;
00308 }
00309 }
00310
00311
00312 PathPair::PathPair():
00313 from (""),
00314 to (""),
00315 makeCopy (false)
00316 {
00317 #ifdef DEBUG_OSOPTION
00318 cout << "Inside PathPair Constructor" << endl;
00319 #endif
00320 }
00321
00322 PathPair::~PathPair()
00323 {
00324 #ifdef DEBUG_OSOPTION
00325 cout << "PathPair Destructor Called" << endl;
00326 #endif
00327 }
00328
00329
00330 PathPairs::PathPairs():
00331 numberOfPathPairs(0)
00332 {
00333 #ifdef DEBUG_OSOPTION
00334 cout << "Inside PathPairs Constructor" << endl;
00335 #endif
00336 pathPair = NULL;
00337 }
00338
00339 PathPairs::~PathPairs()
00340 {
00341 #ifdef DEBUG_OSOPTION
00342 cout << "PathPairs Destructor Called" << endl;
00343 #endif
00344 int i;
00345 if (pathPair != NULL)
00346 {
00347 for (i=0; i < numberOfPathPairs; i++)
00348 {
00349 delete pathPair[i];
00350 pathPair[i] = NULL;
00351 }
00352 delete[] pathPair;
00353 pathPair = NULL;
00354 }
00355 }
00356
00357
00358
00359 Processes::Processes():
00360 numberOfProcesses(0)
00361 {
00362 #ifdef DEBUG_OSOPTION
00363 cout << "Inside Processes Constructor" << endl;
00364 #endif
00365 process = NULL;
00366 }
00367
00368 Processes::~Processes()
00369 {
00370 #ifdef DEBUG_OSOPTION
00371 cout << "Processes Destructor Called" << endl;
00372 #endif
00373 if (process != NULL)
00374 {
00375 delete[] process;
00376 process = NULL;
00377 }
00378 }
00379
00380
00381 JobOption::JobOption():
00382 requestedStartTime("")
00383 {
00384 #ifdef DEBUG_OSOPTION
00385 cout << "Inside JobOption Constructor" << endl;
00386 #endif
00387 maxTime = NULL;
00388 dependencies = NULL;
00389 requiredDirectories = NULL;
00390 requiredFiles = NULL;
00391 directoriesToMake = NULL;
00392 filesToMake = NULL;
00393 inputDirectoriesToMove = NULL;
00394 inputFilesToMove = NULL;
00395 outputFilesToMove = NULL;
00396 outputDirectoriesToMove = NULL;
00397 filesToDelete = NULL;
00398 directoriesToDelete = NULL;
00399 processesToKill = NULL;
00400 otherOptions = NULL;
00401 }
00402
00403 JobOption::~JobOption()
00404 {
00405 #ifdef DEBUG_OSOPTION
00406 cout << "JobOption Destructor Called" << endl;
00407 #endif
00408 if (maxTime != NULL) delete maxTime;
00409 maxTime = NULL;
00410 if (dependencies != NULL) delete dependencies;
00411 dependencies = NULL;
00412 if (requiredDirectories != NULL) delete requiredDirectories;
00413 requiredDirectories = NULL;
00414 if (requiredFiles != NULL) delete requiredFiles;
00415 requiredFiles = NULL;
00416 if (directoriesToMake != NULL) delete directoriesToMake;
00417 directoriesToMake = NULL;
00418 if (filesToMake != NULL) delete filesToMake;
00419 filesToMake = NULL;
00420 if (inputDirectoriesToMove != NULL) delete inputDirectoriesToMove;
00421 inputDirectoriesToMove = NULL;
00422 if (inputFilesToMove != NULL) delete inputFilesToMove;
00423 inputFilesToMove = NULL;
00424 if (outputDirectoriesToMove != NULL) delete outputDirectoriesToMove;
00425 outputDirectoriesToMove = NULL;
00426 if (outputFilesToMove != NULL) delete outputFilesToMove;
00427 outputFilesToMove = NULL;
00428 if (filesToDelete != NULL) delete filesToDelete;
00429 filesToDelete = NULL;
00430 if (directoriesToDelete != NULL) delete directoriesToDelete;
00431 directoriesToDelete = NULL;
00432 if (processesToKill != NULL) delete processesToKill;
00433 processesToKill = NULL;
00434 if (otherOptions != NULL) delete otherOptions;
00435 otherOptions = NULL;
00436 }
00437
00438
00439 InitVarValue::InitVarValue():
00440 idx (-1),
00441 name (""),
00442 value (OSNaN())
00443 {
00444 #ifdef DEBUG_OSOPTION
00445 cout << "Inside InitVarValue Constructor" << endl;
00446 #endif
00447 }
00448
00449 InitVarValue::~InitVarValue()
00450 {
00451 #ifdef DEBUG_OSOPTION
00452 cout << "InitVarValue Destructor Called" << endl;
00453 #endif
00454 }
00455
00456
00457 InitVariableValues::InitVariableValues():
00458 numberOfVar (0)
00459 {
00460 #ifdef DEBUG_OSOPTION
00461 cout << "Inside InitVariableValues Constructor" << endl;
00462 #endif
00463 var = NULL;
00464 }
00465
00466 InitVariableValues::~InitVariableValues()
00467 {
00468 #ifdef DEBUG_OSOPTION
00469 cout << "InitVariableValues Destructor Called" << endl;
00470 #endif
00471 int i;
00472 if (var != NULL)
00473 {
00474 for (i=0; i < numberOfVar; i++)
00475 {
00476 delete var[i];
00477 var[i] = NULL;
00478 }
00479 delete[] var;
00480 var = NULL;
00481 }
00482 }
00483
00484
00485 InitVarValueString::InitVarValueString():
00486 idx (-1),
00487 name (""),
00488 value ("")
00489 {
00490 #ifdef DEBUG_OSOPTION
00491 cout << "Inside InitVarValueString Constructor" << endl;
00492 #endif
00493 }
00494
00495 InitVarValueString::~InitVarValueString()
00496 {
00497 #ifdef DEBUG_OSOPTION
00498 cout << "InitVarValueString Destructor Called" << endl;
00499 #endif
00500 }
00501
00502
00503 InitVariableValuesString::InitVariableValuesString():
00504 numberOfVar (0)
00505 {
00506 #ifdef DEBUG_OSOPTION
00507 cout << "Inside InitVariableValuesString Constructor" << endl;
00508 #endif
00509 var = NULL;
00510 }
00511
00512 InitVariableValuesString::~InitVariableValuesString()
00513 {
00514 #ifdef DEBUG_OSOPTION
00515 cout << "InitVariableValuesString Destructor Called" << endl;
00516 #endif
00517 int i;
00518 if (var != NULL)
00519 {
00520 for (i=0; i < numberOfVar; i++)
00521 {
00522 delete var[i];
00523 var[i] = NULL;
00524 }
00525 delete[] var;
00526 var = NULL;
00527 }
00528 }
00529
00530 InitBasStatus::InitBasStatus():
00531 idx (-1),
00532 value ("unknown")
00533 {
00534 #ifdef DEBUG_OSOPTION
00535 cout << "Inside InitBasStatus Constructor" << endl;
00536 #endif
00537 }
00538
00539 InitBasStatus::~InitBasStatus()
00540 {
00541 #ifdef DEBUG_OSOPTION
00542 cout << "InitBasStatus Destructor Called" << endl;
00543 #endif
00544 }
00545
00546
00547 InitialBasisStatus::InitialBasisStatus():
00548 numberOfVar (0)
00549 {
00550 #ifdef DEBUG_OSOPTION
00551 cout << "Inside InitialBasisStatus Constructor" << endl;
00552 #endif
00553 var = NULL;
00554 }
00555
00556 InitialBasisStatus::~InitialBasisStatus()
00557 {
00558 #ifdef DEBUG_OSOPTION
00559 cout << "InitialBasisStatus Destructor Called" << endl;
00560 #endif
00561 if (var != NULL)
00562 {
00563 int i;
00564 for (i=0; i < numberOfVar; i++)
00565 {
00566 delete var[i];
00567 var[i] = NULL;
00568 }
00569 delete[] var;
00570 var = NULL;
00571 }
00572 }
00573
00574 BranchingWeight::BranchingWeight():
00575 idx (-1),
00576 name (""),
00577 value (0.0)
00578 {
00579 #ifdef DEBUG_OSOPTION
00580 cout << "Inside BranchingWeight Constructor" << endl;
00581 #endif
00582 }
00583
00584 BranchingWeight::~BranchingWeight()
00585 {
00586 #ifdef DEBUG_OSOPTION
00587 cout << "BranchingWeight Destructor Called" << endl;
00588 #endif
00589 }
00590
00591
00592 IntegerVariableBranchingWeights::IntegerVariableBranchingWeights():
00593 numberOfVar (0)
00594 {
00595 #ifdef DEBUG_OSOPTION
00596 cout << "Inside IntegerVariableBranchingWeights Constructor" << endl;
00597 #endif
00598 var = NULL;
00599 }
00600
00601 IntegerVariableBranchingWeights::~IntegerVariableBranchingWeights()
00602 {
00603 #ifdef DEBUG_OSOPTION
00604 cout << "IntegerVariableBranchingWeights Destructor Called; numberOfVar=" << numberOfVar << endl;
00605 #endif
00606 if (var != NULL)
00607 {
00608 int i;
00609 for (i=0; i < numberOfVar; i++)
00610 {
00611 delete var[i];
00612 var[i] = NULL;
00613 }
00614 delete[] var;
00615 var = NULL;
00616 }
00617 }
00618
00619 SOSWeights::SOSWeights():
00620 sosIdx (-1),
00621 groupWeight (1.0),
00622 numberOfVar (0)
00623 {
00624 #ifdef DEBUG_OSOPTION
00625 cout << "Inside SOSWeights Constructor" << endl;
00626 #endif
00627 var = NULL;
00628 }
00629
00630 SOSWeights::~SOSWeights()
00631 {
00632 #ifdef DEBUG_OSOPTION
00633 cout << "SOSWeights Destructor Called" << endl;
00634 #endif
00635 if (var != NULL)
00636 {
00637 int i;
00638 for (i=0; i < numberOfVar; i++)
00639 {
00640 delete var[i];
00641 var[i] = NULL;
00642 }
00643 delete[] var;
00644 var = NULL;
00645 }
00646 }
00647
00648 SOSVariableBranchingWeights::SOSVariableBranchingWeights():
00649 numberOfSOS (0)
00650 {
00651 #ifdef DEBUG_OSOPTION
00652 cout << "Inside SOSVariableBranchingWeights Constructor" << endl;
00653 #endif
00654 sos = NULL;
00655 }
00656
00657 SOSVariableBranchingWeights::~SOSVariableBranchingWeights()
00658 {
00659 #ifdef DEBUG_OSOPTION
00660 cout << "SOSVariableBranchingWeights Destructor Called" << endl;
00661 #endif
00662 if (sos != NULL)
00663 {
00664 int i;
00665 for (i=0; i < numberOfSOS; i++)
00666 {
00667 delete sos[i];
00668 sos[i] = NULL;
00669 }
00670 delete[] sos;
00671 sos = NULL;
00672 }
00673 }
00674
00675 OtherVarOption::OtherVarOption():
00676 idx (0),
00677 name (""),
00678 value (""),
00679 lbValue (""),
00680 ubValue ("")
00681 {
00682 #ifdef DEBUG_OSOPTION
00683 cout << "Inside OtherVarOption Constructor" << endl;
00684 #endif
00685 }
00686
00687 OtherVarOption::~OtherVarOption()
00688 {
00689 #ifdef DEBUG_OSOPTION
00690 cout << "OtherVarOption Destructor Called" << endl;
00691 #endif
00692 }
00693
00694
00695 OtherVariableOption::OtherVariableOption():
00696 numberOfVar(0),
00697 numberOfEnumerations(0),
00698 name (""),
00699 value (""),
00700 solver(""),
00701 category (""),
00702 type ("string"),
00703 description ("")
00704 {
00705 #ifdef DEBUG_OSOPTION
00706 cout << "Inside OtherVariableOption Constructor" << endl;
00707 #endif
00708 var = NULL;
00709 enumeration = NULL;
00710 }
00711
00712 OtherVariableOption::~OtherVariableOption()
00713 {
00714 #ifdef DEBUG_OSOPTION
00715 cout << "OtherVariableOption Destructor Called" << endl;
00716 #endif
00717 if (var != NULL)
00718 {
00719 for (int i=0; i < numberOfVar; i++)
00720 {
00721 delete var[i];
00722 var[i] = NULL;
00723 }
00724 delete[] var;
00725 var = NULL;
00726 }
00727 if (enumeration != NULL)
00728 {
00729 for (int i=0; i < numberOfEnumerations; i++)
00730 {
00731 delete enumeration[i];
00732 enumeration[i] = NULL;
00733 }
00734 delete[] enumeration;
00735 enumeration = NULL;
00736 }
00737 }
00738
00739
00740 VariableOption::VariableOption():
00741 numberOfOtherVariableOptions(0)
00742 {
00743 #ifdef DEBUG_OSOPTION
00744 cout << "Inside VariableOption Constructor" << endl;
00745 #endif
00746 initialVariableValues = NULL;
00747 initialVariableValuesString = NULL;
00748 initialBasisStatus = NULL;
00749 integerVariableBranchingWeights = NULL;
00750 sosVariableBranchingWeights = NULL;
00751 other = NULL;
00752 }
00753
00754 VariableOption::~VariableOption()
00755 {
00756 #ifdef DEBUG_OSOPTION
00757 cout << "VariableOption Destructor Called" << endl;
00758 #endif
00759 if (initialVariableValues != NULL) delete initialVariableValues;
00760 initialVariableValues = NULL;
00761 if (initialVariableValuesString != NULL) delete initialVariableValuesString;
00762 initialVariableValuesString = NULL;
00763 if (initialBasisStatus != NULL) delete initialBasisStatus;
00764 initialBasisStatus = NULL;
00765 if (integerVariableBranchingWeights != NULL) delete integerVariableBranchingWeights;
00766 integerVariableBranchingWeights = NULL;
00767 if (sosVariableBranchingWeights != NULL) delete sosVariableBranchingWeights;
00768 sosVariableBranchingWeights = NULL;
00769 if (other != NULL)
00770 {
00771 int i;
00772 for (i=0; i < numberOfOtherVariableOptions; i++)
00773 {
00774 if (other[i] != NULL)
00775 delete other[i];
00776 other[i] = NULL;
00777
00778 };
00779 delete[] other;
00780 other = NULL;
00781 };
00782 }
00783
00784
00785 InitObjValue::InitObjValue():
00786 idx (-1),
00787 name (""),
00788 value (OSNaN())
00789 {
00790 #ifdef DEBUG_OSOPTION
00791 cout << "Inside InitObjValue Constructor" << endl;
00792 #endif
00793 }
00794
00795 InitObjValue::~InitObjValue()
00796 {
00797 #ifdef DEBUG_OSOPTION
00798 cout << "InitObjValue Destructor Called" << endl;
00799 #endif
00800 }
00801
00802
00803 InitObjectiveValues::InitObjectiveValues():
00804 numberOfObj (0)
00805 {
00806 #ifdef DEBUG_OSOPTION
00807 cout << "Inside InitObjectiveValues Constructor" << endl;
00808 #endif
00809 obj = NULL;
00810 }
00811
00812 InitObjectiveValues::~InitObjectiveValues()
00813 {
00814 #ifdef DEBUG_OSOPTION
00815 cout << "InitObjectiveValues Destructor Called" << endl;
00816 #endif
00817 if (obj != NULL)
00818 {
00819 int i;
00820 for (i=0; i < numberOfObj; i++)
00821 {
00822 delete obj[i];
00823 obj[i] = NULL;
00824 }
00825 delete[] obj;
00826 obj = NULL;
00827 };
00828 }
00829
00830
00831 InitObjBound::InitObjBound():
00832 idx (-1),
00833 name (""),
00834 lbValue (-OSDBL_MAX),
00835 ubValue ( OSDBL_MAX)
00836 {
00837 #ifdef DEBUG_OSOPTION
00838 cout << "Inside InitObjBound Constructor" << endl;
00839 #endif
00840 }
00841
00842 InitObjBound::~InitObjBound()
00843 {
00844 #ifdef DEBUG_OSOPTION
00845 cout << "InitObjBound Destructor Called" << endl;
00846 #endif
00847 }
00848
00849
00850 InitObjectiveBounds::InitObjectiveBounds():
00851 numberOfObj (0)
00852 {
00853 #ifdef DEBUG_OSOPTION
00854 cout << "Inside InitObjectiveBounds Constructor" << endl;
00855 #endif
00856 obj = NULL;
00857 }
00858
00859 InitObjectiveBounds::~InitObjectiveBounds()
00860 {
00861 #ifdef DEBUG_OSOPTION
00862 cout << "InitObjectiveBounds Destructor Called" << endl;
00863 #endif
00864 if (obj != NULL)
00865 {
00866 int i;
00867 for (i=0; i < numberOfObj; i++)
00868 {
00869 delete obj[i];
00870 obj[i] = NULL;
00871 }
00872 delete[] obj;
00873 obj = NULL;
00874 };
00875 }
00876
00877
00878 OtherObjOption::OtherObjOption():
00879 idx (-1),
00880 name (""),
00881 value (""),
00882 lbValue (""),
00883 ubValue ("")
00884 {
00885 #ifdef DEBUG_OSOPTION
00886 cout << "Inside OtherObjOption Constructor" << endl;
00887 #endif
00888 }
00889
00890 OtherObjOption::~OtherObjOption()
00891 {
00892 #ifdef DEBUG_OSOPTION
00893 cout << "OtherObjOption Destructor Called" << endl;
00894 #endif
00895 }
00896
00897
00898 OtherObjectiveOption::OtherObjectiveOption():
00899 numberOfObj(0),
00900 numberOfEnumerations(0),
00901 name (""),
00902 value (""),
00903 solver(""),
00904 category (""),
00905 type ("string"),
00906 description ("")
00907 {
00908 #ifdef DEBUG_OSOPTION
00909 cout << "Inside OtherObjectiveOption Constructor" << endl;
00910 #endif
00911 obj = NULL;
00912 enumeration = NULL;
00913 }
00914
00915 OtherObjectiveOption::~OtherObjectiveOption()
00916 {
00917 #ifdef DEBUG_OSOPTION
00918 cout << "OtherObjectiveOption Destructor Called" << endl;
00919 #endif
00920 if (obj != NULL)
00921 {
00922 for (int i=0; i < numberOfObj; i++)
00923 {
00924 delete obj[i];
00925 obj[i] = NULL;
00926 }
00927 delete[] obj;
00928 obj = NULL;
00929 }
00930 if (enumeration != NULL)
00931 {
00932 for (int i=0; i < numberOfEnumerations; i++)
00933 {
00934 delete enumeration[i];
00935 enumeration[i] = NULL;
00936 }
00937 delete[] enumeration;
00938 enumeration = NULL;
00939 }
00940 }
00941
00942
00943 ObjectiveOption::ObjectiveOption():
00944 numberOfOtherObjectiveOptions (0)
00945 {
00946 #ifdef DEBUG_OSOPTION
00947 cout << "Inside ObjectiveOption Constructor" << endl;
00948 #endif
00949 initialObjectiveValues = NULL;
00950 initialObjectiveBounds = NULL;
00951 initialBasisStatus = NULL;
00952 other = NULL;
00953 }
00954
00955 ObjectiveOption::~ObjectiveOption()
00956 {
00957 #ifdef DEBUG_OSOPTION
00958 cout << "ObjectiveOption Destructor Called" << endl;
00959 #endif
00960 if (initialObjectiveValues != NULL) delete initialObjectiveValues;
00961 initialObjectiveValues = NULL;
00962 if (initialObjectiveBounds != NULL) delete initialObjectiveBounds;
00963 initialObjectiveBounds = NULL;
00964 if (initialBasisStatus != NULL) delete initialBasisStatus;
00965 initialBasisStatus = NULL;
00966 if (other != NULL)
00967 {
00968 int i;
00969 for (i=0; i < numberOfOtherObjectiveOptions; i++)
00970 {
00971 delete other[i];
00972 other[i] = NULL;
00973 }
00974 delete[] other;
00975 other = NULL;
00976 }
00977 }
00978
00979
00980 InitConValue::InitConValue():
00981 idx (0),
00982 name (""),
00983 value (OSNaN())
00984 {
00985 #ifdef DEBUG_OSOPTION
00986 cout << "Inside InitConValue Constructor" << endl;
00987 #endif
00988 }
00989
00990 InitConValue::~InitConValue()
00991 {
00992 #ifdef DEBUG_OSOPTION
00993 cout << "InitConValue Destructor Called" << endl;
00994 #endif
00995 }
00996
00997
00998 InitConstraintValues::InitConstraintValues():
00999 numberOfCon (0)
01000 {
01001 #ifdef DEBUG_OSOPTION
01002 cout << "Inside InitConstraintValues Constructor" << endl;
01003 #endif
01004 con = NULL;
01005 }
01006
01007 InitConstraintValues::~InitConstraintValues()
01008 {
01009 #ifdef DEBUG_OSOPTION
01010 cout << "InitConstraintValues Destructor Called" << endl;
01011 #endif
01012 if (con != NULL)
01013 {
01014 int i;
01015 for (i=0; i < numberOfCon; i++)
01016 {
01017 delete con[i];
01018 con[i] = NULL;
01019 }
01020 delete[] con;
01021 con = NULL;
01022 };
01023 }
01024
01025
01026 InitDualVarValue::InitDualVarValue():
01027 idx (0),
01028 name (""),
01029 lbDualValue (0.0),
01030 ubDualValue (0.0)
01031 {
01032 #ifdef DEBUG_OSOPTION
01033 cout << "Inside InitDualVarValue Constructor" << endl;
01034 #endif
01035 }
01036
01037 InitDualVarValue::~InitDualVarValue()
01038 {
01039 #ifdef DEBUG_OSOPTION
01040 cout << "InitDualVarValue Destructor Called" << endl;
01041 #endif
01042 }
01043
01044
01045 InitDualVariableValues::InitDualVariableValues():
01046 numberOfCon (0)
01047 {
01048 #ifdef DEBUG_OSOPTION
01049 cout << "Inside InitDualVariableValues Constructor" << endl;
01050 #endif
01051 con = NULL;
01052 }
01053
01054 InitDualVariableValues::~InitDualVariableValues()
01055 {
01056 #ifdef DEBUG_OSOPTION
01057 cout << "InitDualVariableValues Destructor Called" << endl;
01058 #endif
01059 if (con != NULL)
01060 {
01061 int i;
01062 for (i=0; i < numberOfCon; i++)
01063 {
01064 delete con[i];
01065 con[i] = NULL;
01066 }
01067 delete[] con;
01068 con = NULL;
01069 };
01070 }
01071
01072
01073 OtherConOption::OtherConOption():
01074 idx (0),
01075 name (""),
01076 value (""),
01077 lbValue (""),
01078 ubValue ("")
01079 {
01080 #ifdef DEBUG_OSOPTION
01081 cout << "Inside OtherConOption Constructor" << endl;
01082 #endif
01083 }
01084
01085 OtherConOption::~OtherConOption()
01086 {
01087 #ifdef DEBUG_OSOPTION
01088 cout << "OtherConOption Destructor Called" << endl;
01089 #endif
01090 }
01091
01092
01093 OtherConstraintOption::OtherConstraintOption():
01094 numberOfCon(0),
01095 numberOfEnumerations(0),
01096 name (""),
01097 value (""),
01098 solver(""),
01099 category (""),
01100 type ("string"),
01101 description ("")
01102 {
01103 #ifdef DEBUG_OSOPTION
01104 cout << "Inside OtherConstraintOption Constructor" << endl;
01105 #endif
01106 con = NULL;
01107 enumeration = NULL;
01108 }
01109
01110 OtherConstraintOption::~OtherConstraintOption()
01111 {
01112 #ifdef DEBUG_OSOPTION
01113 cout << "OtherConstraintOption Destructor Called" << endl;
01114 #endif
01115 if (con != NULL)
01116 {
01117 for (int i=0; i < numberOfCon; i++)
01118 {
01119 if (con[i]!= NULL) delete con[i];
01120 con[i] = NULL;
01121 }
01122 delete[] con;
01123 con = NULL;
01124 }
01125 if (enumeration != NULL)
01126 {
01127 for (int i=0; i < numberOfEnumerations; i++)
01128 {
01129 delete enumeration[i];
01130 enumeration[i] = NULL;
01131 }
01132 delete[] enumeration;
01133 enumeration = NULL;
01134 }
01135 }
01136
01137
01138 ConstraintOption::ConstraintOption():
01139 numberOfOtherConstraintOptions (0)
01140 {
01141 #ifdef DEBUG_OSOPTION
01142 cout << "Inside ConstraintOption Constructor" << endl;
01143 #endif
01144 initialConstraintValues = NULL;
01145 initialDualValues = NULL;
01146 initialBasisStatus = NULL;
01147 other = NULL;
01148 }
01149
01150 ConstraintOption::~ConstraintOption()
01151 {
01152 #ifdef DEBUG_OSOPTION
01153 cout << "ConstraintOption Destructor Called" << endl;
01154 #endif
01155 if (initialConstraintValues != NULL) delete initialConstraintValues;
01156 initialConstraintValues = NULL;
01157 if (initialDualValues != NULL) delete initialDualValues;
01158 initialDualValues = NULL;
01159 if (initialBasisStatus != NULL) delete initialBasisStatus;
01160 initialBasisStatus = NULL;
01161 if (other != NULL)
01162 {
01163 int i;
01164 for (i=0; i < numberOfOtherConstraintOptions; i++)
01165 {
01166 delete other[i];
01167 other[i] = NULL;
01168 }
01169 delete[] other;
01170 other = NULL;
01171 }
01172 }
01173
01174
01175 SolverOption::SolverOption():
01176 name (""),
01177 value (""),
01178 solver(""),
01179 category (""),
01180 type (""),
01181 description (""),
01182 numberOfItems(0),
01183 item(NULL)
01184 {
01185 #ifdef DEBUG_OSOPTION
01186 cout << "Inside SolverOption Constructor" << endl;
01187 #endif
01188 }
01189
01190 SolverOption::~SolverOption()
01191 {
01192 #ifdef DEBUG_OSOPTION
01193 cout << "SolverOption Destructor Called" << endl;
01194 #endif
01195 if (item != NULL) delete[] item;
01196 item = NULL;
01197 }
01198
01199
01200 SolverOptions::SolverOptions():
01201 numberOfSolverOptions(0)
01202 {
01203 #ifdef DEBUG_OSOPTION
01204 cout << "Inside SolverOptions Constructor" << endl;
01205 #endif
01206 solverOption = NULL;
01207 }
01208
01209 SolverOptions::~SolverOptions()
01210 {
01211 #ifdef DEBUG_OSOPTION
01212 cout << "SolverOptions Destructor Called; numberOfSolverOptions=" << numberOfSolverOptions << endl;
01213 #endif
01214 if (solverOption != NULL)
01215 {
01216 int i;
01217 for (i=0; i<numberOfSolverOptions; i++)
01218 {
01219 delete solverOption[i];
01220 solverOption[i] = NULL;
01221 }
01222 delete[] solverOption;
01223 solverOption = NULL;
01224 }
01225 }
01226
01227
01228 OptimizationOption::OptimizationOption():
01229 numberOfVariables (-1),
01230 numberOfObjectives (-1),
01231 numberOfConstraints (-1)
01232 {
01233 #ifdef DEBUG_OSOPTION
01234 cout << "Inside OptimizationOption Constructor" << endl;
01235 #endif
01236 variables = NULL;
01237 objectives = NULL;
01238 constraints = NULL;
01239 solverOptions = NULL;
01240 }
01241
01242 OptimizationOption::~OptimizationOption()
01243 {
01244 #ifdef DEBUG_OSOPTION
01245 cout << "OptimizationOption Destructor Called" << endl;
01246 #endif
01247 if (variables != NULL) delete variables;
01248 variables = NULL;
01249 if (objectives != NULL) delete objectives;
01250 objectives = NULL;
01251 if (constraints != NULL) delete constraints;
01252 constraints = NULL;
01253 if (solverOptions != NULL) delete solverOptions;
01254 solverOptions = NULL;
01255 }
01256
01257
01258 OSOption::OSOption()
01259
01260 {
01261 #ifdef DEBUG_OSOPTION
01262 cout << "Inside OSOption Constructor" << endl;
01263 #endif
01264
01265 optionHeader = NULL;
01266 general = NULL;
01267 system = NULL;
01268 service = NULL;
01269 job = NULL;
01270 optimization = NULL;
01271 m_mdInitVarValuesDense = NULL;
01272 m_mdInitVarValuesStringDense = NULL;
01273 m_mdInitBasisStatusDense = NULL;
01274 m_mdIntegerVariableBranchingWeightsDense = NULL;
01275 m_mdInitObjValuesDense = NULL;
01276 m_mdInitObjLowerBoundsDense = NULL;
01277 m_mdInitObjUpperBoundsDense = NULL;
01278 m_mdInitConValuesDense = NULL;
01279 m_mdInitDualVarLowerBoundsDense = NULL;
01280 m_mdInitDualVarUpperBoundsDense = NULL;
01281 }
01282
01283 OSOption::~OSOption()
01284 {
01285 #ifdef DEBUG_OSOPTION
01286 cout << "OSOption Destructor Called" << endl;
01287 #endif
01288 if (optionHeader != NULL) delete optionHeader;
01289 optionHeader = NULL;
01290 if (general != NULL) delete general;
01291 general = NULL;
01292 if (system != NULL) delete system;
01293 system = NULL;
01294 if (service != NULL) delete service;
01295 service = NULL;
01296 if (job != NULL) delete job;
01297 job = NULL;
01298 if (optimization != NULL) delete optimization;
01299 optimization = NULL;
01300
01301 if (m_mdInitVarValuesDense != NULL)
01302 delete[] m_mdInitVarValuesDense;
01303 m_mdInitVarValuesDense = NULL;
01304
01305 if (m_mdInitVarValuesStringDense != NULL)
01306 delete[] m_mdInitVarValuesStringDense;
01307 m_mdInitVarValuesStringDense = NULL;
01308
01309 if (m_mdInitBasisStatusDense != NULL)
01310 delete[] m_mdInitBasisStatusDense;
01311 m_mdInitBasisStatusDense = NULL;
01312
01313 if (m_mdIntegerVariableBranchingWeightsDense != NULL)
01314 delete[] m_mdIntegerVariableBranchingWeightsDense;
01315 m_mdIntegerVariableBranchingWeightsDense = NULL;
01316
01317 if (m_mdInitObjValuesDense != NULL)
01318 delete[] m_mdInitObjValuesDense;
01319 m_mdInitObjValuesDense = NULL;
01320
01321 if (m_mdInitObjLowerBoundsDense != NULL)
01322 delete[] m_mdInitObjLowerBoundsDense;
01323 m_mdInitObjLowerBoundsDense = NULL;
01324
01325 if (m_mdInitObjUpperBoundsDense != NULL)
01326 delete[] m_mdInitObjUpperBoundsDense;
01327 m_mdInitObjUpperBoundsDense = NULL;
01328
01329 if (m_mdInitConValuesDense != NULL)
01330 delete[] m_mdInitConValuesDense;
01331 m_mdInitConValuesDense = NULL;
01332
01333 if (m_mdInitDualVarLowerBoundsDense != NULL)
01334 delete[] m_mdInitDualVarLowerBoundsDense;
01335 m_mdInitDualVarLowerBoundsDense = NULL;
01336
01337 if (m_mdInitDualVarUpperBoundsDense != NULL)
01338 delete[] m_mdInitDualVarUpperBoundsDense;
01339 m_mdInitDualVarUpperBoundsDense = NULL;
01340 }
01341
01342
01343
01344
01345
01346
01347
01348
01349
01350
01351
01352
01356 std::string OSOption::getFileName()
01357 {
01358 if (this->optionHeader != NULL)
01359 return this->optionHeader->name;
01360
01361 return "";
01362 }
01363
01367 std::string OSOption::getFileSource()
01368 {
01369 if (this->optionHeader != NULL)
01370 return this->optionHeader->source;
01371
01372 return "";
01373 }
01374
01378 std::string OSOption::getFileDescription()
01379 {
01380 if (this->optionHeader != NULL)
01381 return this->optionHeader->description;
01382
01383 return "";
01384 }
01385
01389 std::string OSOption::getFileCreator()
01390 {
01391 if (this->optionHeader != NULL)
01392 return this->optionHeader->fileCreator;
01393
01394 return "";
01395 }
01396
01400 std::string OSOption::getFileLicence()
01401 {
01402 if (this->optionHeader != NULL)
01403 return this->optionHeader->licence;
01404
01405 return "";
01406 }
01407
01408
01412 std::string OSOption::getServiceURI()
01413 {
01414 if (this->general != NULL)
01415 return this->general->serviceURI;
01416
01417 return "";
01418 }
01419
01423 std::string OSOption::getServiceName()
01424 {
01425 if (this->general != NULL)
01426 return this->general->serviceName;
01427
01428 return "";
01429 }
01430
01434 std::string OSOption::getInstanceName()
01435 {
01436 if (this->general != NULL)
01437 return this->general->instanceName;
01438
01439 return "";
01440 }
01441
01445 std::string OSOption::getInstanceLocation()
01446 {
01447 if (this->general != NULL)
01448 if (this->general->instanceLocation != NULL)
01449 return this->general->instanceLocation->value;
01450
01451 return "";
01452 }
01453
01457 std::string OSOption::getInstanceLocationType()
01458 {
01459 if (this->general != NULL)
01460 if (this->general->instanceLocation != NULL)
01461 return this->general->instanceLocation->locationType;
01462
01463 return "";
01464 }
01465
01469 std::string OSOption::getJobID()
01470 {
01471 if (this->general != NULL)
01472 return this->general->jobID;
01473
01474 return "";
01475 }
01476
01480 std::string OSOption::getSolverToInvoke()
01481 {
01482 if (this->general != NULL)
01483 return this->general->solverToInvoke;
01484
01485 return "";
01486 }
01487
01491 std::string OSOption::getLicense()
01492 {
01493 if (this->general != NULL)
01494 return this->general->license;
01495
01496 return "";
01497 }
01498
01502 std::string OSOption::getUserName()
01503 {
01504 if (this->general != NULL)
01505 return this->general->userName;
01506
01507 return "";
01508 }
01509
01513 std::string OSOption::getPassword()
01514 {
01515 if (this->general != NULL)
01516 return this->general->password;
01517
01518 return "";
01519 }
01520
01524 std::string OSOption::getContact()
01525 {
01526 if (this->general != NULL)
01527 if (this->general->contact != NULL)
01528 return this->general->contact->value;
01529
01530 return "";
01531 }
01532
01536 std::string OSOption::getContactTransportType()
01537 {
01538 if (this->general != NULL)
01539 if (this->general->contact != NULL)
01540 return this->general->contact->transportType;
01541
01542 return "";
01543 }
01544
01548 std::string OSOption::getMinDiskSpaceUnit()
01549 {
01550 if (this->system != NULL)
01551 if (this->system->minDiskSpace != NULL)
01552 return this->system->minDiskSpace->unit;
01553
01554 return "";
01555 }
01556
01560 std::string OSOption::getMinDiskSpaceDescription()
01561 {
01562 if (this->system != NULL)
01563 if (this->system->minDiskSpace != NULL)
01564 return this->system->minDiskSpace->description;
01565
01566 return "";
01567 }
01568
01572 std::string OSOption::getMinMemoryUnit()
01573 {
01574 if (this->system != NULL)
01575 if (this->system->minMemorySize != NULL)
01576 return this->system->minMemorySize->unit;
01577
01578 return "";
01579 }
01580
01584 std::string OSOption::getMinMemoryDescription()
01585 {
01586 if (this->system != NULL)
01587 if (this->system->minMemorySize != NULL)
01588 return this->system->minMemorySize->description;
01589
01590 return "";
01591 }
01592
01596 std::string OSOption::getMinCPUSpeedUnit()
01597 {
01598 if (this->system != NULL)
01599 if (this->system->minCPUSpeed != NULL)
01600 return this->system->minCPUSpeed->unit;
01601
01602 return "";
01603 }
01604
01608 std::string OSOption::getMinCPUSpeedDescription()
01609 {
01610 if (this->system != NULL)
01611 if (this->system->minCPUSpeed != NULL)
01612 return this->system->minCPUSpeed->description;
01613
01614 return "";
01615 }
01616
01620 std::string OSOption::getMinCPUNumberDescription()
01621 {
01622 if (this->system != NULL)
01623 if (this->system->minCPUNumber != NULL)
01624 return this->system->minCPUNumber->description;
01625
01626 return "";
01627 }
01628
01632 std::string OSOption::getServiceType()
01633 {
01634 if (this->service != NULL)
01635 return this->service->type;
01636
01637 return "";
01638 }
01639
01643 std::string OSOption::getMaxTimeUnit()
01644 {
01645 if (this->job != NULL)
01646 if (this->job->maxTime != NULL)
01647 return this->job->maxTime->unit;
01648
01649 return "";
01650 }
01651
01655 std::string OSOption::getRequestedStartTime()
01656 {
01657 if (this->job != NULL)
01658 return this->job->requestedStartTime;
01659
01660 return "";
01661 }
01662
01669 std::string OSOption::getOptionStr(std::string optionName)
01670 {
01671 if (optionName == "serviceURI")
01672 return this->getServiceURI();
01673
01674 if (optionName == "serviceName")
01675 return this->getServiceName();
01676
01677 if (optionName == "instanceName")
01678 return this->getInstanceName();
01679
01680 if (optionName == "instanceLocation")
01681 return this->getInstanceLocation();
01682
01683 if (optionName == "instanceLocationType")
01684 return this->getInstanceLocationType();
01685
01686 if (optionName == "jobID")
01687 return this->getJobID();
01688
01689 if (optionName == "solverToInvoke")
01690 return this->getSolverToInvoke();
01691
01692 if (optionName == "license")
01693 return this->getLicense();
01694
01695 if (optionName == "userName")
01696 return this->getUserName();
01697
01698 if (optionName == "password")
01699 return this->getPassword();
01700
01701 if (optionName == "contact")
01702 return this->getContact();
01703
01704 if (optionName == "contactTransportType")
01705 return this->getContactTransportType();
01706
01707 if (optionName == "minDiskSpaceUnit")
01708 return this->getMinDiskSpaceUnit();
01709
01710 if (optionName == "minMemoryUnit")
01711 return this->getMinMemoryUnit();
01712
01713 if (optionName == "minCPUSpeedUnit")
01714 return this->getMinCPUSpeedUnit();
01715
01716 if (optionName == "serviceType")
01717 return this->getServiceType();
01718
01719 if (optionName == "maxTimeUnit")
01720 return this->getMaxTimeUnit();
01721
01722 if (optionName == "requestedStartTime")
01723 return this->getRequestedStartTime();
01724
01725 return "";
01726 }
01727
01728
01729
01730
01731
01735 double OSOption::getMinDiskSpace()
01736 {
01737 if (this->system != NULL)
01738 if (this->system->minDiskSpace != NULL)
01739 return this->system->minDiskSpace->value;
01740
01741 return 0;
01742 }
01743
01747 double OSOption::getMinMemorySize()
01748 {
01749 if (this->system != NULL)
01750 if (this->system->minMemorySize != NULL)
01751 return this->system->minMemorySize->value;
01752
01753 return 0;
01754 }
01755
01759 double OSOption::getMinCPUSpeed()
01760 {
01761 if (this->system != NULL)
01762 if (this->system->minCPUSpeed != NULL)
01763 return this->system->minCPUSpeed->value;
01764
01765 return 0;
01766 }
01767
01771 double OSOption::getMaxTime()
01772 {
01773 if (this->job != NULL)
01774 if (this->job->maxTime != NULL)
01775 return job->maxTime->value;
01776
01777 return 0;
01778 }
01779
01786 double OSOption::getOptionDbl(std::string optionName)
01787 {
01788 if (optionName == "minDiskSpace")
01789 return this->getMinDiskSpace();
01790
01791 if (optionName == "minMemory")
01792 return this->getMinMemorySize();
01793
01794 if (optionName == "minCPUSpeed")
01795 return this->getMinCPUSpeed();
01796
01797 if (optionName == "maxTime")
01798 return this->getMaxTime();
01799
01800 return 0;
01801 }
01802
01810 int OSOption::getMinCPUNumber()
01811 {
01812 if (this->system != NULL)
01813 return this->system->minCPUNumber->value;
01814
01815 return 0;
01816 }
01817
01821 int OSOption::getNumberOfOtherGeneralOptions()
01822 {
01823 if (this->general != NULL)
01824 if (this->general->otherOptions != NULL)
01825 return this->general->otherOptions->numberOfOtherOptions;
01826
01827 return 0;
01828 }
01829
01833 int OSOption::getNumberOfOtherSystemOptions()
01834 {
01835 if (this->system != NULL)
01836 if (this->system->otherOptions != NULL)
01837 return this->system->otherOptions->numberOfOtherOptions;
01838
01839 return 0;
01840 }
01841
01845 int OSOption::getNumberOfOtherServiceOptions()
01846 {
01847 if (this->service != NULL)
01848 if (this->service->otherOptions != NULL)
01849 return this->service->otherOptions->numberOfOtherOptions;
01850
01851 return 0;
01852 }
01853
01857 int OSOption::getNumberOfOtherJobOptions()
01858 {
01859 if (this->job != NULL)
01860 if (this->job->otherOptions != NULL)
01861 return this->job->otherOptions->numberOfOtherOptions;
01862
01863 return 0;
01864 }
01865
01869 int OSOption::getNumberOfJobDependencies()
01870 {
01871 if (this->job != NULL)
01872 if (this->job->dependencies != NULL)
01873 return this->job->dependencies->numberOfJobIDs;
01874
01875 return 0;
01876 }
01877
01881 int OSOption::getNumberOfRequiredDirectories()
01882 {
01883 if (this->job != NULL)
01884 if (this->job->requiredDirectories != NULL)
01885 return this->job->requiredDirectories->numberOfPaths;
01886
01887 return 0;
01888 }
01889
01893 int OSOption::getNumberOfRequiredFiles()
01894 {
01895 if (this->job != NULL)
01896 if (this->job->requiredFiles != NULL)
01897 return this->job->requiredFiles->numberOfPaths;
01898
01899 return 0;
01900 }
01901
01905 int OSOption::getNumberOfDirectoriesToMake()
01906 {
01907 if (this->job != NULL)
01908 if (this->job->directoriesToMake != NULL)
01909 return this->job->directoriesToMake->numberOfPaths;
01910
01911 return 0;
01912 }
01913
01917 int OSOption::getNumberOfFilesToMake()
01918 {
01919 if (this->job != NULL)
01920 if (this->job->filesToMake != NULL)
01921 return this->job->filesToMake->numberOfPaths;
01922
01923 return 0;
01924 }
01925
01929 int OSOption::getNumberOfInputDirectoriesToMove()
01930 {
01931 if (this->job != NULL)
01932 if (this->job->inputDirectoriesToMove != NULL)
01933 return this->job->inputDirectoriesToMove->numberOfPathPairs;
01934
01935 return 0;
01936 }
01937
01941 int OSOption::getNumberOfInputFilesToMove()
01942 {
01943 if (this->job != NULL)
01944 if (this->job->inputFilesToMove != NULL)
01945 return this->job->inputFilesToMove->numberOfPathPairs;
01946
01947 return 0;
01948 }
01949
01953 int OSOption::getNumberOfOutputDirectoriesToMove()
01954 {
01955 if (this->job != NULL)
01956 if (this->job->outputDirectoriesToMove != NULL)
01957 return this->job->outputDirectoriesToMove->numberOfPathPairs;
01958
01959 return 0;
01960 }
01961
01965 int OSOption::getNumberOfOutputFilesToMove()
01966 {
01967 if (this->job != NULL)
01968 if (this->job->outputFilesToMove != NULL)
01969 return this->job->outputFilesToMove->numberOfPathPairs;
01970
01971 return 0;
01972 }
01973
01977 int OSOption::getNumberOfFilesToDelete()
01978 {
01979 if (this->job != NULL)
01980 if (this->job->filesToDelete != NULL)
01981 return this->job->filesToDelete->numberOfPaths;
01982
01983 return 0;
01984 }
01985
01989 int OSOption::getNumberOfDirectoriesToDelete()
01990 {
01991 if (this->job != NULL)
01992 if (this->job->directoriesToDelete != NULL)
01993 return this->job->directoriesToDelete->numberOfPaths;
01994
01995 return 0;
01996 }
01997
02001 int OSOption::getNumberOfProcessesToKill()
02002 {
02003 if (this->job != NULL)
02004 if (this->job->processesToKill != NULL)
02005 return this->job->processesToKill->numberOfProcesses;
02006
02007 return 0;
02008 }
02009
02013 int OSOption::getNumberOfVariables()
02014 {
02015 if (this->optimization != NULL)
02016 return this->optimization->numberOfVariables;
02017
02018 return -1;
02019 }
02020
02024 int OSOption::getNumberOfObjectives()
02025 {
02026 if (this->optimization != NULL)
02027 return this->optimization->numberOfObjectives;
02028
02029 return -1;
02030 }
02031
02035 int OSOption::getNumberOfConstraints()
02036 {
02037 if (this->optimization != NULL)
02038 return this->optimization->numberOfConstraints;
02039
02040 return -1;
02041 }
02042
02043
02047 int OSOption::getNumberOfInitVarValues()
02048 {
02049 if (this->optimization != NULL)
02050 {
02051 if (this->optimization->variables != NULL)
02052 {
02053 if (this->optimization->variables->initialVariableValues != NULL)
02054 {
02055 return this->optimization->variables->initialVariableValues->numberOfVar;
02056 }
02057 }
02058 }
02059 return -1;
02060 }
02061
02065 int OSOption::getNumberOfInitVarValuesString()
02066 {
02067 if (this->optimization != NULL)
02068 if (this->optimization->variables != NULL)
02069 if (this->optimization->variables->initialVariableValuesString != NULL)
02070 return this->optimization->variables->initialVariableValuesString->numberOfVar;
02071 return -1;
02072 }
02073
02074
02078 int OSOption::getNumberOfIntegerVariableBranchingWeights()
02079 {
02080 if (this->optimization != NULL)
02081 if (this->optimization->variables != NULL)
02082 if (this->optimization->variables->integerVariableBranchingWeights != NULL)
02083 return this->optimization->variables->integerVariableBranchingWeights->numberOfVar;
02084 return -1;
02085 }
02086
02090 int OSOption::getNumberOfSOS()
02091 {
02092 if (this->optimization != NULL)
02093 if (this->optimization->variables != NULL)
02094 if (this->optimization->variables->sosVariableBranchingWeights != NULL)
02095 return this->optimization->variables->sosVariableBranchingWeights->numberOfSOS;
02096 return -1;
02097 }
02098
02102 int OSOption::getNumberOfSOSVarBranchingWeights(int iSOS)
02103 {
02104 if (this->optimization != NULL)
02105 if (this->optimization->variables != NULL)
02106 if (this->optimization->variables->sosVariableBranchingWeights != NULL)
02107 {
02108 if (iSOS >= 0 && iSOS < this->optimization->variables->sosVariableBranchingWeights->numberOfSOS)
02109 if (this->optimization->variables->sosVariableBranchingWeights->sos[iSOS] != NULL)
02110 return this->optimization->variables->sosVariableBranchingWeights->sos[iSOS]->numberOfVar;
02111 }
02112 return -1;
02113 }
02114
02118 int OSOption::getNumberOfOtherVariableOptions()
02119 {
02120 if (this->optimization != NULL)
02121 if (this->optimization->variables != NULL)
02122 return this->optimization->variables->numberOfOtherVariableOptions;
02123
02124 return 0;
02125 }
02126
02130 int OSOption::getNumberOfInitObjValues()
02131 {
02132 if (this->optimization != NULL)
02133 if (this->optimization->objectives != NULL)
02134 if (this->optimization->objectives->initialObjectiveValues != NULL)
02135 return this->optimization->objectives->initialObjectiveValues->numberOfObj;
02136
02137 return -1;
02138 }
02139
02143 int OSOption::getNumberOfInitObjBounds()
02144 {
02145 if (this->optimization != NULL)
02146 if (this->optimization->objectives != NULL)
02147 if (this->optimization->objectives->initialObjectiveBounds != NULL)
02148 return this->optimization->objectives->initialObjectiveBounds->numberOfObj;
02149 return -1;
02150 }
02151
02155 int OSOption::getNumberOfOtherObjectiveOptions()
02156 {
02157 if (this->optimization != NULL)
02158 if (this->optimization->objectives != NULL)
02159 return this->optimization->objectives->numberOfOtherObjectiveOptions;
02160 return 0;
02161 }
02162
02166 int OSOption::getNumberOfInitConValues()
02167 {
02168 if (this->optimization != NULL)
02169 if (this->optimization->constraints != NULL)
02170 if (this->optimization->constraints->initialConstraintValues != NULL)
02171 return this->optimization->constraints->initialConstraintValues->numberOfCon;
02172 return -1;
02173 }
02174
02178 int OSOption::getNumberOfInitDualVarValues()
02179 {
02180 if (this->optimization != NULL)
02181 if (this->optimization->constraints != NULL)
02182 if (this->optimization->constraints->initialDualValues != NULL)
02183 return this->optimization->constraints->initialDualValues->numberOfCon;
02184
02185 return -1;
02186 }
02187
02191 int OSOption::getNumberOfOtherConstraintOptions()
02192 {
02193 if (this->optimization != NULL)
02194 if (this->optimization->constraints != NULL)
02195 return this->optimization->constraints->numberOfOtherConstraintOptions;
02196
02197 return -1;
02198 }
02199
02203 int OSOption::getNumberOfSolverOptions()
02204 {
02205 if (this->optimization != NULL)
02206 if (this->optimization->solverOptions != NULL)
02207 return this->optimization->solverOptions->numberOfSolverOptions;
02208
02209 return -1;
02210 }
02211
02218 int OSOption::getOptionInt(std::string optionName)
02219 {
02220 if (optionName == "minCPUNumber")
02221 return this->getMinCPUNumber();
02222
02223 if (optionName == "numberOfOtherGeneralOptions")
02224 return this->getNumberOfOtherGeneralOptions();
02225
02226 if (optionName == "numberOfOtherSystemOptions")
02227 return this->getNumberOfOtherSystemOptions();
02228
02229 if (optionName == "numberOfOtherServiceOptions")
02230 return this->getNumberOfOtherServiceOptions();
02231
02232 if (optionName == "numberOfOtherJobOptions")
02233 return this->getNumberOfOtherJobOptions();
02234
02235 if (optionName == "numberOfJobDependencies")
02236 return this->getNumberOfJobDependencies();
02237
02238 if (optionName == "numberOfRequiredDirectories")
02239 return this->getNumberOfRequiredDirectories();
02240
02241 if (optionName == "numberOfRequiredFiles")
02242 return this->getNumberOfRequiredFiles();
02243
02244 if (optionName == "numberOfDirectoriesToMake")
02245 return this->getNumberOfDirectoriesToMake();
02246
02247 if (optionName == "numberOfFilesToMake")
02248 return this->getNumberOfFilesToMake();
02249
02250 if (optionName == "numberOfInputDirectoriesToMove")
02251 return this->getNumberOfInputDirectoriesToMove();
02252
02253 if (optionName == "numberOfInputFilesToMove")
02254 return this->getNumberOfInputFilesToMove();
02255
02256 if (optionName == "numberOfOutputDirectoriesToMove")
02257 return this->getNumberOfOutputDirectoriesToMove();
02258
02259 if (optionName == "numberOfOutputFilesToMove")
02260 return this->getNumberOfOutputFilesToMove();
02261
02262 if (optionName == "numberOfFilesToDelete")
02263 return this->getNumberOfFilesToDelete();
02264
02265 if (optionName == "numberOfDirectoriesToDelete")
02266 return this->getNumberOfDirectoriesToDelete();
02267
02268 if (optionName == "numberOfProcessesToKill")
02269 return this->getNumberOfProcessesToKill();
02270
02271 if (optionName == "numberOfVariables")
02272 return this->getNumberOfVariables();
02273
02274 if (optionName == "numberOfObjectives")
02275 return this->getNumberOfObjectives();
02276
02277 if (optionName == "numberOfConstraints")
02278 return this->getNumberOfConstraints();
02279
02280 if (optionName == "numberOfInitVarValues")
02281 return this->getNumberOfInitVarValues();
02282
02283 if (optionName == "numberOfInitVarValuesString")
02284 return this->getNumberOfInitVarValuesString();
02285
02286 if (optionName == "numberOfIntegerVariableBranchingWeights")
02287 return this->getNumberOfIntegerVariableBranchingWeights();
02288
02289 if (optionName == "numberOfSOS")
02290 return this->getNumberOfSOS();
02291
02292 if (optionName == "numberOfOtherVariableOptions")
02293 return this->getNumberOfOtherVariableOptions();
02294
02295 if (optionName == "numberOfInitObjValues")
02296 return this->getNumberOfInitObjValues();
02297
02298 if (optionName == "numberOfInitObjBounds")
02299 return this->getNumberOfInitObjBounds();
02300
02301 if (optionName == "numberOfOtherObjectiveOptions")
02302 return this->getNumberOfOtherObjectiveOptions();
02303
02304 if (optionName == "numberOfInitConValues")
02305 return this->getNumberOfInitConValues();
02306
02307 if (optionName == "numberOfInitDualVarValues")
02308 return this->getNumberOfInitDualVarValues();
02309
02310 if (optionName == "numberOfOtherConstraintOptions")
02311 return this->getNumberOfOtherConstraintOptions();
02312
02313 if (optionName == "numberOfSolverOptions")
02314 return this->getNumberOfSolverOptions();
02315
02316 return -1;
02317 }
02318
02319
02320
02321
02322
02323
02327 OtherOption** OSOption::getOtherGeneralOptions()
02328 {
02329 if (this->general != NULL)
02330 {
02331 if (this->general->otherOptions != NULL)
02332 return this->general->otherOptions->other;
02333 }
02334 return NULL;
02335 }
02336
02340 OtherOption** OSOption::getOtherSystemOptions()
02341 {
02342 if (this->system != NULL)
02343 {
02344 if (this->system->otherOptions != NULL)
02345 return this->system->otherOptions->other;
02346 }
02347 return NULL;
02348 }
02349
02353 OtherOption** OSOption::getOtherServiceOptions()
02354 {
02355 if (this->service != NULL)
02356 {
02357 if (this->service->otherOptions != NULL)
02358 return this->service->otherOptions->other;
02359 }
02360 return NULL;
02361 }
02362
02366 OtherOption** OSOption::getOtherJobOptions()
02367 {
02368 if (this->job != NULL)
02369 {
02370 if (this->job->otherOptions != NULL)
02371 return this->job->otherOptions->other;
02372 }
02373 return NULL;
02374 }
02375
02382 OtherOption** OSOption::getOtherOptions(std::string category)
02383 {
02384 if (category == "general")
02385 return this->getOtherGeneralOptions();
02386
02387 if (category == "system")
02388 return this->getOtherSystemOptions();
02389
02390 if (category == "service")
02391 return this->getOtherServiceOptions();
02392
02393 if (category == "job")
02394 return this->getOtherJobOptions();
02395
02396 return NULL;
02397 }
02398
02402 OtherOption** OSOption::getAllOtherOptions()
02403 {
02404 OtherOption** optionVector = NULL;
02405 int prev_options[4];
02406 int num_options[4];
02407 int num_opt;
02408 int i;
02409
02410 for (i = 0; i < 4; i++)
02411 {
02412 prev_options[i] = 0;
02413 num_options[i] = 0;
02414 }
02415 if (this->general != NULL)
02416 {
02417 if (this->general->otherOptions != NULL)
02418 {
02419 num_opt = this->getNumberOfOtherGeneralOptions();
02420 num_options[0] = num_opt;
02421 }
02422 }
02423
02424 if (this->system != NULL)
02425 {
02426 if (this->system->otherOptions != NULL)
02427 {
02428 num_opt = this->getNumberOfOtherSystemOptions();
02429 num_options[1] = num_opt;
02430 }
02431 }
02432 prev_options[1] = prev_options[0] + num_options[0];
02433
02434 if (this->service != NULL)
02435 {
02436 if (this->service->otherOptions != NULL)
02437 {
02438 num_opt = this->getNumberOfOtherServiceOptions();
02439 num_options[2] = num_opt;
02440 }
02441 }
02442 prev_options[2] = prev_options[1] + num_options[1];
02443
02444 if (this->job != NULL)
02445 {
02446 if (this->job->otherOptions != NULL)
02447 {
02448 num_opt = this->getNumberOfOtherJobOptions();
02449 num_options[3] = num_opt;
02450 }
02451 }
02452 prev_options[3] = prev_options[2] + num_options[2];
02453
02454 num_opt = num_options[0] + num_options[1] + num_options[2] + num_options[3];
02455 optionVector = new OtherOption*[num_opt];
02456
02457 if (num_options[0] > 0)
02458 {
02459 for (i = 0; i < num_options[0]; i++)
02460 {
02461 optionVector[prev_options[0] + i] = this->general->otherOptions->other[i];
02462 }
02463 }
02464
02465 if (num_options[1] > 0)
02466 {
02467 for (i = 0; i < num_options[1]; i++)
02468 {
02469 optionVector[prev_options[1] + i] = this->system->otherOptions->other[i];
02470 }
02471 }
02472
02473 if (num_options[2] > 0)
02474 {
02475 for (i = 0; i < num_options[2]; i++)
02476 {
02477 optionVector[prev_options[2] + i] = this->service->otherOptions->other[i];
02478 }
02479 }
02480
02481 if (num_options[3] > 0)
02482 {
02483 for (i = 0; i < num_options[3]; i++)
02484 {
02485 optionVector[prev_options[3] + i] = this->job->otherOptions->other[i];
02486 }
02487 }
02488
02489 return optionVector;
02490 }
02491
02495 std::string* OSOption::getJobDependencies()
02496 {
02497 std::string* dependenciesVector = NULL;
02498 if (this->job != NULL)
02499 {
02500 if (this->job->dependencies != NULL)
02501 dependenciesVector = this->job->dependencies->jobID;
02502 else
02503 throw ErrorClass("<dependencies> object must be defined before getting the jobIDs");
02504 }
02505 else
02506 throw ErrorClass("<job> object must be defined before getting the jobIDs");
02507
02508 return dependenciesVector;
02509 }
02510
02514 std::string* OSOption::getRequiredDirectories()
02515 {
02516 std::string* pathVector = NULL;
02517 if (this->job != NULL)
02518 {
02519 if (this->job->requiredDirectories != NULL)
02520 pathVector = this->job->requiredDirectories->path;
02521 else
02522 throw ErrorClass("<requiredDirectories> object must be defined before getting the paths");
02523 }
02524 else
02525 throw ErrorClass("<job> object must be defined before getting the paths");
02526 return pathVector;
02527 }
02528
02532 std::string* OSOption::getRequiredFiles()
02533 {
02534 std::string* pathVector = NULL;
02535 if (this->job != NULL)
02536 {
02537 if (this->job->requiredFiles != NULL)
02538 pathVector = this->job->requiredFiles->path;
02539 else
02540 throw ErrorClass("<requiredFiles> object must be defined before getting the paths");
02541 }
02542 else
02543 throw ErrorClass("<job> object must be defined before getting the paths");
02544 return pathVector;
02545 }
02546
02550 std::string* OSOption::getDirectoriesToMake()
02551 {
02552 std::string* pathVector = NULL;
02553 if (this->job != NULL)
02554 {
02555 if (this->job->directoriesToMake != NULL)
02556 pathVector = this->job->directoriesToMake->path;
02557 else
02558 throw ErrorClass("<directoriesToMake> object must be defined before getting the paths");
02559 }
02560 else
02561 throw ErrorClass("<job> object must be defined before getting the paths");
02562 return pathVector;
02563 }
02564
02568 std::string* OSOption::getFilesToMake()
02569 {
02570 std::string* pathVector = NULL;
02571 if (this->job != NULL)
02572 {
02573 if (this->job->filesToMake != NULL)
02574 pathVector = this->job->filesToMake->path;
02575 else
02576 throw ErrorClass("<filesToMake> object must be defined before getting the paths");
02577 }
02578 else
02579 throw ErrorClass("<job> object must be defined before getting the paths");
02580 return pathVector;
02581 }
02582
02586 PathPair** OSOption::getInputDirectoriesToMove()
02587 {
02588 PathPair** pathPairVector = NULL;
02589 if (this->job != NULL)
02590 {
02591 if (this->job->inputDirectoriesToMove != NULL)
02592 pathPairVector = this->job->inputDirectoriesToMove->pathPair;
02593 else
02594 throw ErrorClass("<inputDirectoriesToMove> object must be defined before getting the paths");
02595 }
02596 else
02597 throw ErrorClass("<job> object must be defined before getting the paths");
02598 return pathPairVector;
02599 }
02600
02604 PathPair** OSOption::getInputFilesToMove()
02605 {
02606 PathPair** pathPairVector = NULL;
02607 if (this->job != NULL)
02608 {
02609 if (this->job->inputFilesToMove != NULL)
02610 pathPairVector = this->job->inputFilesToMove->pathPair;
02611 else
02612 throw ErrorClass("<inputFilesToMove> object must be defined before getting the paths");
02613 }
02614 else
02615 throw ErrorClass("<job> object must be defined before getting the paths");
02616 return pathPairVector;
02617 }
02618
02622 PathPair** OSOption::getOutputFilesToMove()
02623 {
02624 PathPair** pathPairVector = NULL;
02625 if (this->job != NULL)
02626 {
02627 if (this->job->outputFilesToMove != NULL)
02628 pathPairVector = this->job->outputFilesToMove->pathPair;
02629 else
02630 throw ErrorClass("<outputFilesToMove> object must be defined before getting the paths");
02631 }
02632 else
02633 throw ErrorClass("<job> object must be defined before getting the paths");
02634 return pathPairVector;
02635 }
02636
02640 PathPair** OSOption::getOutputDirectoriesToMove()
02641 {
02642 PathPair** pathPairVector = NULL;
02643 if (this->job != NULL)
02644 {
02645 if (this->job->outputDirectoriesToMove != NULL)
02646 pathPairVector = this->job->outputDirectoriesToMove->pathPair;
02647 else
02648 throw ErrorClass("<outputDirectoriesToMove> object must be defined before getting the paths");
02649 }
02650 else
02651 throw ErrorClass("<job> object must be defined before getting the paths");
02652 return pathPairVector;
02653 }
02654
02658 std::string* OSOption::getFilesToDelete()
02659 {
02660 std::string* pathVector = NULL;
02661 if (this->job != NULL)
02662 {
02663 if (this->job->filesToDelete != NULL)
02664 pathVector = this->job->filesToDelete->path;
02665 else
02666 throw ErrorClass("<filesToDelete> object must be defined before getting the paths");
02667 }
02668 else
02669 throw ErrorClass("<job> object must be defined before getting the paths");
02670 return pathVector;
02671 }
02672
02676 std::string* OSOption::getDirectoriesToDelete()
02677 {
02678 std::string* pathVector = NULL;
02679 if (this->job != NULL)
02680 {
02681 if (this->job->directoriesToDelete != NULL)
02682 pathVector = this->job->directoriesToDelete->path;
02683 else
02684 throw ErrorClass("<directoriesToDelete> object must be defined before getting the paths");
02685 }
02686 else
02687 throw ErrorClass("<job> object must be defined before getting the paths");
02688 return pathVector;
02689 }
02690
02694 std::string* OSOption::getProcessesToKill()
02695 {
02696 std::string* processes = NULL;
02697 if (this->job != NULL)
02698 {
02699 if (this->job->processesToKill != NULL)
02700 processes = this->job->processesToKill->process;
02701 else
02702 throw ErrorClass("<processesToKill> object must be defined before getting the processes");
02703 }
02704 else
02705 throw ErrorClass("<job> object must be defined before getting the processes");
02706 return processes;
02707 }
02708
02709
02710
02715 InitVarValue** OSOption::getInitVarValuesSparse()
02716 {
02717 InitVarValue** initVarVector;
02718 if (this->optimization != NULL)
02719 {
02720 if (this->optimization->variables != NULL)
02721 {
02722 if (this->optimization->variables->initialVariableValues != NULL)
02723 initVarVector = this->optimization->variables->initialVariableValues->var;
02724 else
02725 throw ErrorClass("<initialVariableValues> object must be defined before getting the data");
02726 }
02727 else
02728 throw ErrorClass("<variables> object must be defined before getting the data");
02729 }
02730 else
02731 throw ErrorClass("<optimization> object must be defined before getting the data");
02732 return initVarVector;
02733 }
02734
02740 double* OSOption::getInitVarValuesDense()
02741 {
02742 try
02743 {
02744 int numberOfVariables;
02745 numberOfVariables = this->getNumberOfVariables();
02746 if (numberOfVariables < 0)
02747 throw ErrorClass("\"numberOfVariables\" must be present to use dense methods");
02748
02749 if (this->optimization != NULL)
02750 {
02751 if (this->optimization->variables != NULL)
02752 {
02753 if (this->optimization->variables->initialVariableValues != NULL)
02754 {
02755 int i,j,k;
02756 int num_var;
02757 num_var = this->getNumberOfInitVarValues();
02758
02759 if (m_mdInitVarValuesDense != NULL)
02760 delete [] m_mdInitVarValuesDense;
02761 m_mdInitVarValuesDense = new double[numberOfVariables];
02762 for (k = 0; k < numberOfVariables; k++) m_mdInitVarValuesDense[k] = OSNaN();
02763
02764 for (i = 0; i < num_var; i++)
02765 {
02766 j = this->optimization->variables->initialVariableValues->var[i]->idx;
02767 if (j >= 0 && j < numberOfVariables)
02768 m_mdInitVarValuesDense[j]
02769 = this->optimization->variables->initialVariableValues->var[i]->value;
02770 else
02771 throw ErrorClass("Variable index out of range");
02772 }
02773 return m_mdInitVarValuesDense;
02774 }
02775 }
02776 }
02777 }
02778 catch(const ErrorClass& eclass)
02779 {
02780 throw ErrorClass(eclass.errormsg);
02781 }
02782 return NULL;
02783 }
02784
02791 double* OSOption::getInitVarValuesDense(int numberOfVariables)
02792 {
02793 try
02794 {
02795 if (numberOfVariables < 0)
02796 throw ErrorClass("\"numberOfVariables\" must be present to use dense methods");
02797
02798 if (this->optimization != NULL)
02799 {
02800 if (this->optimization->variables != NULL)
02801 {
02802 if (this->optimization->variables->initialVariableValues != NULL)
02803 {
02804 int i,j,k;
02805
02806 int num_var;
02807 num_var = this->getNumberOfInitVarValues();
02808
02809 if (m_mdInitVarValuesDense != NULL)
02810 delete [] m_mdInitVarValuesDense;
02811 m_mdInitVarValuesDense = new double[numberOfVariables];
02812 for (k = 0; k < numberOfVariables; k++) m_mdInitVarValuesDense[k] = OSNaN();
02813
02814 for (i = 0; i < num_var; i++)
02815 {
02816 j = this->optimization->variables->initialVariableValues->var[i]->idx;
02817 if (j >= 0 && j < numberOfVariables)
02818 m_mdInitVarValuesDense[j]
02819 = this->optimization->variables->initialVariableValues->var[i]->value;
02820 else
02821 throw ErrorClass("Variable index out of range");
02822 }
02823 return m_mdInitVarValuesDense;
02824 }
02825 }
02826 }
02827 }
02828 catch(const ErrorClass& eclass)
02829 {
02830 throw ErrorClass(eclass.errormsg);
02831 }
02832 return NULL;
02833 }
02834
02839 InitVarValueString** OSOption::getInitVarValuesStringSparse()
02840 {
02841 InitVarValueString** initVarVector;
02842 if (this->optimization != NULL)
02843 {
02844 if (this->optimization->variables != NULL)
02845 {
02846 if (this->optimization->variables->initialVariableValuesString != NULL)
02847 initVarVector = this->optimization->variables->initialVariableValuesString->var;
02848 else
02849 throw ErrorClass("<initialVariableValuesString> object must be defined before getting the data");
02850 }
02851 else
02852 throw ErrorClass("<variables> object must be defined before getting the data");
02853 }
02854 else
02855 throw ErrorClass("<optimization> object must be defined before getting the data");
02856 return initVarVector;
02857 }
02858
02864 std::string *OSOption::getInitVarValuesStringDense()
02865 {
02866 try
02867 {
02868 int numberOfVariables;
02869 numberOfVariables = this->getNumberOfVariables();
02870 if (numberOfVariables < 0)
02871 throw ErrorClass("\"numberOfVariables\" must be present to use dense methods");
02872
02873 if (this->optimization != NULL)
02874 {
02875 if (this->optimization->variables != NULL)
02876 {
02877 if (this->optimization->variables->initialVariableValuesString != NULL)
02878 {
02879 int i,j,k;
02880 int num_var;
02881 num_var = this->getNumberOfInitVarValuesString();
02882
02883 if (m_mdInitVarValuesStringDense != NULL)
02884 delete [] m_mdInitVarValuesStringDense;
02885 m_mdInitVarValuesStringDense = new std::string[numberOfVariables];
02886 for (k = 0; k < numberOfVariables; k++) m_mdInitVarValuesStringDense[k] = "";
02887
02888 for (i = 0; i < num_var; i++)
02889 {
02890 j = this->optimization->variables->initialVariableValuesString->var[i]->idx;
02891 if (j >= 0 && j < numberOfVariables)
02892 m_mdInitVarValuesStringDense[j]
02893 = this->optimization->variables->initialVariableValuesString->var[i]->value;
02894 else
02895 throw ErrorClass("Variable index out of range");
02896 }
02897 return m_mdInitVarValuesStringDense;
02898 }
02899 }
02900 }
02901 }
02902 catch(const ErrorClass& eclass)
02903 {
02904 throw ErrorClass(eclass.errormsg);
02905 }
02906 return NULL;
02907 }
02908
02958 int* OSOption::getVariableInitialBasisStatusDense(int numberOfVariables)
02959 {
02960 try
02961 {
02962 if (numberOfVariables < 0)
02963 throw ErrorClass("\"numberOfVariables\" must be set to use dense methods");
02964
02965 if (this->optimization == NULL)
02966 throw ErrorClass("<optimization> element was never set");
02967
02968 if (this->optimization->variables == NULL)
02969 throw ErrorClass("<optimization> <variables> element was never set");
02970
02971 if (this->optimization->variables->initialBasisStatus == NULL)
02972 throw ErrorClass("initial basis was never set");
02973
02974 int i,j,k;
02975
02976 if (m_mdInitBasisStatusDense != NULL)
02977 delete [] m_mdInitBasisStatusDense;
02978 m_mdInitBasisStatusDense = new int[numberOfVariables];
02979 for (k = 0; k < numberOfVariables; k++) m_mdInitBasisStatusDense[k] = ENUM_BASIS_STATUS_unknown;
02980
02981 int num_var;
02982
02983 if (this->optimization->variables->initialBasisStatus->basic != NULL)
02984 {
02985 num_var = this->optimization->variables->initialBasisStatus->basic->numberOfEl;
02986 for (i = 0; i < num_var; i++)
02987 {
02988 j = this->optimization->variables->initialBasisStatus->basic->el[i];
02989 if (j >= 0 && j < numberOfVariables)
02990 m_mdInitBasisStatusDense[j] = ENUM_BASIS_STATUS_basic;
02991 else
02992 throw ErrorClass("Variable index out of range");
02993 }
02994 }
02995
02996 if (this->optimization->variables->initialBasisStatus->atLower != NULL)
02997 {
02998 num_var = this->optimization->variables->initialBasisStatus->atLower->numberOfEl;
02999 for (i = 0; i < num_var; i++)
03000 {
03001 j = this->optimization->variables->initialBasisStatus->atLower->el[i];
03002 if (j >= 0 && j < numberOfVariables)
03003 m_mdInitBasisStatusDense[j] = ENUM_BASIS_STATUS_atLower;
03004 else
03005 throw ErrorClass("Variable index out of range");
03006 }
03007 }
03008
03009 if (this->optimization->variables->initialBasisStatus->atUpper != NULL)
03010 {
03011 num_var = this->optimization->variables->initialBasisStatus->atUpper->numberOfEl;
03012
03013 for (i = 0; i < num_var; i++)
03014 {
03015 j = this->optimization->variables->initialBasisStatus->atUpper->el[i];
03016 if (j >= 0 && j < numberOfVariables)
03017 m_mdInitBasisStatusDense[j] = ENUM_BASIS_STATUS_atUpper;
03018 else
03019 throw ErrorClass("Variable index out of range");
03020 }
03021 }
03022
03023 if (this->optimization->variables->initialBasisStatus->isFree != NULL)
03024 {
03025 num_var = this->optimization->variables->initialBasisStatus->isFree->numberOfEl;
03026 for (i = 0; i < num_var; i++)
03027 {
03028 j = this->optimization->variables->initialBasisStatus->isFree->el[i];
03029 if (j >= 0 && j < numberOfVariables)
03030 m_mdInitBasisStatusDense[j] = ENUM_BASIS_STATUS_isFree;
03031 else
03032 throw ErrorClass("Variable index out of range");
03033 }
03034 }
03035
03036 if (this->optimization->variables->initialBasisStatus->superbasic != NULL)
03037 {
03038 num_var = this->optimization->variables->initialBasisStatus->superbasic->numberOfEl;
03039 for (i = 0; i < num_var; i++)
03040 {
03041 j = this->optimization->variables->initialBasisStatus->superbasic->el[i];
03042 if (j >= 0 && j < numberOfVariables)
03043 m_mdInitBasisStatusDense[j] = ENUM_BASIS_STATUS_superbasic;
03044 else
03045 throw ErrorClass("Variable index out of range");
03046 }
03047 }
03048
03049 return m_mdInitBasisStatusDense;
03050 }
03051
03052 catch(const ErrorClass& eclass)
03053 {
03054 throw ErrorClass(eclass.errormsg);
03055 }
03056 return NULL;
03057 }
03058
03059
03060 int OSOption::getNumberOfInitialBasisElements(int type, int status)
03061 {
03062 if (this->optimization == NULL)
03063 throw ErrorClass("<optimization> element was never set");
03064
03065 switch (type)
03066 {
03067 case ENUM_PROBLEM_COMPONENT_variables:
03068 {
03069 if (this->optimization->variables == NULL)
03070 throw ErrorClass("<optimization> <variables> element was never set");
03071
03072 if (this->optimization->variables->initialBasisStatus == NULL)
03073 throw ErrorClass("initial basis was never set");
03074
03075 return this->optimization->variables->initialBasisStatus->getNumberOfEl(status);
03076 }
03077 case ENUM_PROBLEM_COMPONENT_objectives:
03078 {
03079 if (this->optimization->objectives == NULL)
03080 throw ErrorClass("<optimization> <objectives> element was never set");
03081
03082 if (this->optimization->objectives->initialBasisStatus == NULL)
03083 throw ErrorClass("initial basis was never set");
03084
03085 return this->optimization->objectives->initialBasisStatus->getNumberOfEl(status);
03086 }
03087 case ENUM_PROBLEM_COMPONENT_constraints:
03088 {
03089 if (this->optimization->constraints == NULL)
03090 throw ErrorClass("<optimization> <constraints> element was never set");
03091
03092 if (this->optimization->constraints->initialBasisStatus == NULL)
03093 throw ErrorClass("initial basis was never set");
03094
03095 return this->optimization->constraints->initialBasisStatus->getNumberOfEl(status);
03096 }
03097 default:
03098 throw ErrorClass("target object not implemented in getNumberOfInitialBasisElements");
03099 }
03100 }
03101
03102 bool OSOption::getInitialBasisElements(int type, int status, int* elem)
03103 {
03104 if (this->optimization == NULL)
03105 throw ErrorClass("<optimization> element was never set");
03106
03107 switch (type)
03108 {
03109 case ENUM_PROBLEM_COMPONENT_variables:
03110 {
03111 if (this->optimization->variables == NULL)
03112 throw ErrorClass("<optimization> <variables> element was never set");
03113
03114 if (this->optimization->variables->initialBasisStatus == NULL)
03115 throw ErrorClass("initial basis was never set");
03116
03117 return this->optimization->variables->initialBasisStatus->getIntVector(status, elem);
03118 }
03119 case ENUM_PROBLEM_COMPONENT_objectives:
03120 {
03121 if (this->optimization->objectives == NULL)
03122 throw ErrorClass("<optimization> <objectives> element was never set");
03123
03124 if (this->optimization->objectives->initialBasisStatus == NULL)
03125 throw ErrorClass("initial basis was never set");
03126
03127 return this->optimization->objectives->initialBasisStatus->getIntVector(status, elem);
03128 }
03129 case ENUM_PROBLEM_COMPONENT_constraints:
03130 {
03131 if (this->optimization->constraints == NULL)
03132 throw ErrorClass("<optimization> <constraints> element was never set");
03133
03134 if (this->optimization->constraints->initialBasisStatus == NULL)
03135 throw ErrorClass("initial basis was never set");
03136
03137 return this->optimization->constraints->initialBasisStatus->getIntVector(status, elem);
03138 }
03139 default:
03140 throw ErrorClass("target object not implemented in getInitialBasisElements");
03141 }
03142 }
03143
03144
03145
03146
03151 BranchingWeight** OSOption::getIntegerVariableBranchingWeightsSparse()
03152 {
03153 BranchingWeight** intVarVector;
03154 if (this->optimization != NULL)
03155 {
03156 if (this->optimization->variables != NULL)
03157 {
03158 if (this->optimization->variables->integerVariableBranchingWeights != NULL)
03159 intVarVector = this->optimization->variables->integerVariableBranchingWeights->var;
03160 else
03161 throw ErrorClass("<integerVariableBranchingWeights> object must be defined before getting the data");
03162 }
03163 else
03164 throw ErrorClass("<variables> object must be defined before getting the data");
03165 }
03166 else
03167 throw ErrorClass("<optimization> object must be defined before getting the data");
03168 return intVarVector;
03169 }
03170
03171
03177 double* OSOption::getIntegerVariableBranchingWeightsDense()
03178 {
03179 try
03180 {
03181 int numberOfVariables;
03182 numberOfVariables = this->getNumberOfVariables();
03183 if (numberOfVariables < 0)
03184 throw ErrorClass("\"numberOfVariables\" must be present to use dense methods");
03185
03186 if (this->optimization != NULL)
03187 {
03188 if (this->optimization->variables != NULL)
03189 {
03190 if (this->optimization->variables->integerVariableBranchingWeights != NULL)
03191 {
03192 int i,j,k;
03193 int num_var;
03194 num_var = this->getNumberOfIntegerVariableBranchingWeights();
03195
03196 if (m_mdIntegerVariableBranchingWeightsDense != NULL)
03197 delete [] m_mdIntegerVariableBranchingWeightsDense;
03198 m_mdIntegerVariableBranchingWeightsDense = new double[numberOfVariables];
03199 for (k = 0; k < numberOfVariables; k++) m_mdIntegerVariableBranchingWeightsDense[k] = OSNaN();
03200
03201 for (i = 0; i < num_var; i++)
03202 {
03203 j = this->optimization->variables->integerVariableBranchingWeights->var[i]->idx;
03204 if (j >= 0 && j < numberOfVariables)
03205 m_mdIntegerVariableBranchingWeightsDense[j]
03206 = this->optimization->variables->integerVariableBranchingWeights->var[i]->value;
03207 else
03208 throw ErrorClass("Variable index out of range");
03209 }
03210 return m_mdIntegerVariableBranchingWeightsDense;
03211 }
03212 }
03213 }
03214 }
03215 catch(const ErrorClass& eclass)
03216 {
03217 throw ErrorClass(eclass.errormsg);
03218 }
03219 return NULL;
03220 }
03221
03228 double* OSOption::getIntegerVariableBranchingWeightsDense(int numberOfVariables)
03229 {
03230 try
03231 {
03232 if (numberOfVariables < 0)
03233 throw ErrorClass("\"numberOfVariables\" must be present to use dense methods");
03234
03235 if (this->optimization != NULL)
03236 {
03237 if (this->optimization->variables != NULL)
03238 {
03239 if (this->optimization->variables->integerVariableBranchingWeights != NULL)
03240 {
03241 int i,j,k;
03242 int num_var;
03243 num_var = this->getNumberOfIntegerVariableBranchingWeights();
03244
03245 if (m_mdIntegerVariableBranchingWeightsDense != NULL)
03246 delete [] m_mdIntegerVariableBranchingWeightsDense;
03247 m_mdIntegerVariableBranchingWeightsDense = new double[numberOfVariables];
03248 for (k = 0; k < numberOfVariables; k++) m_mdIntegerVariableBranchingWeightsDense[k] = OSNaN();
03249
03250 for (i = 0; i < num_var; i++)
03251 {
03252 j = this->optimization->variables->integerVariableBranchingWeights->var[i]->idx;
03253 if (j >= 0 && j < numberOfVariables)
03254 m_mdIntegerVariableBranchingWeightsDense[j]
03255 = this->optimization->variables->integerVariableBranchingWeights->var[i]->value;
03256 else
03257 throw ErrorClass("Variable index out of range");
03258 }
03259 return m_mdIntegerVariableBranchingWeightsDense;
03260 }
03261 }
03262 }
03263 }
03264 catch(const ErrorClass& eclass)
03265 {
03266 throw ErrorClass(eclass.errormsg);
03267 }
03268 return NULL;
03269 }
03270
03275 SOSWeights** OSOption::getSOSVariableBranchingWeightsSparse()
03276 {
03277 SOSWeights** sosVarVector;
03278 if (this->optimization != NULL)
03279 {
03280 if (this->optimization->variables != NULL)
03281 {
03282 if (this->optimization->variables->sosVariableBranchingWeights != NULL)
03283 sosVarVector = this->optimization->variables->sosVariableBranchingWeights->sos;
03284 else
03285 throw ErrorClass("<sosVariableBranchingWeights> object must be defined before getting the data");
03286 }
03287 else
03288 throw ErrorClass("<variables> object must be defined before getting the data");
03289 }
03290 else
03291 throw ErrorClass("<optimization> object must be defined before getting the data");
03292 return sosVarVector;
03293 }
03294
03295
03301 std::vector<OtherVariableOption*> OSOption::getOtherVariableOptions( std::string solver_name)
03302 {
03303 std::vector<OtherVariableOption*> optionsVector;
03304 if (this->optimization != NULL)
03305 {
03306 if (this->optimization->variables != NULL)
03307 {
03308 int i;
03309 int num_options;
03310 num_options = this->getNumberOfOtherVariableOptions();
03311 for(i = 0; i < num_options; i++)
03312 if (solver_name == this->optimization->variables->other[ i]->solver)
03313 optionsVector.push_back( this->optimization->variables->other[ i]);
03314 }
03315 else
03316 throw ErrorClass("<variables> object must be defined before getting the data");
03317 }
03318 else
03319 throw ErrorClass("<optimization> object must be defined before getting the data");
03320 return optionsVector;
03321 }
03322
03323
03328 OtherVariableOption** OSOption::getAllOtherVariableOptions()
03329 {
03330 OtherVariableOption** optionsVector;
03331 if (this->optimization != NULL)
03332 {
03333 if (this->optimization->variables != NULL)
03334 optionsVector = this->optimization->variables->other;
03335 else
03336 throw ErrorClass("<variables> object must be defined before getting the data");
03337 }
03338 else
03339 throw ErrorClass("<optimization> object must be defined before getting the data");
03340 return optionsVector;
03341 }
03342
03347 InitObjValue** OSOption::getInitObjValuesSparse()
03348 {
03349 InitObjValue** initObjVector;
03350 if (this->optimization != NULL)
03351 {
03352 if (this->optimization->objectives != NULL)
03353 {
03354 if (this->optimization->objectives->initialObjectiveValues != NULL)
03355 initObjVector = this->optimization->objectives->initialObjectiveValues->obj;
03356 else
03357 throw ErrorClass("<initialObjectiveValues> object must be defined before getting the data");
03358 }
03359 else
03360 throw ErrorClass("<objectives> object must be defined before getting the data");
03361 }
03362 else
03363 throw ErrorClass("<optimization> object must be defined before getting the data");
03364 return initObjVector;
03365 }
03366
03372 double* OSOption::getInitObjValuesDense()
03373 {
03374 try
03375 {
03376 int numberOfObjectives;
03377 numberOfObjectives = this->getNumberOfObjectives();
03378 if (numberOfObjectives < 0)
03379 throw ErrorClass("\"numberOfObjectives\" must be present to use dense methods");
03380
03381 if (this->optimization != NULL)
03382 {
03383 if (this->optimization->objectives != NULL)
03384 {
03385 if (this->optimization->objectives->initialObjectiveValues != NULL)
03386 {
03387 int i,j,k;
03388 int num_obj;
03389 num_obj = this->getNumberOfInitObjValues();
03390
03391 if (m_mdInitObjValuesDense != NULL)
03392 delete [] m_mdInitObjValuesDense;
03393 m_mdInitObjValuesDense = new double[numberOfObjectives];
03394 for (k = 0; k < numberOfObjectives; k++) m_mdInitObjValuesDense[k] = OSNaN();
03395
03396 for (i = 0; i < num_obj; i++)
03397 {
03398 j = this->optimization->objectives->initialObjectiveValues->obj[i]->idx;
03399 if (j < 0 && -j <= numberOfObjectives)
03400 m_mdInitObjValuesDense[-1-j]
03401 = this->optimization->objectives->initialObjectiveValues->obj[i]->value;
03402 else
03403 {
03404 throw ErrorClass("Objective index out of range");
03405 }
03406 }
03407 return m_mdInitObjValuesDense;
03408 }
03409 }
03410 }
03411 }
03412 catch(const ErrorClass& eclass)
03413 {
03414 throw ErrorClass(eclass.errormsg);
03415 }
03416 return NULL;
03417 }
03418
03425 double* OSOption::getInitObjValuesDense(int numberOfObjectives)
03426 {
03427 try
03428 {
03429 if (numberOfObjectives < 0)
03430 throw ErrorClass("\"numberOfObjectives\" must be present to use dense methods");
03431
03432 if (this->optimization != NULL)
03433 {
03434 if (this->optimization->objectives != NULL)
03435 {
03436 if (this->optimization->objectives->initialObjectiveValues != NULL)
03437 {
03438 int i,j,k;
03439 int num_obj;
03440 num_obj = this->getNumberOfInitObjValues();
03441
03442 if (m_mdInitObjValuesDense != NULL)
03443 delete [] m_mdInitObjValuesDense;
03444 m_mdInitObjValuesDense = new double[numberOfObjectives];
03445 for (k = 0; k < numberOfObjectives; k++) m_mdInitObjValuesDense[k] = OSNaN();
03446
03447 for (i = 0; i < num_obj; i++)
03448 {
03449 j = this->optimization->objectives->initialObjectiveValues->obj[i]->idx;
03450 if (j < 0 && -j <= numberOfObjectives)
03451 m_mdInitObjValuesDense[-1-j]
03452 = this->optimization->objectives->initialObjectiveValues->obj[i]->value;
03453 else
03454 {
03455 throw ErrorClass("Objective index out of range");
03456 }
03457 }
03458 return m_mdInitObjValuesDense;
03459 }
03460 }
03461 }
03462 }
03463 catch(const ErrorClass& eclass)
03464 {
03465 throw ErrorClass(eclass.errormsg);
03466 }
03467 return NULL;
03468 }
03469
03474 InitObjBound** OSOption::getInitObjBoundsSparse()
03475 {
03476 InitObjBound** initObjBounds;
03477 if (this->optimization != NULL)
03478 {
03479 if (this->optimization->objectives != NULL)
03480 {
03481 if (this->optimization->objectives->initialObjectiveBounds != NULL)
03482 initObjBounds = this->optimization->objectives->initialObjectiveBounds->obj;
03483 else
03484 throw ErrorClass("<initialObjectiveBounds> object must be defined before getting the data");
03485 }
03486 else
03487 throw ErrorClass("<objectives> object must be defined before getting the data");
03488 }
03489 else
03490 throw ErrorClass("<optimization> object must be defined before getting the data");
03491 return initObjBounds;
03492 }
03493
03499 double* OSOption::getInitObjLowerBoundsDense()
03500 {
03501 try
03502 {
03503 int numberOfObjectives;
03504 numberOfObjectives = this->getNumberOfObjectives();
03505 if (numberOfObjectives < 0)
03506 throw ErrorClass("\"numberOfObjectives\" must be present to use dense methods");
03507
03508 if (this->optimization != NULL)
03509 {
03510 if (this->optimization->objectives != NULL)
03511 {
03512 if (this->optimization->objectives->initialObjectiveBounds != NULL)
03513 {
03514 int i,j,k;
03515 int num_obj;
03516 num_obj = this->getNumberOfInitObjBounds();
03517
03518 if (m_mdInitObjLowerBoundsDense != NULL)
03519 delete [] m_mdInitObjLowerBoundsDense;
03520 m_mdInitObjLowerBoundsDense = new double[numberOfObjectives];
03521 for (k = 0; k < numberOfObjectives; k++) m_mdInitObjLowerBoundsDense[k] = OSNaN();
03522
03523 for (i = 0; i < num_obj; i++)
03524 {
03525 j = this->optimization->objectives->initialObjectiveBounds->obj[i]->idx;
03526 if (j < 0 && -j <= numberOfObjectives)
03527 m_mdInitObjLowerBoundsDense[-1-j]
03528 = this->optimization->objectives->initialObjectiveBounds->obj[i]->lbValue;
03529 else
03530 {
03531 throw ErrorClass("Objective index out of range");
03532 }
03533 }
03534 return m_mdInitObjLowerBoundsDense;
03535 }
03536 }
03537 }
03538 }
03539 catch(const ErrorClass& eclass)
03540 {
03541 throw ErrorClass(eclass.errormsg);
03542 }
03543 return NULL;
03544 }
03545
03552 double* OSOption::getInitObjLowerBoundsDense(int numberOfObjectives)
03553 {
03554 try
03555 {
03556 if (numberOfObjectives < 0)
03557 throw ErrorClass("\"numberOfObjectives\" must be present to use dense methods");
03558
03559 if (this->optimization != NULL)
03560 {
03561 if (this->optimization->objectives != NULL)
03562 {
03563 if (this->optimization->objectives->initialObjectiveBounds != NULL)
03564 {
03565 int i,j,k;
03566 int num_obj;
03567 num_obj = this->getNumberOfInitObjBounds();
03568
03569 if (m_mdInitObjLowerBoundsDense != NULL)
03570 delete [] m_mdInitObjLowerBoundsDense;
03571 m_mdInitObjLowerBoundsDense = new double[numberOfObjectives];
03572 for (k = 0; k < numberOfObjectives; k++) m_mdInitObjLowerBoundsDense[k] = OSNaN();
03573
03574 for (i = 0; i < num_obj; i++)
03575 {
03576 j = this->optimization->objectives->initialObjectiveBounds->obj[i]->idx;
03577 if (j < 0 && -j <= numberOfObjectives)
03578 m_mdInitObjLowerBoundsDense[-1-j]
03579 = this->optimization->objectives->initialObjectiveBounds->obj[i]->lbValue;
03580 else
03581 {
03582 throw ErrorClass("Objective index out of range");
03583 }
03584 }
03585 return m_mdInitObjLowerBoundsDense;
03586 }
03587 }
03588 }
03589 }
03590 catch(const ErrorClass& eclass)
03591 {
03592 throw ErrorClass(eclass.errormsg);
03593 }
03594 return NULL;
03595 }
03596
03602 double* OSOption::getInitObjUpperBoundsDense()
03603 {
03604 try
03605 {
03606 int numberOfObjectives;
03607 numberOfObjectives = this->getNumberOfObjectives();
03608 if (numberOfObjectives < 0)
03609 throw ErrorClass("\"numberOfObjectives\" must be present to use dense methods");
03610
03611 if (this->optimization != NULL)
03612 {
03613 if (this->optimization->objectives != NULL)
03614 {
03615 if (this->optimization->objectives->initialObjectiveBounds != NULL)
03616 {
03617 int i,j,k;
03618 int num_obj;
03619 num_obj = this->getNumberOfInitObjBounds();
03620
03621 if (m_mdInitObjUpperBoundsDense != NULL)
03622 delete [] m_mdInitObjUpperBoundsDense;
03623 m_mdInitObjUpperBoundsDense = new double[numberOfObjectives];
03624 for (k = 0; k < numberOfObjectives; k++) m_mdInitObjUpperBoundsDense[k] = OSNaN();
03625
03626 for (i = 0; i < num_obj; i++)
03627 {
03628 j = this->optimization->objectives->initialObjectiveBounds->obj[i]->idx;
03629 if (j < 0 && -j <= numberOfObjectives)
03630 m_mdInitObjUpperBoundsDense[-1-j]
03631 = this->optimization->objectives->initialObjectiveBounds->obj[i]->ubValue;
03632 else
03633 {
03634 throw ErrorClass("Objective index out of range");
03635 }
03636 }
03637 return m_mdInitObjUpperBoundsDense;
03638 }
03639 }
03640 }
03641 }
03642 catch(const ErrorClass& eclass)
03643 {
03644 throw ErrorClass(eclass.errormsg);
03645 }
03646 return NULL;
03647 }
03648
03655 double* OSOption::getInitObjUpperBoundsDense(int numberOfObjectives)
03656 {
03657 try
03658 {
03659 if (numberOfObjectives < 0)
03660 throw ErrorClass("\"numberOfObjectives\" must be present to use dense methods");
03661
03662 if (this->optimization != NULL)
03663 {
03664 if (this->optimization->objectives != NULL)
03665 {
03666 if (this->optimization->objectives->initialObjectiveBounds != NULL)
03667 {
03668 int i,j,k;
03669 int num_obj;
03670 num_obj = this->getNumberOfInitObjBounds();
03671
03672 if (m_mdInitObjUpperBoundsDense != NULL)
03673 delete [] m_mdInitObjUpperBoundsDense;
03674 m_mdInitObjUpperBoundsDense = new double[numberOfObjectives];
03675 for (k = 0; k < numberOfObjectives; k++) m_mdInitObjUpperBoundsDense[k] = OSNaN();
03676
03677 for (i = 0; i < num_obj; i++)
03678 {
03679 j = this->optimization->objectives->initialObjectiveBounds->obj[i]->idx;
03680 if (j < 0 && -j <= numberOfObjectives)
03681 m_mdInitObjUpperBoundsDense[-1-j]
03682 = this->optimization->objectives->initialObjectiveBounds->obj[i]->ubValue;
03683 else
03684 {
03685 throw ErrorClass("Objective index out of range");
03686 }
03687 }
03688 return m_mdInitObjUpperBoundsDense;
03689 }
03690 }
03691 }
03692 }
03693 catch(const ErrorClass& eclass)
03694 {
03695 throw ErrorClass(eclass.errormsg);
03696 }
03697 return NULL;
03698 }
03699
03706 std::string *OSOption::getInitVarValuesStringDense(int numberOfVariables)
03707 {
03708 try
03709 {
03710 if (numberOfVariables < 0)
03711 throw ErrorClass("\"numberOfVariables\" must be present to use dense methods");
03712
03713 if (this->optimization != NULL)
03714 {
03715 if (this->optimization->variables != NULL)
03716 {
03717 if (this->optimization->variables->initialVariableValuesString != NULL)
03718 {
03719 int i,j,k;
03720 int num_var;
03721 num_var = this->getNumberOfInitVarValuesString();
03722
03723 if (m_mdInitVarValuesStringDense != NULL)
03724 delete [] m_mdInitVarValuesStringDense;
03725 m_mdInitVarValuesStringDense = new std::string[numberOfVariables];
03726 for (k = 0; k < numberOfVariables; k++) m_mdInitVarValuesStringDense[k] = "";
03727
03728 for (i = 0; i < num_var; i++)
03729 {
03730 j = this->optimization->variables->initialVariableValuesString->var[i]->idx;
03731 if (j >= 0 && j < numberOfVariables)
03732 m_mdInitVarValuesStringDense[j]
03733 = this->optimization->variables->initialVariableValuesString->var[i]->value;
03734 else
03735 throw ErrorClass("Variable index out of range");
03736 }
03737 return m_mdInitVarValuesStringDense;
03738 }
03739 }
03740 }
03741 }
03742 catch(const ErrorClass& eclass)
03743 {
03744 throw ErrorClass(eclass.errormsg);
03745 }
03746 return NULL;
03747 }
03748
03749
03757 int* OSOption::getObjectiveInitialBasisStatusDense(int numberOfObjectives)
03758 {
03759 try
03760 {
03761 if (numberOfObjectives < 0)
03762 throw ErrorClass("\"numberOfObjectives\" must be set to use dense methods");
03763
03764 if (this->optimization == NULL)
03765 throw ErrorClass("<optimization> element was never set");
03766
03767 if (this->optimization->objectives == NULL)
03768 throw ErrorClass("<optimization> <objectives> element was never set");
03769
03770 if (this->optimization->objectives->initialBasisStatus == NULL)
03771 throw ErrorClass("initial basis was never set");
03772
03773 int i,j,k;
03774
03775 if (m_mdInitBasisStatusDense != NULL)
03776 delete [] m_mdInitBasisStatusDense;
03777 m_mdInitBasisStatusDense = new int[numberOfObjectives];
03778 for (k = 0; k < numberOfObjectives; k++) m_mdInitBasisStatusDense[k] = ENUM_BASIS_STATUS_unknown;
03779
03780 int num_obj;
03781
03782 if (this->optimization->objectives->initialBasisStatus->basic != NULL)
03783 {
03784 num_obj = this->optimization->objectives->initialBasisStatus->basic->numberOfEl;
03785 for (i = 0; i < num_obj; i++)
03786 {
03787 j = this->optimization->objectives->initialBasisStatus->basic->el[i];
03788 if (j >= 0 || j < -numberOfObjectives)
03789 throw ErrorClass("Objective index out of range");
03790 else
03791 m_mdInitBasisStatusDense[j] = ENUM_BASIS_STATUS_basic;
03792 }
03793 }
03794
03795 if (this->optimization->objectives->initialBasisStatus->atLower != NULL)
03796 {
03797 num_obj = this->optimization->objectives->initialBasisStatus->atLower->numberOfEl;
03798 for (i = 0; i < num_obj; i++)
03799 {
03800 j = this->optimization->objectives->initialBasisStatus->atLower->el[i];
03801 if (j >= 0 || j < -numberOfObjectives)
03802 throw ErrorClass("Objective index out of range");
03803 else
03804 m_mdInitBasisStatusDense[j] = ENUM_BASIS_STATUS_atLower;
03805 }
03806 }
03807
03808 if (this->optimization->objectives->initialBasisStatus->atUpper != NULL)
03809 {
03810 num_obj = this->optimization->objectives->initialBasisStatus->atUpper->numberOfEl;
03811 for (i = 0; i < num_obj; i++)
03812 {
03813 j = this->optimization->objectives->initialBasisStatus->atUpper->el[i];
03814 if (j >= 0 || j < -numberOfObjectives)
03815 throw ErrorClass("Objective index out of range");
03816 else
03817 m_mdInitBasisStatusDense[j] = ENUM_BASIS_STATUS_atUpper;
03818 }
03819 }
03820
03821 if (this->optimization->objectives->initialBasisStatus->isFree != NULL)
03822 {
03823 num_obj = this->optimization->objectives->initialBasisStatus->isFree->numberOfEl;
03824 for (i = 0; i < num_obj; i++)
03825 {
03826 j = this->optimization->objectives->initialBasisStatus->isFree->el[i];
03827 if (j >= 0 || j < -numberOfObjectives)
03828 throw ErrorClass("Objective index out of range");
03829 else
03830 m_mdInitBasisStatusDense[j] = ENUM_BASIS_STATUS_isFree;
03831 }
03832 }
03833
03834 if (this->optimization->objectives->initialBasisStatus->superbasic != NULL)
03835 {
03836 num_obj = this->optimization->objectives->initialBasisStatus->superbasic->numberOfEl;
03837 for (i = 0; i < num_obj; i++)
03838 {
03839 j = this->optimization->objectives->initialBasisStatus->superbasic->el[i];
03840 if (j >= 0 || j < -numberOfObjectives)
03841 throw ErrorClass("Objective index out of range");
03842 else
03843 m_mdInitBasisStatusDense[j] = ENUM_BASIS_STATUS_superbasic;
03844 }
03845 }
03846
03847 return m_mdInitBasisStatusDense;
03848 }
03849
03850 catch(const ErrorClass& eclass)
03851 {
03852 throw ErrorClass(eclass.errormsg);
03853 }
03854 return NULL;
03855 }
03856
03857
03858
03859
03865 std::vector<OtherObjectiveOption*> OSOption::getOtherObjectiveOptions( std::string solver_name)
03866 {
03867 std::vector<OtherObjectiveOption*> optionsVector;
03868 if (this->optimization != NULL)
03869 {
03870 if (this->optimization->variables != NULL)
03871 {
03872 int i;
03873 int num_options;
03874 num_options = this->getNumberOfOtherObjectiveOptions();
03875 for(i = 0; i < num_options; i++)
03876 if (solver_name == this->optimization->objectives->other[ i]->solver)
03877 optionsVector.push_back( this->optimization->objectives->other[ i]);
03878 }
03879 else
03880 throw ErrorClass("<objectives> object must be defined before getting the data");
03881 }
03882 else
03883 throw ErrorClass("<optimization> object must be defined before getting the data");
03884 return optionsVector;
03885 }
03886
03891 OtherObjectiveOption** OSOption::getAllOtherObjectiveOptions()
03892 {
03893 OtherObjectiveOption** optionsVector;
03894 if (this->optimization != NULL)
03895 {
03896 if (this->optimization->objectives != NULL)
03897 optionsVector = this->optimization->objectives->other;
03898 else
03899 throw ErrorClass("<objectives> object must be defined before getting the data");
03900 }
03901 else
03902 throw ErrorClass("<optimization> object must be defined before getting the data");
03903 return optionsVector;
03904 }
03905
03906
03911 InitConValue** OSOption::getInitConValuesSparse()
03912 {
03913 InitConValue** initConVector;
03914 if (this->optimization != NULL)
03915 {
03916 if (this->optimization->constraints != NULL)
03917 {
03918 if (this->optimization->constraints->initialConstraintValues != NULL)
03919 initConVector = this->optimization->constraints->initialConstraintValues->con;
03920 else
03921 throw ErrorClass("<initialConstraintValues> object must be defined before getting the data");
03922 }
03923 else
03924 throw ErrorClass("<constraints> object must be defined before getting the data");
03925 }
03926 else
03927 throw ErrorClass("<optimization> object must be defined before getting the data");
03928 return initConVector;
03929 }
03930
03936 double* OSOption::getInitConValuesDense()
03937 {
03938 try
03939 {
03940 int numberOfConstraints;
03941 numberOfConstraints = this->getNumberOfConstraints();
03942 if (numberOfConstraints < 0)
03943 throw ErrorClass("\"numberOfConstraints\" must be present to use dense methods");
03944
03945 if (this->optimization != NULL)
03946 {
03947 if (this->optimization->constraints != NULL)
03948 {
03949 if (this->optimization->constraints->initialConstraintValues != NULL)
03950 {
03951 int i,j,k;
03952 int num_con;
03953 num_con = this->getNumberOfInitConValues();
03954
03955 if (m_mdInitConValuesDense != NULL)
03956 delete [] m_mdInitConValuesDense;
03957 m_mdInitConValuesDense = new double[numberOfConstraints];
03958 for (k = 0; k < numberOfConstraints; k++) m_mdInitConValuesDense[k] = OSNaN();
03959
03960 for (i = 0; i < num_con; i++)
03961 {
03962 j = this->optimization->constraints->initialConstraintValues->con[i]->idx;
03963 if (j >= 0 && j < numberOfConstraints)
03964 m_mdInitConValuesDense[j]
03965 = this->optimization->constraints->initialConstraintValues->con[i]->value;
03966 else
03967 throw ErrorClass("Constraint index out of range");
03968 }
03969 return m_mdInitConValuesDense;
03970 }
03971 }
03972 }
03973 }
03974 catch(const ErrorClass& eclass)
03975 {
03976 throw ErrorClass(eclass.errormsg);
03977 }
03978 return NULL;
03979 }
03980
03987 double* OSOption::getInitConValuesDense(int numberOfConstraints)
03988 {
03989 try
03990 {
03991 if (numberOfConstraints < 0)
03992 throw ErrorClass("\"numberOfConstraints\" must be present to use dense methods");
03993
03994 if (this->optimization != NULL)
03995 {
03996 if (this->optimization->constraints != NULL)
03997 {
03998 if (this->optimization->constraints->initialConstraintValues != NULL)
03999 {
04000 int i,j,k;
04001 int num_con;
04002 num_con = this->getNumberOfInitConValues();
04003
04004 if (m_mdInitConValuesDense != NULL)
04005 delete [] m_mdInitConValuesDense;
04006 m_mdInitConValuesDense = new double[numberOfConstraints];
04007 for (k = 0; k < numberOfConstraints; k++) m_mdInitConValuesDense[k] = OSNaN();
04008
04009 for (i = 0; i < num_con; i++)
04010 {
04011 j = this->optimization->constraints->initialConstraintValues->con[i]->idx;
04012 if (j >= 0 && j < numberOfConstraints)
04013 m_mdInitConValuesDense[j]
04014 = this->optimization->constraints->initialConstraintValues->con[i]->value;
04015 else
04016 throw ErrorClass("Constraint index out of range");
04017 }
04018 return m_mdInitConValuesDense;
04019 }
04020 }
04021 }
04022 }
04023 catch(const ErrorClass& eclass)
04024 {
04025 throw ErrorClass(eclass.errormsg);
04026 }
04027 return NULL;
04028 }
04029
04034 InitDualVarValue** OSOption::getInitDualVarValuesSparse()
04035 {
04036 InitDualVarValue** initDualVector;
04037 if (this->optimization != NULL)
04038 {
04039 if (this->optimization->constraints != NULL)
04040 {
04041 if (this->optimization->constraints->initialDualValues != NULL)
04042 initDualVector = this->optimization->constraints->initialDualValues->con;
04043 else
04044 throw ErrorClass("<initialDualValues> object must be defined before getting the data");
04045 }
04046 else
04047 throw ErrorClass("<constraints> object must be defined before getting the data");
04048 }
04049 else
04050 throw ErrorClass("<optimization> object must be defined before getting the data");
04051 return initDualVector;
04052 }
04053
04059 double* OSOption::getInitDualVarLowerBoundsDense()
04060 {
04061 try
04062 {
04063 int numberOfConstraints;
04064 numberOfConstraints = this->getNumberOfConstraints();
04065 if (numberOfConstraints < 0)
04066 throw ErrorClass("\"numberOfConstraints\" must be present to use dense methods");
04067
04068 if (this->optimization != NULL)
04069 {
04070 if (this->optimization->constraints != NULL)
04071 {
04072 if (this->optimization->constraints->initialDualValues != NULL)
04073 {
04074 int i,j,k;
04075
04076 int num_con;
04077 num_con = this->getNumberOfInitDualVarValues();
04078
04079 if (m_mdInitDualVarLowerBoundsDense != NULL)
04080 delete [] m_mdInitDualVarLowerBoundsDense;
04081 m_mdInitDualVarLowerBoundsDense = new double[numberOfConstraints];
04082 for (k = 0; k < numberOfConstraints; k++) m_mdInitDualVarLowerBoundsDense[k] = 0.0;
04083
04084 for (i = 0; i < num_con; i++)
04085 {
04086 j = this->optimization->constraints->initialDualValues->con[i]->idx;
04087 if (j >= 0 && j < numberOfConstraints)
04088 m_mdInitDualVarLowerBoundsDense[j]
04089 = this->optimization->constraints->initialDualValues->con[i]->lbDualValue;
04090 else
04091 throw ErrorClass("Constraint index out of range");
04092 }
04093 return m_mdInitDualVarLowerBoundsDense;
04094 }
04095 }
04096 }
04097 }
04098 catch(const ErrorClass& eclass)
04099 {
04100 throw ErrorClass(eclass.errormsg);
04101 }
04102 return NULL;
04103 }
04104
04111 double* OSOption::getInitDualVarLowerBoundsDense(int numberOfConstraints)
04112 {
04113 try
04114 {
04115 if (numberOfConstraints < 0)
04116 throw ErrorClass("\"numberOfConstraints\" must be present to use dense methods");
04117
04118 if (this->optimization != NULL)
04119 {
04120 if (this->optimization->constraints != NULL)
04121 {
04122 if (this->optimization->constraints->initialDualValues != NULL)
04123 {
04124 int i,j,k;
04125 int num_con;
04126 num_con = this->getNumberOfInitDualVarValues();
04127
04128 if (m_mdInitDualVarLowerBoundsDense != NULL)
04129 delete [] m_mdInitDualVarLowerBoundsDense;
04130 m_mdInitDualVarLowerBoundsDense = new double[numberOfConstraints];
04131 for (k = 0; k < numberOfConstraints; k++) m_mdInitDualVarLowerBoundsDense[k] = 0.0;
04132
04133 for (i = 0; i < num_con; i++)
04134 {
04135 j = this->optimization->constraints->initialDualValues->con[i]->idx;
04136 if (j >= 0 && j < numberOfConstraints)
04137 m_mdInitDualVarLowerBoundsDense[j]
04138 = this->optimization->constraints->initialDualValues->con[i]->lbDualValue;
04139 else
04140 throw ErrorClass("Constraint index out of range");
04141 }
04142 return m_mdInitDualVarLowerBoundsDense;
04143 }
04144 }
04145 }
04146 }
04147 catch(const ErrorClass& eclass)
04148 {
04149 throw ErrorClass(eclass.errormsg);
04150 }
04151 return NULL;
04152 }
04153
04159 double* OSOption::getInitDualVarUpperBoundsDense()
04160 {
04161 try
04162 {
04163 int numberOfConstraints;
04164 numberOfConstraints = this->getNumberOfConstraints();
04165 if (numberOfConstraints < 0)
04166 throw ErrorClass("\"numberOfConstraints\" must be present to use dense methods");
04167
04168 if (this->optimization != NULL)
04169 {
04170 if (this->optimization->constraints != NULL)
04171 {
04172 if (this->optimization->constraints->initialDualValues != NULL)
04173 {
04174 int i,j,k;
04175 int num_con;
04176 num_con = this->getNumberOfInitDualVarValues();
04177 numberOfConstraints = this->getNumberOfConstraints();
04178
04179 if (m_mdInitDualVarUpperBoundsDense != NULL)
04180 delete [] m_mdInitDualVarUpperBoundsDense;
04181 m_mdInitDualVarUpperBoundsDense = new double[numberOfConstraints];
04182 for (k = 0; k < numberOfConstraints; k++) m_mdInitDualVarUpperBoundsDense[k] = 0.0;
04183
04184 for (i = 0; i < num_con; i++)
04185 {
04186 j = this->optimization->constraints->initialDualValues->con[i]->idx;
04187 if (j >= 0 && j < numberOfConstraints)
04188 m_mdInitDualVarUpperBoundsDense[j]
04189 = this->optimization->constraints->initialDualValues->con[i]->ubDualValue;
04190 else
04191 throw ErrorClass("Constraint index out of range");
04192 }
04193 return m_mdInitDualVarUpperBoundsDense;
04194 }
04195 }
04196 }
04197 }
04198 catch(const ErrorClass& eclass)
04199 {
04200 throw ErrorClass(eclass.errormsg);
04201 }
04202 return NULL;
04203 }
04204
04211 double* OSOption::getInitDualVarUpperBoundsDense(int numberOfConstraints)
04212 {
04213 try
04214 {
04215 if (numberOfConstraints < 0)
04216 throw ErrorClass("\"numberOfConstraints\" must be present to use dense methods");
04217
04218 if (this->optimization != NULL)
04219 {
04220 if (this->optimization->constraints != NULL)
04221 {
04222 if (this->optimization->constraints->initialDualValues != NULL)
04223 {
04224 int i,j,k;
04225 int num_con;
04226 num_con = this->getNumberOfInitDualVarValues();
04227 numberOfConstraints = this->getNumberOfConstraints();
04228
04229 if (m_mdInitDualVarUpperBoundsDense != NULL)
04230 delete [] m_mdInitDualVarUpperBoundsDense;
04231 m_mdInitDualVarUpperBoundsDense = new double[numberOfConstraints];
04232 for (k = 0; k < numberOfConstraints; k++) m_mdInitDualVarUpperBoundsDense[k] = 0.0;
04233
04234 for (i = 0; i < num_con; i++)
04235 {
04236 j = this->optimization->constraints->initialDualValues->con[i]->idx;
04237 if (j >= 0 && j < numberOfConstraints)
04238 m_mdInitDualVarUpperBoundsDense[j]
04239 = this->optimization->constraints->initialDualValues->con[i]->ubDualValue;
04240 else
04241 throw ErrorClass("Constraint index out of range");
04242 }
04243 return m_mdInitDualVarUpperBoundsDense;
04244 }
04245 }
04246 }
04247 }
04248 catch(const ErrorClass& eclass)
04249 {
04250 throw ErrorClass(eclass.errormsg);
04251 }
04252 return NULL;
04253 }
04254
04255
04262 int* OSOption::getSlackVariableInitialBasisStatusDense(int numberOfConstraints)
04263 {
04264 try
04265 {
04266 if (numberOfConstraints < 0)
04267 throw ErrorClass("\"numberOfConstraints\" must be set to use dense methods");
04268
04269 if (this->optimization == NULL)
04270 throw ErrorClass("<optimization> element was never set");
04271
04272 if (this->optimization->constraints == NULL)
04273 throw ErrorClass("<optimization> <constraints> element was never set");
04274
04275 if (this->optimization->constraints->initialBasisStatus == NULL)
04276 throw ErrorClass("initial basis was never set");
04277
04278 int i,j,k;
04279
04280 if (m_mdInitBasisStatusDense != NULL)
04281 delete [] m_mdInitBasisStatusDense;
04282 m_mdInitBasisStatusDense = new int[numberOfConstraints];
04283 for (k = 0; k < numberOfConstraints; k++) m_mdInitBasisStatusDense[k] = ENUM_BASIS_STATUS_unknown;
04284
04285 int num_slack;
04286
04287 if (this->optimization->constraints->initialBasisStatus->basic != NULL)
04288 {
04289 num_slack = this->optimization->constraints->initialBasisStatus->basic->numberOfEl;
04290 for (i = 0; i < num_slack; i++)
04291 {
04292 j = this->optimization->constraints->initialBasisStatus->basic->el[i];
04293 if (j >= 0 && j < numberOfConstraints)
04294 m_mdInitBasisStatusDense[j] = ENUM_BASIS_STATUS_basic;
04295 else
04296 throw ErrorClass("Constraint index out of range");
04297 }
04298 }
04299
04300 if (this->optimization->constraints->initialBasisStatus->atLower != NULL)
04301 {
04302 num_slack = this->optimization->constraints->initialBasisStatus->atLower->numberOfEl;
04303 for (i = 0; i < num_slack; i++)
04304 {
04305 j = this->optimization->constraints->initialBasisStatus->atLower->el[i];
04306 if (j >= 0 && j < numberOfConstraints)
04307 m_mdInitBasisStatusDense[j] = ENUM_BASIS_STATUS_atLower;
04308 else
04309 throw ErrorClass("Constraint index out of range");
04310 }
04311 }
04312
04313 if (this->optimization->constraints->initialBasisStatus->atUpper != NULL)
04314 {
04315 num_slack = this->optimization->constraints->initialBasisStatus->atUpper->numberOfEl;
04316 for (i = 0; i < num_slack; i++)
04317 {
04318 j = this->optimization->constraints->initialBasisStatus->atUpper->el[i];
04319 if (j >= 0 && j < numberOfConstraints)
04320 m_mdInitBasisStatusDense[j] = ENUM_BASIS_STATUS_atUpper;
04321 else
04322 throw ErrorClass("Constraint index out of range");
04323 }
04324 }
04325
04326 if (this->optimization->constraints->initialBasisStatus->isFree != NULL)
04327 {
04328 num_slack = this->optimization->constraints->initialBasisStatus->isFree->numberOfEl;
04329 for (i = 0; i < num_slack; i++)
04330 {
04331 j = this->optimization->constraints->initialBasisStatus->isFree->el[i];
04332 if (j >= 0 && j < numberOfConstraints)
04333 m_mdInitBasisStatusDense[j] = ENUM_BASIS_STATUS_isFree;
04334 else
04335 throw ErrorClass("Constraint index out of range");
04336 }
04337 }
04338
04339 if (this->optimization->constraints->initialBasisStatus->superbasic != NULL)
04340 {
04341 num_slack = this->optimization->constraints->initialBasisStatus->superbasic->numberOfEl;
04342 for (i = 0; i < num_slack; i++)
04343 {
04344 j = this->optimization->constraints->initialBasisStatus->superbasic->el[i];
04345 if (j >= 0 && j < numberOfConstraints)
04346 m_mdInitBasisStatusDense[j] = ENUM_BASIS_STATUS_superbasic;
04347 else
04348 throw ErrorClass("Constraint index out of range");
04349 }
04350 }
04351
04352 return m_mdInitBasisStatusDense;
04353 }
04354
04355 catch(const ErrorClass& eclass)
04356 {
04357 throw ErrorClass(eclass.errormsg);
04358 }
04359 return NULL;
04360 }
04361
04362
04368 std::vector<OtherConstraintOption*> OSOption::getOtherConstraintOptions( std::string solver_name)
04369 {
04370 std::vector<OtherConstraintOption*> optionsVector;
04371 if (this->optimization != NULL)
04372 {
04373 if (this->optimization->constraints != NULL)
04374 {
04375 int i;
04376 int num_options;
04377 num_options = this->getNumberOfOtherConstraintOptions();
04378 for(i = 0; i < num_options; i++)
04379 if (solver_name == this->optimization->constraints->other[ i]->solver)
04380 optionsVector.push_back( this->optimization->constraints->other[ i]);
04381 }
04382 else
04383 throw ErrorClass("<constraints> object must be defined before getting the data");
04384 }
04385 else
04386 throw ErrorClass("<optimization> object must be defined before getting the data");
04387 return optionsVector;
04388 }
04389
04394 OtherConstraintOption** OSOption::getAllOtherConstraintOptions()
04395 {
04396 OtherConstraintOption** optionsVector;
04397 if (this->optimization != NULL)
04398 {
04399 if (this->optimization->constraints != NULL)
04400 optionsVector = this->optimization->constraints->other;
04401 else
04402 throw ErrorClass("<constraints> object must be defined before getting the data");
04403 }
04404 else
04405 throw ErrorClass("<optimization> object must be defined before getting the data");
04406 return optionsVector;
04407 }
04408
04409
04415 std::vector<SolverOption*> OSOption::getSolverOptions( std::string solver_name)
04416 {
04417 std::vector<SolverOption*> optionsVector;
04418 if (this->optimization != NULL)
04419 {
04420 if (this->optimization->solverOptions != NULL)
04421 {
04422 int i;
04423 int num_options;
04424 num_options = this->getNumberOfSolverOptions();
04425 for(i = 0; i < num_options; i++)
04426 if (solver_name == this->optimization->solverOptions->solverOption[ i]->solver)
04427 optionsVector.push_back( this->optimization->solverOptions->solverOption[ i]);
04428 }
04429 else
04430 throw ErrorClass("<solverOptions> object must be defined before getting the data");
04431 }
04432 else
04433 throw ErrorClass("<optimization> object must be defined before getting the data");
04434 return optionsVector;
04435 }
04436
04437
04446 std::vector<SolverOption*> OSOption::getSolverOptions( std::string solver_name, bool getFreeOptions)
04447 {
04448 std::vector<SolverOption*> optionsVector;
04449 if (this->optimization != NULL)
04450 {
04451 if (this->optimization->solverOptions != NULL)
04452 {
04453 int i;
04454 int num_options;
04455 num_options = this->getNumberOfSolverOptions();
04456 for (i = 0; i < num_options; i++)
04457 {
04458 if (this->optimization->solverOptions->solverOption[i]->solver == solver_name ||
04459 (this->optimization->solverOptions->solverOption[i]->solver == "" && getFreeOptions))
04460 optionsVector.push_back( this->optimization->solverOptions->solverOption[i]);
04461 }
04462 }
04463 else
04464 throw ErrorClass("<solverOptions> object must be defined before getting the data");
04465 }
04466 else
04467 throw ErrorClass("<optimization> object must be defined before getting the data");
04468 return optionsVector;
04469 }
04474 SolverOption** OSOption::getAllSolverOptions()
04475 {
04476 SolverOption** optionsVector;
04477 if (this->optimization != NULL)
04478 {
04479 if (this->optimization->solverOptions != NULL)
04480 optionsVector = this->optimization->solverOptions->solverOption;
04481 else
04482 throw ErrorClass("<solverOptions> object must be defined before getting the data");
04483 }
04484 else
04485 throw ErrorClass("<optimization> object must be defined before getting the data");
04486 return optionsVector;
04487 }
04488
04489
04490
04497
04498
04499
04500
04501
04502
04506 bool OtherOptions::setOther(int numberOfOptions, OtherOption** other)
04507 {
04508 try
04509 {
04510 if (this->other != NULL)
04511 throw ErrorClass( "otherOptions array previously used.");
04512
04513 if (numberOfOptions < 0)
04514 throw ErrorClass( "length of otherOptions array cannot be negative.");
04515
04516 this->numberOfOtherOptions = numberOfOptions;
04517 if (numberOfOptions == 0)
04518 return true;
04519
04520 this->other = new OtherOption*[numberOfOptions];
04521
04522 int i;
04523 for (i = 0; i < numberOfOptions; i++)
04524 {
04525 this->other[i] = new OtherOption();
04526 *this->other[i] = *other[i];
04527 }
04528 return true;
04529 }
04530 catch(const ErrorClass& eclass)
04531 {
04532 cout << eclass.errormsg << endl;
04533 return false;
04534 }
04535 }
04536
04540 bool OtherOptions::addOther(std::string name, std::string value, std::string description)
04541 {
04542 try
04543 {
04544 int nopt;
04545 int i;
04546 if (name.empty() )
04547 throw ErrorClass( "the name of an option cannot be empty." );
04548
04549 if (this->other == NULL)
04550 nopt = 0;
04551 else
04552 nopt = this->numberOfOtherOptions;
04553
04554 OtherOption** temp = new OtherOption*[nopt+1];
04555 for (i = 0; i < nopt; i++)
04556 temp[i] = this->other[i];
04557
04558 delete[] this->other;
04559
04560
04561 temp[ nopt] = new OtherOption();
04562
04563 temp[ nopt]->name = name;
04564 temp[ nopt]->value = value;
04565 temp[ nopt]->description = description;
04566
04567 this->other = temp;
04568 this->numberOfOtherOptions = ++nopt;
04569
04570 return true;
04571 }
04572 catch(const ErrorClass& eclass)
04573 {
04574 cout << eclass.errormsg << endl;
04575 return false;
04576 }
04577 }
04578
04584 bool JobDependencies::setJobID(int numberOfJobIDs, std::string *jobID)
04585 {
04586 try
04587 {
04588 if (this->jobID != NULL)
04589
04590 return false;
04591
04592 if (numberOfJobIDs < 0)
04593
04594 return false;
04595
04596 this->numberOfJobIDs = numberOfJobIDs;
04597 if (numberOfJobIDs == 0)
04598 return true;
04599
04600 this->jobID = new std::string[numberOfJobIDs];
04601 int i;
04602 for (i = 0; i < numberOfJobIDs; i++)
04603 this->jobID[i] = jobID[i];
04604
04605 return true;
04606 }
04607 catch(const ErrorClass& eclass)
04608 {
04609 cout << eclass.errormsg << endl;
04610 return false;
04611 }
04612 }
04613
04619 bool JobDependencies::addJobID(std::string jobID)
04620 {
04621 try
04622 {
04623 int nopt;
04624 if (jobID.empty() )
04625
04626 return false;
04627
04628 if (this->jobID == NULL)
04629 nopt = 0;
04630 else
04631 nopt = this->numberOfJobIDs;
04632
04633 std::string* temp = new std::string[nopt+1];
04634 int i;
04635 for (i = 0; i < nopt; i++)
04636 temp[i] = this->jobID[i];
04637
04638 delete[] this->jobID;
04639
04640 temp[nopt] = jobID;
04641
04642 this->jobID = temp;
04643 this->numberOfJobIDs = ++nopt;
04644 return true;
04645 }
04646 catch(const ErrorClass& eclass)
04647 {
04648 cout << eclass.errormsg << endl;
04649 return false;
04650 }
04651 }
04652
04659 bool DirectoriesAndFiles::setPath(int numberOfPaths, std::string *path)
04660 {
04661 try
04662 {
04663 if (this->path != NULL)
04664
04665 return false;
04666
04667 if (numberOfPaths < 0)
04668
04669 return false;
04670
04671 this->numberOfPaths = numberOfPaths;
04672 if (numberOfPaths == 0)
04673 return true;
04674
04675 this->path = new std::string[numberOfPaths];
04676 int i;
04677 for (i = 0; i < numberOfPaths; i++)
04678 this->path[i] = path[i];
04679
04680 return true;
04681 }
04682 catch(const ErrorClass& eclass)
04683 {
04684 cout << eclass.errormsg << endl;
04685 return false;
04686 }
04687 }
04688
04694 bool DirectoriesAndFiles::addPath(std::string path)
04695 {
04696 try
04697 {
04698 int nopt;
04699 if (path.empty() )
04700
04701 return false;
04702
04703 if (this->path == NULL)
04704 nopt = 0;
04705 else
04706 nopt = this->numberOfPaths;
04707
04708 std::string* temp = new std::string[nopt+1];
04709 int i;
04710 for (i = 0; i < nopt; i++)
04711 temp[i] = this->path[i];
04712
04713 delete[] this->path;
04714
04715 temp[nopt] = path;
04716
04717 this->path = temp;
04718 this->numberOfPaths = ++nopt;
04719 return true;
04720 }
04721 catch(const ErrorClass& eclass)
04722 {
04723 cout << eclass.errormsg << endl;
04724 return false;
04725 }
04726 }
04727
04734 bool PathPairs::setPathPair(int numberOfPathPairs, PathPair **pathPair)
04735 {
04736 try
04737 {
04738 if (this->pathPair != NULL)
04739
04740 return false;
04741
04742 if (numberOfPathPairs < 0)
04743
04744 return false;
04745
04746 this->numberOfPathPairs = numberOfPathPairs;
04747 if (numberOfPathPairs == 0)
04748 return true;
04749
04750 this->pathPair = new PathPair*[numberOfPathPairs];
04751
04752 int i;
04753 for (i = 0; i < numberOfPathPairs; i++)
04754 {
04755 this->pathPair[i] = new PathPair();
04756 *this->pathPair[i] = *pathPair[i];
04757 }
04758 return true;
04759 }
04760 catch(const ErrorClass& eclass)
04761 {
04762 cout << eclass.errormsg << endl;
04763 return false;
04764 }
04765 }
04766
04767
04768 bool PathPairs::setPathPair(std::string *from, std::string *to, bool *makeCopy, int numberOfPathPairs)
04769 {
04770
04771
04772
04773 this->numberOfPathPairs = numberOfPathPairs;
04774 if (numberOfPathPairs == 0)
04775 return true;
04776
04777 this->pathPair = new PathPair*[numberOfPathPairs];
04778
04779 int i;
04780 for (i = 0; i < numberOfPathPairs; i++)
04781 {
04782 this->pathPair[i] = new PathPair();
04783 this->pathPair[i]->from = from[i];
04784 this->pathPair[i]->to = to[i];
04785 this->pathPair[i]->makeCopy = makeCopy[i];
04786 }
04787 return true;
04788 }
04789
04797 bool PathPairs::addPathPair(std::string fromPath, std::string toPath, bool makeCopy)
04798 {
04799 try
04800 {
04801 int nopt;
04802 int i;
04803 if (fromPath.empty() )
04804
04805 return false;
04806 if (toPath.empty() )
04807
04808 return false;
04809
04810 if (this->pathPair == NULL)
04811 nopt = 0;
04812 else
04813 nopt = this->numberOfPathPairs;
04814
04815 PathPair** temp = new PathPair*[nopt+1];
04816 for (i = 0; i < nopt; i++)
04817 temp[i] = this->pathPair[i];
04818
04819 delete[] this->pathPair;
04820
04821
04822 temp[ nopt] = new PathPair();
04823
04824 temp[ nopt]->from = fromPath;
04825 temp[ nopt]->to = toPath;
04826 temp[ nopt]->makeCopy = makeCopy;
04827
04828 this->pathPair = temp;
04829 this->numberOfPathPairs = ++nopt;
04830
04831 return true;
04832 }
04833 catch(const ErrorClass& eclass)
04834 {
04835 cout << eclass.errormsg << endl;
04836 return false;
04837 }
04838 }
04839
04846 bool Processes::setProcess(int numberOfProcesses, std::string *process)
04847 {
04848 try
04849 {
04850 if (this->process != NULL)
04851
04852 return false;
04853
04854 if (numberOfProcesses < 0)
04855
04856 return false;
04857
04858 this->numberOfProcesses= numberOfProcesses;
04859 if (numberOfProcesses == 0)
04860 return true;
04861
04862 this->process = new std::string[numberOfProcesses];
04863 int i;
04864 for (i = 0; i < numberOfProcesses; i++)
04865 this->process[i] = process[i];
04866
04867 return true;
04868 }
04869 catch(const ErrorClass& eclass)
04870 {
04871 cout << eclass.errormsg << endl;
04872 return false;
04873 }
04874 }
04875
04881 bool Processes::addProcess(std::string process)
04882 {
04883 try
04884 {
04885 int nopt;
04886 if (process.empty() )
04887 throw ErrorClass( "the name of a process cannot be empty." );
04888
04889 if (this->process == NULL)
04890 nopt = 0;
04891 else
04892 nopt = this->numberOfProcesses;
04893
04894 std::string* temp = new std::string[nopt+1];
04895 int i;
04896 for (i = 0; i < nopt; i++)
04897 temp[i] = this->process[i];
04898
04899 delete[] this->process;
04900
04901 temp[nopt] = process;
04902
04903 this->process = temp;
04904 this->numberOfProcesses = ++nopt;
04905 return true;
04906 }
04907 catch(const ErrorClass& eclass)
04908 {
04909 cout << eclass.errormsg << endl;
04910 return false;
04911 }
04912 }
04913
04920 bool InitVariableValues::setVar(int numberOfVar, InitVarValue **var)
04921 {
04922 try
04923 {
04924 if (this->var != NULL)
04925 throw ErrorClass( "InitVarValue array previously used.");
04926
04927 if (numberOfVar < 0)
04928 throw ErrorClass( "length of var array cannot be negative.");
04929
04930 this->numberOfVar = numberOfVar;
04931 if (numberOfVar == 0)
04932 return true;
04933
04934 this->var = new InitVarValue*[numberOfVar];
04935
04936 int i;
04937 for (i = 0; i < numberOfVar; i++)
04938 {
04939 this->var[i] = new InitVarValue();
04940 *this->var[i] = *var[i];
04941 }
04942 return true;
04943 }
04944 catch(const ErrorClass& eclass)
04945 {
04946 cout << eclass.errormsg << endl;
04947 return false;
04948 }
04949 }
04950
04959 bool InitVariableValues::setVar(int numberOfVar, int *idx, double *value, std::string *name)
04960 {
04961 if (this->var != NULL)
04962 return false;
04963
04964 if (numberOfVar < 0)
04965 return false;
04966
04967 this->numberOfVar = numberOfVar;
04968 if (numberOfVar == 0)
04969 return true;
04970
04971 this->var = new InitVarValue*[numberOfVar];
04972
04973 int i;
04974 for (i = 0; i < numberOfVar; i++)
04975 {
04976 this->var[i] = new InitVarValue();
04977 this->var[i]->idx = idx[i];
04978 this->var[i]->name = name[i];
04979 this->var[i]->value = value[i];
04980 }
04981 return true;
04982 }
04983
04984
04991 bool InitVariableValues::addVar(int idx, double value)
04992 {
04993 try
04994 {
04995 int nopt;
04996 int i;
04997 if (idx < 0)
04998 throw ErrorClass( "the index of a variable cannot be negative." );
04999
05000 if (this->var == NULL)
05001 nopt = 0;
05002 else
05003 nopt = this->numberOfVar;
05004
05005 InitVarValue** temp = new InitVarValue*[nopt+1];
05006 for (i = 0; i < nopt; i++)
05007 temp[i] = this->var[i];
05008
05009 delete[] this->var;
05010
05011
05012 temp[ nopt] = new InitVarValue();
05013
05014 temp[ nopt]->idx = idx;
05015 temp[ nopt]->value = value;
05016
05017 this->var = temp;
05018 this->numberOfVar = ++nopt;
05019
05020 return true;
05021 }
05022 catch(const ErrorClass& eclass)
05023 {
05024 cout << eclass.errormsg << endl;
05025 return false;
05026 }
05027 }
05028
05035 bool InitVariableValuesString::setVar(int numberOfVar, InitVarValueString **var)
05036 {
05037 try
05038 {
05039 if (this->var != NULL)
05040 throw ErrorClass( "InitVarValueString array previously used.");
05041
05042 if (numberOfVar < 0)
05043 throw ErrorClass( "length of var array cannot be negative.");
05044
05045 this->numberOfVar = numberOfVar;
05046 if (numberOfVar == 0)
05047 return true;
05048
05049 this->var = new InitVarValueString*[numberOfVar];
05050
05051 int i;
05052 for (i = 0; i < numberOfVar; i++)
05053 {
05054 this->var[i] = new InitVarValueString();
05055 *this->var[i] = *var[i];
05056 }
05057 return true;
05058 }
05059 catch(const ErrorClass& eclass)
05060 {
05061 cout << eclass.errormsg << endl;
05062 return false;
05063 }
05064 }
05065
05066
05075 bool InitVariableValuesString::setVar(int numberOfVar, int *idx, std::string *value, std::string *name)
05076 {
05077 if (this->var != NULL)
05078 return false;
05079
05080 if (numberOfVar < 0)
05081 return false;
05082
05083 this->numberOfVar = numberOfVar;
05084 if (numberOfVar == 0)
05085 return true;
05086
05087 this->var = new InitVarValueString*[numberOfVar];
05088
05089 int i;
05090 for (i = 0; i < numberOfVar; i++)
05091 {
05092 this->var[i] = new InitVarValueString();
05093 this->var[i]->idx = idx[i];
05094 this->var[i]->name = name[i];
05095 this->var[i]->value = value[i];
05096 }
05097 return true;
05098 }
05099
05106 bool InitVariableValuesString::addVar(int idx, std::string value)
05107 {
05108 try
05109 {
05110 int nopt;
05111 int i;
05112 if (idx < 0)
05113 throw ErrorClass( "the index of a variable cannot be negative." );
05114
05115 if (this->var == NULL)
05116 nopt = 0;
05117 else
05118 nopt = this->numberOfVar;
05119
05120 InitVarValueString** temp = new InitVarValueString*[nopt+1];
05121 for (i = 0; i < nopt; i++)
05122 temp[i] = this->var[i];
05123
05124 delete[] this->var;
05125
05126
05127 temp[ nopt] = new InitVarValueString();
05128
05129 temp[ nopt]->idx = idx;
05130 temp[ nopt]->value = value;
05131
05132 this->var = temp;
05133 this->numberOfVar = ++nopt;
05134
05135 return true;
05136 }
05137 catch(const ErrorClass& eclass)
05138 {
05139 cout << eclass.errormsg << endl;
05140 return false;
05141 }
05142 }
05143
05150 bool InitialBasisStatus::setVar(int numberOfVar, InitBasStatus **var)
05151 {
05152 try
05153 {
05154 if (this->var != NULL)
05155 throw ErrorClass( "InitBasStatus array previously used.");
05156
05157 if (numberOfVar < 0)
05158 throw ErrorClass( "length of var array cannot be negative.");
05159
05160 this->numberOfVar = numberOfVar;
05161 if (numberOfVar == 0)
05162 return true;
05163
05164 this->var = new InitBasStatus*[numberOfVar];
05165
05166 int i;
05167 for (i = 0; i < numberOfVar; i++)
05168 {
05169 this->var[i] = new InitBasStatus();
05170 *this->var[i] = *var[i];
05171 }
05172 return true;
05173 }
05174 catch(const ErrorClass& eclass)
05175 {
05176 cout << eclass.errormsg << endl;
05177 return false;
05178 }
05179 }
05180
05187 bool InitialBasisStatus::addVar(int idx, std::string value)
05188 {
05189 try
05190 {
05191 int nopt;
05192 int i;
05193 if (idx < 0)
05194 throw ErrorClass( "the index of a variable cannot be negative." );
05195 if (value != "atLower" && value != "basic" && value != "unknown" &&
05196 value != "atUpper" && value != "superbasic" )
05197 throw ErrorClass( "Illegal basis status " + value );
05198
05199 if (this->var == NULL)
05200 nopt = 0;
05201 else
05202 nopt = this->numberOfVar;
05203
05204 InitBasStatus** temp = new InitBasStatus*[nopt+1];
05205 for (i = 0; i < nopt; i++)
05206 temp[i] = this->var[i];
05207
05208 delete[] this->var;
05209
05210
05211 temp[ nopt] = new InitBasStatus();
05212
05213 temp[ nopt]->idx = idx;
05214 temp[ nopt]->value = value;
05215
05216 this->var = temp;
05217 this->numberOfVar = ++nopt;
05218
05219 return true;
05220 }
05221 catch(const ErrorClass& eclass)
05222 {
05223 cout << eclass.errormsg << endl;
05224 return false;
05225 }
05226 }
05227
05234 bool IntegerVariableBranchingWeights::setVar(int numberOfVar, BranchingWeight **var)
05235 {
05236 try
05237 {
05238 if (this->var != NULL)
05239 return false;
05240
05241 if (numberOfVar < 0)
05242 return false;
05243
05244 this->numberOfVar = numberOfVar;
05245 if (numberOfVar == 0)
05246 return true;
05247
05248 this->var = new BranchingWeight*[numberOfVar];
05249
05250 int i;
05251 for (i = 0; i < numberOfVar; i++)
05252 {
05253 this->var[i] = new BranchingWeight();
05254 *this->var[i] = *var[i];
05255 }
05256 return true;
05257 }
05258 catch(const ErrorClass& eclass)
05259 {
05260 cout << eclass.errormsg << endl;
05261 return false;
05262 }
05263 }
05264
05265
05274 bool IntegerVariableBranchingWeights::setVar(int numberOfVar, int *idx, double *value, std::string *name)
05275 {
05276 if (this->var != NULL)
05277 return false;
05278
05279 if (numberOfVar < 0)
05280 return false;
05281
05282 this->numberOfVar = numberOfVar;
05283 if (numberOfVar == 0)
05284 return true;
05285
05286 this->var = new BranchingWeight*[numberOfVar];
05287
05288 int i;
05289 for (i = 0; i < numberOfVar; i++)
05290 {
05291 this->var[i] = new BranchingWeight();
05292 this->var[i]->idx = idx[i];
05293 this->var[i]->name = name[i];
05294 this->var[i]->value = value[i];
05295 }
05296 return true;
05297 }
05298
05299
05300
05301
05308 bool IntegerVariableBranchingWeights::addVar(int idx, double value)
05309 {
05310 try
05311 {
05312 int nopt;
05313 int i;
05314 if (idx < 0)
05315 throw ErrorClass( "the index of a variable cannot be negative." );
05316
05317 if (this->var == NULL)
05318 nopt = 0;
05319 else
05320 nopt = this->numberOfVar;
05321
05322 BranchingWeight** temp = new BranchingWeight*[nopt+1];
05323 for (i = 0; i < nopt; i++)
05324 temp[i] = this->var[i];
05325
05326 delete[] this->var;
05327
05328
05329 temp[ nopt] = new BranchingWeight();
05330
05331 temp[ nopt]->idx = idx;
05332 temp[ nopt]->value = value;
05333
05334 this->var = temp;
05335 this->numberOfVar = ++nopt;
05336
05337 return true;
05338 }
05339 catch(const ErrorClass& eclass)
05340 {
05341 cout << eclass.errormsg << endl;
05342 return false;
05343 }
05344 }
05345
05352 bool SOSWeights::setVar(int numberOfVar, BranchingWeight **var)
05353 {
05354 try
05355 {
05356 if (this->var != NULL)
05357 throw ErrorClass( "BranchingWeight array previously used.");
05358
05359 if (numberOfVar < 0)
05360 throw ErrorClass( "length of var array cannot be negative.");
05361
05362 this->numberOfVar = numberOfVar;
05363 if (numberOfVar == 0)
05364 return true;
05365
05366 this->var = new BranchingWeight*[numberOfVar];
05367
05368 int i;
05369 for (i = 0; i < numberOfVar; i++)
05370 {
05371 this->var[i] = new BranchingWeight();
05372 *this->var[i] = *var[i];
05373 }
05374 return true;
05375 }
05376 catch(const ErrorClass& eclass)
05377 {
05378 cout << eclass.errormsg << endl;
05379 return false;
05380 }
05381 }
05382
05389 bool SOSWeights::addVar(int idx, double value)
05390 {
05391 try
05392 {
05393 int nopt;
05394 int i;
05395 if (idx < 0)
05396 throw ErrorClass( "the index of a variable cannot be negative." );
05397
05398 if (this->var == NULL)
05399 nopt = 0;
05400 else
05401 nopt = this->numberOfVar;
05402
05403 BranchingWeight** temp = new BranchingWeight*[nopt+1];
05404 for (i = 0; i < nopt; i++)
05405 temp[i] = this->var[i];
05406
05407 delete[] this->var;
05408
05409
05410 temp[ nopt] = new BranchingWeight();
05411
05412 temp[ nopt]->idx = idx;
05413 temp[ nopt]->value = value;
05414
05415 this->var = temp;
05416 this->numberOfVar = ++nopt;
05417
05418 return true;
05419 }
05420 catch(const ErrorClass& eclass)
05421 {
05422 cout << eclass.errormsg << endl;
05423 return false;
05424 }
05425 }
05426
05433 bool SOSVariableBranchingWeights::setSOS(int numberOfSOS, SOSWeights **sos)
05434 {
05435 try
05436 {
05437 if (this->sos != NULL)
05438 throw ErrorClass( "SOS array previously used.");
05439
05440 if (numberOfSOS < 0)
05441 throw ErrorClass( "length of sos array cannot be negative.");
05442
05443 this->numberOfSOS = numberOfSOS;
05444 if (numberOfSOS == 0) return true;
05445
05446 this->sos = new SOSWeights*[numberOfSOS];
05447
05448 int i, j;
05449 for (i = 0; i < numberOfSOS; i++)
05450 {
05451 this->sos[i] = new SOSWeights();
05452 this->sos[i]->sosIdx = sos[i]->sosIdx;
05453 this->sos[i]->groupWeight = sos[i]->groupWeight;
05454
05455 if (sos[i]->numberOfVar < 0)
05456 throw ErrorClass( "the number of variables in the SOS cannot be negative.");
05457
05458 this->sos[i]->numberOfVar = sos[i]->numberOfVar;
05459
05460 if (sos[i]->numberOfVar > 0)
05461 {
05462 this->sos[i]->var = new BranchingWeight*[sos[i]->numberOfVar];
05463 for (j = 0; j < sos[i]->numberOfVar; j++)
05464 {
05465 this->sos[i]->var[j] = new BranchingWeight();
05466 *this->sos[i]->var[j] = *sos[i]->var[j];
05467 }
05468 }
05469 }
05470 return true;
05471 }
05472 catch(const ErrorClass& eclass)
05473 {
05474 cout << eclass.errormsg << endl;
05475 return false;
05476 }
05477 }
05478
05484 bool SOSVariableBranchingWeights::addSOS(int sosIdx, int nvar, double weight, int* idx, double* value, std::string* name)
05485 {
05486 try
05487 {
05488 int nopt;
05489 int i;
05490 if (sosIdx < 0)
05491 throw ErrorClass( "the index of the SOS cannot be negative." );
05492 if (nvar < 0)
05493 throw ErrorClass( "the number of variables in the SOS cannot be negative." );
05494
05495 if (this->sos == NULL)
05496 nopt = 0;
05497 else
05498 nopt = this->numberOfSOS;
05499
05500 SOSWeights** temp = new SOSWeights*[nopt+1];
05501 for (i = 0; i < nopt; i++)
05502 temp[i] = this->sos[i];
05503
05504 delete[] this->sos;
05505
05506
05507 temp[ nopt] = new SOSWeights();
05508
05509 temp[ nopt]->sosIdx = sosIdx;
05510 temp[ nopt]->groupWeight = weight;
05511 temp[ nopt]->numberOfVar = nvar;
05512 temp[ nopt]->var = new BranchingWeight*[nvar];
05513 for (i = 0; i < nvar; i++)
05514 {
05515 temp[nopt]->var[i] = new BranchingWeight();
05516 temp[nopt]->var[i]->idx = idx[i];
05517 temp[nopt]->var[i]->name = name[i];
05518 temp[nopt]->var[i]->value = value[i];
05519 }
05520
05521 this->sos = temp;
05522 this->numberOfSOS = ++nopt;
05523
05524 return true;
05525 }
05526 catch(const ErrorClass& eclass)
05527 {
05528 cout << eclass.errormsg << endl;
05529 return false;
05530 }
05531 }
05532
05539 bool OtherVariableOption::setVar(int numberOfVar, OtherVarOption **var)
05540 {
05541 try
05542 {
05543 if (this->var != NULL)
05544 throw ErrorClass( "OtherVarOption array previously used.");
05545
05546 if (numberOfVar < 0)
05547 throw ErrorClass( "length of <var> array cannot be negative.");
05548
05549 this->numberOfVar = numberOfVar;
05550 if (numberOfVar == 0) return true;
05551
05552 this->var = new OtherVarOption*[numberOfVar];
05553
05554 int i;
05555 for (i = 0; i < numberOfVar; i++)
05556 {
05557 this->var[i] = new OtherVarOption();
05558 *this->var[i] = *var[i];
05559 }
05560 return true;
05561 }
05562 catch(const ErrorClass& eclass)
05563 {
05564 cout << eclass.errormsg << endl;
05565 return false;
05566 }
05567 }
05568
05577 bool OtherVariableOption::addVar(int idx, std::string value, std::string lbValue, std::string ubValue)
05578 {
05579 try
05580 {
05581 int nopt;
05582 int i;
05583 if (idx < 0)
05584 throw ErrorClass( "the index of a variable cannot be negative." );
05585
05586 if (this->var == NULL)
05587 nopt = 0;
05588 else
05589 nopt = this->numberOfVar;
05590
05591 OtherVarOption** temp = new OtherVarOption*[nopt+1];
05592 for (i = 0; i < nopt; i++)
05593 temp[i] = this->var[i];
05594
05595 delete[] this->var;
05596
05597
05598 temp[ nopt] = new OtherVarOption();
05599
05600 temp[ nopt]->idx = idx;
05601 temp[ nopt]->value = value;
05602 temp[ nopt]->lbValue = lbValue;
05603 temp[ nopt]->ubValue = ubValue;
05604
05605 this->var = temp;
05606 this->numberOfVar = ++nopt;
05607
05608 return true;
05609 }
05610 catch(const ErrorClass& eclass)
05611 {
05612 cout << eclass.errormsg << endl;
05613 return false;
05614 }
05615 }
05616
05623 bool VariableOption::setOther(int numberOfOptions, OtherVariableOption **other)
05624 {
05625 try
05626 {
05627 if (this->other != NULL)
05628 throw ErrorClass( "otherVariableOptions array previously used.");
05629
05630 if (numberOfOptions < 0)
05631 throw ErrorClass( "length of <other> array cannot be negative.");
05632
05633 this->numberOfOtherVariableOptions = numberOfOptions;
05634 if (numberOfOptions == 0) return true;
05635
05636 this->other = new OtherVariableOption*[numberOfOptions];
05637
05638 int i, j;
05639 for (i = 0; i < numberOfOptions; i++)
05640 {
05641 this->other[i] = new OtherVariableOption();
05642 this->other[i]->name = other[i]->name;
05643 this->other[i]->value = other[i]->value;
05644 this->other[i]->solver = other[i]->solver;
05645 this->other[i]->category = other[i]->category;
05646 this->other[i]->type = other[i]->type;
05647 this->other[i]->description = other[i]->description;
05648
05649 if (other[i]->numberOfVar < 0)
05650 throw ErrorClass( "the number of variables in otherVariableOption cannot be negative.");
05651
05652 this->other[i]->numberOfVar = other[i]->numberOfVar;
05653
05654 if (other[i]->numberOfVar > 0)
05655 {
05656 this->other[i]->var = new OtherVarOption*[other[i]->numberOfVar];
05657 for (j = 0; j < other[i]->numberOfVar; j++)
05658 {
05659 this->other[i]->var[j] = new OtherVarOption();
05660 *this->other[i]->var[j] = *other[i]->var[j];
05661 }
05662 }
05663 this->other[i]->numberOfEnumerations = other[i]->numberOfEnumerations;
05664
05665 if (this->other[i]->numberOfEnumerations > 0)
05666 {
05667 this->other[i]->enumeration = new OtherOptionEnumeration*[this->other[i]->numberOfEnumerations];
05668 for (j = 0; j < this->other[i]->numberOfEnumerations; j++)
05669 {
05670 this->other[i]->enumeration[j] = new OtherOptionEnumeration();
05671 this->other[i]->enumeration[j]->setOtherOptionEnumeration(
05672 other[i]->enumeration[j]->value,
05673 other[i]->enumeration[j]->description,
05674 other[i]->enumeration[j]->el,
05675 other[i]->enumeration[j]->numberOfEl);
05676 }
05677 }
05678 }
05679 return true;
05680 }
05681 catch(const ErrorClass& eclass)
05682 {
05683 cout << eclass.errormsg << endl;
05684 return false;
05685 }
05686 }
05687
05693 bool VariableOption::addOther(OtherVariableOption *other)
05694 {
05695 try
05696 {
05697 int nopt, i, j;
05698 if (this->other == NULL)
05699 nopt = 0;
05700 else
05701 nopt = this->numberOfOtherVariableOptions;
05702
05703 OtherVariableOption** temp = new OtherVariableOption*[nopt+1];
05704 for (i = 0; i < nopt; i++)
05705 temp[i] = this->other[i];
05706
05707 delete[] this->other;
05708
05709
05710 temp[ nopt] = new OtherVariableOption();
05711 temp[ nopt]->name = other->name;
05712 temp[ nopt]->value = other->value;
05713 temp[ nopt]->solver = other->solver;
05714 temp[ nopt]->category = other->category;
05715 temp[ nopt]->type = other->type;
05716 temp[ nopt]->description = other->description;
05717
05718 if (other->numberOfVar < 0)
05719 throw ErrorClass( "the number of variables in otherVariableOption cannot be negative.");
05720
05721 temp[ nopt]->numberOfVar = other->numberOfVar;
05722
05723 if (other->numberOfVar > 0)
05724 {
05725 temp[ nopt]->var = new OtherVarOption*[other->numberOfVar];
05726 for (j = 0; j < other->numberOfVar; j++)
05727 {
05728 temp[ nopt]->var[j] = new OtherVarOption();
05729 *temp[ nopt]->var[j] = *other->var[j];
05730 }
05731 }
05732
05733 temp[ nopt]->numberOfEnumerations = other->numberOfEnumerations;
05734
05735 if (other->numberOfEnumerations > 0)
05736 {
05737 temp[ nopt]->enumeration = new OtherOptionEnumeration*[other->numberOfEnumerations];
05738 for (j = 0; j < other->numberOfEnumerations; j++)
05739 {
05740 temp[ nopt]->enumeration[j] = new OtherOptionEnumeration();
05741 temp[ nopt]->enumeration[j]->setOtherOptionEnumeration(
05742 other->enumeration[j]->value,
05743 other->enumeration[j]->description,
05744 other->enumeration[j]->el,
05745 other->enumeration[j]->numberOfEl);
05746 }
05747 }
05748
05749
05750 this->other = temp;
05751 this->numberOfOtherVariableOptions = ++nopt;
05752
05753 return true;
05754 }
05755 catch(const ErrorClass& eclass)
05756 {
05757 cout << eclass.errormsg << endl;
05758 return false;
05759 }
05760 }
05761
05768 bool InitObjectiveValues::setObj(int numberOfObj, InitObjValue **obj)
05769 {
05770 try
05771 {
05772 if (this->obj != NULL)
05773 throw ErrorClass( "InitObjValue array previously used.");
05774
05775 if (numberOfObj < 0)
05776 throw ErrorClass( "length of obj array cannot be negative.");
05777
05778 this->numberOfObj = numberOfObj;
05779 if (numberOfObj == 0)
05780 return true;
05781
05782 this->obj = new InitObjValue*[numberOfObj];
05783
05784 int i;
05785 for (i = 0; i < numberOfObj; i++)
05786 {
05787 this->obj[i] = new InitObjValue();
05788 *this->obj[i] = *obj[i];
05789 }
05790 return true;
05791 }
05792 catch(const ErrorClass& eclass)
05793 {
05794 cout << eclass.errormsg << endl;
05795 return false;
05796 }
05797 }
05798
05799 bool InitObjectiveValues::setObj(int numberOfObj, int *idx, double *value, std::string *name)
05800 {
05801 if (this->obj != NULL) return false;
05802
05803 if (numberOfObj < 0) return false;
05804
05805 this->numberOfObj = numberOfObj;
05806 if (numberOfObj == 0) return true;
05807
05808 this->obj = new InitObjValue*[numberOfObj];
05809
05810 int i;
05811 for (i = 0; i < numberOfObj; i++)
05812 {
05813 this->obj[i] = new InitObjValue();
05814 this->obj[i]->idx = idx[i];
05815 this->obj[i]->name = name[i];
05816 this->obj[i]->value = value[i];
05817 }
05818 return true;
05819 }
05820
05821
05828 bool InitObjectiveValues::addObj(int idx, double value)
05829 {
05830 try
05831 {
05832 int nopt;
05833 int i;
05834 if (idx >= 0)
05835 throw ErrorClass( "the index of an objective must be negative." );
05836
05837 if (this->obj == NULL)
05838 nopt = 0;
05839 else
05840 nopt = this->numberOfObj;
05841
05842 InitObjValue** temp = new InitObjValue*[nopt+1];
05843 for (i = 0; i < nopt; i++)
05844 temp[i] = this->obj[i];
05845
05846 delete[] this->obj;
05847
05848
05849 temp[ nopt] = new InitObjValue();
05850
05851 temp[ nopt]->idx = idx;
05852 temp[ nopt]->value = value;
05853
05854 this->obj = temp;
05855 this->numberOfObj = ++nopt;
05856
05857 return true;
05858 }
05859 catch(const ErrorClass& eclass)
05860 {
05861 cout << eclass.errormsg << endl;
05862 return false;
05863 }
05864 }
05865
05872 bool InitObjectiveBounds::setObj(int numberOfObj, InitObjBound **obj)
05873 {
05874 try
05875 {
05876 if (this->obj != NULL)
05877 throw ErrorClass( "InitObjBound array previously used.");
05878
05879 if (numberOfObj < 0)
05880 throw ErrorClass( "length of obj array cannot be negative.");
05881
05882 this->numberOfObj = numberOfObj;
05883 if (numberOfObj == 0)
05884 return true;
05885
05886 this->obj = new InitObjBound*[numberOfObj];
05887
05888 int i;
05889 for (i = 0; i < numberOfObj; i++)
05890 {
05891 this->obj[i] = new InitObjBound();
05892 *this->obj[i] = *obj[i];
05893 }
05894 return true;
05895 }
05896 catch(const ErrorClass& eclass)
05897 {
05898 cout << eclass.errormsg << endl;
05899 return false;
05900 }
05901 }
05902
05903 bool InitObjectiveBounds::setObj(int numberOfObj, int *idx, double *lbValue, double *ubValue, std::string *name)
05904 {
05905 if (this->obj != NULL)
05906 return false;
05907
05908 if (numberOfObj < 0)
05909 return false;
05910
05911 this->numberOfObj = numberOfObj;
05912 if (numberOfObj == 0)
05913 return true;
05914
05915 this->obj = new InitObjBound*[numberOfObj];
05916
05917 int i;
05918 for (i = 0; i < numberOfObj; i++)
05919 {
05920 this->obj[i] = new InitObjBound();
05921 this->obj[i]->idx = idx[i];
05922 this->obj[i]->name = name[i];
05923 this->obj[i]->lbValue = lbValue[i];
05924 this->obj[i]->ubValue = ubValue[i];
05925 }
05926 return true;
05927 }
05928
05929
05937 bool InitObjectiveBounds::addObj(int idx, double lbValue, double ubValue)
05938 {
05939 try
05940 {
05941 int nopt;
05942 int i;
05943 if (idx >= 0)
05944 throw ErrorClass( "the index of an objective must be negative." );
05945
05946 if (this->obj == NULL)
05947 nopt = 0;
05948 else
05949 nopt = this->numberOfObj;
05950
05951 InitObjBound** temp = new InitObjBound*[nopt+1];
05952 for (i = 0; i < nopt; i++)
05953 temp[i] = this->obj[i];
05954
05955 delete[] this->obj;
05956
05957
05958 temp[ nopt] = new InitObjBound();
05959
05960 temp[ nopt]->idx = idx;
05961 temp[ nopt]->lbValue = lbValue;
05962 temp[ nopt]->ubValue = ubValue;
05963
05964 this->obj = temp;
05965 this->numberOfObj = ++nopt;
05966
05967 return true;
05968 }
05969 catch(const ErrorClass& eclass)
05970 {
05971 cout << eclass.errormsg << endl;
05972 return false;
05973 }
05974 }
05975
05982 bool OtherObjectiveOption::setObj(int numberOfObj, OtherObjOption **obj)
05983 {
05984 try
05985 {
05986 if (this->obj != NULL)
05987 throw ErrorClass( "OtherObjOption array previously used.");
05988
05989 if (numberOfObj < 0)
05990 throw ErrorClass( "length of <obj> array cannot be negative.");
05991
05992 this->numberOfObj= numberOfObj;
05993 if (numberOfObj == 0)
05994 return true;
05995
05996 this->obj = new OtherObjOption*[numberOfObj];
05997
05998 int i;
05999 for (i = 0; i < numberOfObj; i++)
06000 {
06001 this->obj[i] = new OtherObjOption();
06002 *this->obj[i] = *obj[i];
06003 }
06004 return true;
06005 }
06006 catch(const ErrorClass& eclass)
06007 {
06008 cout << eclass.errormsg << endl;
06009 return false;
06010 }
06011 }
06012
06021 bool OtherObjectiveOption::addObj(int idx, std::string value, std::string lbValue, std::string ubValue)
06022 {
06023 try
06024 {
06025 int nopt;
06026 int i;
06027 if (idx >= 0)
06028 throw ErrorClass( "the index of an objective must be negative." );
06029
06030 if (this->obj == NULL)
06031 nopt = 0;
06032 else
06033 nopt = this->numberOfObj;
06034
06035 OtherObjOption** temp = new OtherObjOption*[nopt+1];
06036 for (i = 0; i < nopt; i++)
06037 temp[i] = this->obj[i];
06038
06039 delete[] this->obj;
06040
06041
06042 temp[ nopt] = new OtherObjOption();
06043
06044 temp[ nopt]->idx = idx;
06045 temp[ nopt]->value = value;
06046 temp[ nopt]->lbValue = lbValue;
06047 temp[ nopt]->ubValue = ubValue;
06048
06049 this->obj = temp;
06050 this->numberOfObj = ++nopt;
06051
06052 return true;
06053 }
06054 catch(const ErrorClass& eclass)
06055 {
06056 cout << eclass.errormsg << endl;
06057 return false;
06058 }
06059 }
06060
06067 bool ObjectiveOption::setOther(int numberOfOptions, OtherObjectiveOption **other)
06068 {
06069 try
06070 {
06071 if (this->other != NULL)
06072 throw ErrorClass( "otherObjectiveOptions array previously used.");
06073
06074 if (numberOfOptions < 0)
06075 throw ErrorClass( "length of <other> array cannot be negative.");
06076
06077 this->numberOfOtherObjectiveOptions = numberOfOptions;
06078 if (numberOfOptions == 0) return true;
06079
06080 this->other = new OtherObjectiveOption*[numberOfOptions];
06081
06082 int i, j;
06083 for (i = 0; i < numberOfOptions; i++)
06084 {
06085 this->other[i] = new OtherObjectiveOption();
06086 this->other[i]->name = other[i]->name;
06087 this->other[i]->value = other[i]->value;
06088 this->other[i]->solver = other[i]->solver;
06089 this->other[i]->category = other[i]->category;
06090 this->other[i]->type = other[i]->type;
06091 this->other[i]->description = other[i]->description;
06092
06093 if (other[i]->numberOfObj < 0)
06094 throw ErrorClass( "the number of objectives in otherObjectiveOption cannot be negative.");
06095
06096 this->other[i]->numberOfObj = other[i]->numberOfObj;
06097
06098 if (other[i]->numberOfObj > 0)
06099 {
06100 this->other[i]->obj = new OtherObjOption*[other[i]->numberOfObj];
06101 for (j = 0; j < other[i]->numberOfObj; j++)
06102 {
06103 this->other[i]->obj[j] = new OtherObjOption();
06104 *this->other[i]->obj[j] = *other[i]->obj[j];
06105 }
06106 }
06107 this->other[i]->numberOfEnumerations = other[i]->numberOfEnumerations;
06108
06109 if (this->other[i]->numberOfEnumerations > 0)
06110 {
06111 this->other[i]->enumeration = new OtherOptionEnumeration*[this->other[i]->numberOfEnumerations];
06112 for (j = 0; j < this->other[i]->numberOfEnumerations; j++)
06113 {
06114 this->other[i]->enumeration[j] = new OtherOptionEnumeration();
06115 this->other[i]->enumeration[j]->setOtherOptionEnumeration(
06116 other[i]->enumeration[j]->value,
06117 other[i]->enumeration[j]->description,
06118 other[i]->enumeration[j]->el,
06119 other[i]->enumeration[j]->numberOfEl);
06120 }
06121 }
06122 }
06123 return true;
06124 }
06125 catch(const ErrorClass& eclass)
06126 {
06127 cout << eclass.errormsg << endl;
06128 return false;
06129 }
06130 }
06131
06137 bool ObjectiveOption::addOther(OtherObjectiveOption *other)
06138 {
06139 try
06140 {
06141 int nopt, i, j;
06142 if (this->other == NULL)
06143 nopt = 0;
06144 else
06145 nopt = this->numberOfOtherObjectiveOptions;
06146
06147 OtherObjectiveOption** temp = new OtherObjectiveOption*[nopt+1];
06148 for (i = 0; i < nopt; i++)
06149 temp[i] = this->other[i];
06150
06151 delete[] this->other;
06152
06153
06154 temp[ nopt] = new OtherObjectiveOption();
06155 temp[ nopt]->name = other->name;
06156 temp[ nopt]->value = other->value;
06157 temp[ nopt]->solver = other->solver;
06158 temp[ nopt]->category = other->category;
06159 temp[ nopt]->type = other->type;
06160 temp[ nopt]->description = other->description;
06161
06162 if (other->numberOfObj < 0)
06163 throw ErrorClass( "the number of objectives in otherObjectiveOption cannot be negative.");
06164
06165 temp[ nopt]->numberOfObj = other->numberOfObj;
06166
06167 if (other->numberOfObj > 0)
06168 {
06169 temp[ nopt]->obj = new OtherObjOption*[other->numberOfObj];
06170 for (j = 0; j < other->numberOfObj; j++)
06171 {
06172 temp[ nopt]->obj[j] = new OtherObjOption();
06173 *temp[ nopt]->obj[j] = *other->obj[j];
06174 }
06175 }
06176
06177 if (other->numberOfEnumerations < 0)
06178 throw ErrorClass( "the number of enumerations in otherObjectiveOption cannot be negative.");
06179
06180 temp[ nopt]->numberOfEnumerations = other->numberOfEnumerations;
06181
06182 if (other->numberOfEnumerations > 0)
06183 {
06184 temp[ nopt]->enumeration = new OtherOptionEnumeration*[other->numberOfEnumerations];
06185 for (j = 0; j < other->numberOfEnumerations; j++)
06186 {
06187 temp[ nopt]->enumeration[j] = new OtherOptionEnumeration();
06188 temp[ nopt]->enumeration[j]->setOtherOptionEnumeration(
06189 other->enumeration[j]->value,
06190 other->enumeration[j]->description,
06191 other->enumeration[j]->el,
06192 other->enumeration[j]->numberOfEl);
06193 }
06194 }
06195
06196
06197 this->other = temp;
06198 this->numberOfOtherObjectiveOptions = ++nopt;
06199
06200 return true;
06201 }
06202 catch(const ErrorClass& eclass)
06203 {
06204 cout << eclass.errormsg << endl;
06205 return false;
06206 }
06207 }
06208
06215 bool InitConstraintValues::setCon(int numberOfCon, InitConValue **con)
06216 {
06217 try
06218 {
06219 if (this->con != NULL)
06220 throw ErrorClass( "InitConValue array previously used.");
06221
06222 if (numberOfCon < 0)
06223 throw ErrorClass( "length of con array cannot be negative.");
06224
06225 this->numberOfCon = numberOfCon;
06226 if (numberOfCon == 0)
06227 return true;
06228
06229 this->con = new InitConValue*[numberOfCon];
06230
06231 int i;
06232 for (i = 0; i < numberOfCon; i++)
06233 {
06234 this->con[i] = new InitConValue();
06235 *this->con[i] = *con[i];
06236 }
06237 return true;
06238 }
06239 catch(const ErrorClass& eclass)
06240 {
06241 cout << eclass.errormsg << endl;
06242 return false;
06243 }
06244 }
06245
06246 bool InitConstraintValues::setCon(int numberOfCon, int *idx, double *value, std::string *name)
06247 {
06248 if (this->con != NULL)
06249 return false;
06250
06251 if (numberOfCon < 0)
06252 return false;
06253
06254 this->numberOfCon = numberOfCon;
06255 if (numberOfCon == 0)
06256 return true;
06257
06258 this->con = new InitConValue*[numberOfCon];
06259
06260 int i;
06261 for (i = 0; i < numberOfCon; i++)
06262 {
06263 this->con[i] = new InitConValue();
06264 this->con[i]->idx = idx[i];
06265 this->con[i]->name = name[i];
06266 this->con[i]->value = value[i];
06267 }
06268 return true;
06269 }
06270
06271
06272
06279 bool InitConstraintValues::addCon(int idx, double value)
06280 {
06281 try
06282 {
06283 int nopt;
06284 int i;
06285 if (idx < 0)
06286 throw ErrorClass( "the index of a constraint cannot be negative." );
06287
06288 if (this->con == NULL)
06289 nopt = 0;
06290 else
06291 nopt = this->numberOfCon;
06292
06293 InitConValue** temp = new InitConValue*[nopt+1];
06294 for (i = 0; i < nopt; i++)
06295 temp[i] = this->con[i];
06296
06297 delete[] this->con;
06298
06299
06300 temp[ nopt] = new InitConValue();
06301
06302 temp[ nopt]->idx = idx;
06303 temp[ nopt]->value = value;
06304
06305 this->con = temp;
06306 this->numberOfCon = ++nopt;
06307
06308 return true;
06309 }
06310 catch(const ErrorClass& eclass)
06311 {
06312 cout << eclass.errormsg << endl;
06313 return false;
06314 }
06315 }
06316
06323 bool InitDualVariableValues::setCon(int numberOfCon, InitDualVarValue **con)
06324 {
06325 try
06326 {
06327 if (this->con != NULL)
06328 throw ErrorClass( "InitDualVarValue array previously used.");
06329
06330 if (numberOfCon < 0)
06331 throw ErrorClass( "length of con array cannot be negative.");
06332
06333 this->numberOfCon = numberOfCon;
06334 if (numberOfCon == 0)
06335 return true;
06336
06337 this->con = new InitDualVarValue*[numberOfCon];
06338
06339 int i;
06340 for (i = 0; i < numberOfCon; i++)
06341 {
06342 this->con[i] = new InitDualVarValue();
06343 *this->con[i] = *con[i];
06344 }
06345 return true;
06346 }
06347 catch(const ErrorClass& eclass)
06348 {
06349 cout << eclass.errormsg << endl;
06350 return false;
06351 }
06352 }
06353
06354 bool InitDualVariableValues::setCon(int numberOfCon, int *idx, double *lbValue, double *ubValue, std::string *name)
06355 {
06356 if (this->con != NULL)
06357 return false;
06358
06359 if (numberOfCon < 0)
06360 return false;
06361
06362 this->numberOfCon = numberOfCon;
06363 if (numberOfCon == 0)
06364 return true;
06365
06366 this->con = new InitDualVarValue*[numberOfCon];
06367
06368 int i;
06369 for (i = 0; i < numberOfCon; i++)
06370 {
06371 this->con[i] = new InitDualVarValue();
06372 this->con[i]->idx = idx[i];
06373 this->con[i]->name = name[i];
06374 this->con[i]->lbDualValue = lbValue[i];
06375 this->con[i]->ubDualValue = ubValue[i];
06376 }
06377 return true;
06378 }
06379
06380
06388 bool InitDualVariableValues::addCon(int idx, double lbDualValue, double ubDualValue)
06389 {
06390 try
06391 {
06392 int nopt;
06393 int i;
06394 if (idx < 0)
06395 throw ErrorClass( "the index of a constraint cannot be negative." );
06396
06397 if (this->con == NULL)
06398 nopt = 0;
06399 else
06400 nopt = this->numberOfCon;
06401
06402 InitDualVarValue** temp = new InitDualVarValue*[nopt+1];
06403 for (i = 0; i < nopt; i++)
06404 temp[i] = this->con[i];
06405
06406 delete[] this->con;
06407
06408
06409 temp[ nopt] = new InitDualVarValue();
06410
06411 temp[ nopt]->idx = idx;
06412 temp[ nopt]->lbDualValue = lbDualValue;
06413 temp[ nopt]->ubDualValue = ubDualValue;
06414
06415 this->con = temp;
06416 this->numberOfCon = ++nopt;
06417
06418 return true;
06419 }
06420 catch(const ErrorClass& eclass)
06421 {
06422 cout << eclass.errormsg << endl;
06423 return false;
06424 }
06425 }
06426
06433 bool OtherConstraintOption::setCon(int numberOfCon, OtherConOption **con)
06434 {
06435 try
06436 {
06437 if (this->con != NULL)
06438 throw ErrorClass( "OtherConOption array previously used.");
06439
06440 if (numberOfCon < 0)
06441 throw ErrorClass( "length of <con> array cannot be negative.");
06442
06443 this->numberOfCon = numberOfCon;
06444 if (numberOfCon == 0)
06445 return true;
06446
06447 this->con = new OtherConOption*[numberOfCon];
06448
06449 int i;
06450 for (i = 0; i < numberOfCon; i++)
06451 {
06452 this->con[i] = new OtherConOption();
06453 *this->con[i] = *con[i];
06454 }
06455 return true;
06456 }
06457 catch(const ErrorClass& eclass)
06458 {
06459 cout << eclass.errormsg << endl;
06460 return false;
06461 }
06462 }
06463
06472 bool OtherConstraintOption::addCon(int idx, std::string value, std::string lbValue, std::string ubValue)
06473 {
06474 try
06475 {
06476 int nopt;
06477 int i;
06478 if (idx < 0)
06479 throw ErrorClass( "the index of a variable cannot be negative." );
06480
06481 if (this->con == NULL)
06482 nopt = 0;
06483 else
06484 nopt = this->numberOfCon;
06485
06486 OtherConOption** temp = new OtherConOption*[nopt+1];
06487 for (i = 0; i < nopt; i++)
06488 temp[i] = this->con[i];
06489
06490 delete[] this->con;
06491
06492
06493 temp[ nopt] = new OtherConOption();
06494
06495 temp[ nopt]->idx = idx;
06496 temp[ nopt]->value = value;
06497 temp[ nopt]->lbValue = lbValue;
06498 temp[ nopt]->ubValue = ubValue;
06499
06500 this->con = temp;
06501 this->numberOfCon = ++nopt;
06502
06503 return true;
06504 }
06505 catch(const ErrorClass& eclass)
06506 {
06507 cout << eclass.errormsg << endl;
06508 return false;
06509 }
06510 }
06511
06518 bool ConstraintOption::setOther(int numberOfOptions, OtherConstraintOption **other)
06519 {
06520 try
06521 {
06522 if (this->other != NULL)
06523 throw ErrorClass( "otherConstraintOptions array previously used.");
06524
06525 if (numberOfOptions < 0)
06526 throw ErrorClass( "length of <other> array cannot be negative.");
06527
06528 this->numberOfOtherConstraintOptions = numberOfOptions;
06529 if (numberOfOptions == 0)
06530 return true;
06531
06532 this->other = new OtherConstraintOption*[numberOfOptions];
06533
06534 int i, j;
06535 for (i = 0; i < numberOfOptions; i++)
06536 {
06537 this->other[i] = new OtherConstraintOption();
06538 this->other[i]->name = other[i]->name;
06539 this->other[i]->value = other[i]->value;
06540 this->other[i]->solver = other[i]->solver;
06541 this->other[i]->category = other[i]->category;
06542 this->other[i]->type = other[i]->type;
06543 this->other[i]->description = other[i]->description;
06544
06545 if (other[i]->numberOfCon < 0)
06546 throw ErrorClass( "the number of constraints in otherConstraintOption cannot be negative.");
06547
06548 this->other[i]->numberOfCon = other[i]->numberOfCon;
06549
06550 if (other[i]->numberOfCon > 0)
06551 {
06552 this->other[i]->con = new OtherConOption*[other[i]->numberOfCon];
06553 for (j = 0; j < other[i]->numberOfCon; j++)
06554 {
06555 this->other[i]->con[j] = new OtherConOption();
06556 *this->other[i]->con[j] = *other[i]->con[j];
06557 }
06558 }
06559
06560 this->other[i]->numberOfEnumerations = other[i]->numberOfEnumerations;
06561
06562 if (this->other[i]->numberOfEnumerations > 0)
06563 {
06564 this->other[i]->enumeration = new OtherOptionEnumeration*[this->other[i]->numberOfEnumerations];
06565 for (j = 0; j < this->other[i]->numberOfEnumerations; j++)
06566 {
06567 this->other[i]->enumeration[j] = new OtherOptionEnumeration();
06568 this->other[i]->enumeration[j]->setOtherOptionEnumeration(
06569 other[i]->enumeration[j]->value,
06570 other[i]->enumeration[j]->description,
06571 other[i]->enumeration[j]->el,
06572 other[i]->enumeration[j]->numberOfEl);
06573 }
06574 }
06575
06576 }
06577 return true;
06578 }
06579 catch(const ErrorClass& eclass)
06580 {
06581 cout << eclass.errormsg << endl;
06582 return false;
06583 }
06584 }
06585
06591 bool ConstraintOption::addOther(OtherConstraintOption *other)
06592 {
06593 try
06594 {
06595 int nopt, i, j;
06596 if (this->other == NULL)
06597 nopt = 0;
06598 else
06599 nopt = this->numberOfOtherConstraintOptions;
06600
06601 OtherConstraintOption** temp = new OtherConstraintOption*[nopt+1];
06602 for (i = 0; i < nopt; i++)
06603 temp[i] = this->other[i];
06604
06605 delete[] this->other;
06606
06607
06608 temp[ nopt] = new OtherConstraintOption();
06609 temp[ nopt]->name = other->name;
06610 temp[ nopt]->value = other->value;
06611 temp[ nopt]->solver = other->solver;
06612 temp[ nopt]->category = other->category;
06613 temp[ nopt]->type = other->type;
06614 temp[ nopt]->description = other->description;
06615
06616 if (other->numberOfCon < 0)
06617 throw ErrorClass( "the number of constraints in otherConstraintOption cannot be negative.");
06618
06619 temp[ nopt]->numberOfCon = other->numberOfCon;
06620 temp[ nopt]->numberOfEnumerations = other->numberOfEnumerations;
06621
06622 if (other->numberOfCon > 0)
06623 {
06624 temp[ nopt]->con = new OtherConOption*[other->numberOfCon];
06625 for (j = 0; j < other->numberOfCon; j++)
06626 {
06627 temp[ nopt]->con[j] = new OtherConOption();
06628 *temp[ nopt]->con[j] = *other->con[j];
06629 }
06630 }
06631
06632 if (other->numberOfEnumerations < 0)
06633 throw ErrorClass( "the number of enumerations in otherObjectiveOption cannot be negative.");
06634
06635 if (other->numberOfEnumerations > 0)
06636 {
06637 temp[ nopt]->enumeration = new OtherOptionEnumeration*[other->numberOfEnumerations];
06638 for (j = 0; j < other->numberOfEnumerations; j++)
06639 {
06640 temp[ nopt]->enumeration[j] = new OtherOptionEnumeration();
06641 temp[ nopt]->enumeration[j]->setOtherOptionEnumeration(
06642 other->enumeration[j]->value,
06643 other->enumeration[j]->description,
06644 other->enumeration[j]->el,
06645 other->enumeration[j]->numberOfEl);
06646 }
06647 }
06648
06649 this->other = temp;
06650 this->numberOfOtherConstraintOptions = ++nopt;
06651
06652 return true;
06653 }
06654 catch(const ErrorClass& eclass)
06655 {
06656 cout << eclass.errormsg << endl;
06657 return false;
06658 }
06659 }
06660
06667 bool SolverOptions::setSolverOptions(int numberOfOptions, SolverOption **solverOption)
06668 {
06669 try
06670 {
06671 if (this->solverOption != NULL)
06672 throw ErrorClass( "solverOptions array previously used.");
06673
06674 if (numberOfOptions < 0)
06675 throw ErrorClass( "length of <solverOption> array cannot be negative.");
06676
06677 this->numberOfSolverOptions = numberOfOptions;
06678 if (numberOfOptions == 0)
06679 return true;
06680
06681 this->solverOption = new SolverOption*[numberOfOptions];
06682
06683 int i;
06684 for (i = 0; i < numberOfOptions; i++)
06685 {
06686 this->solverOption[i] = new SolverOption();
06687
06688 this->solverOption[i]->numberOfItems = solverOption[i]->numberOfItems;
06689 this->solverOption[i]->name = solverOption[i]->name;
06690 this->solverOption[i]->value = solverOption[i]->value;
06691 this->solverOption[i]->solver = solverOption[i]->solver;
06692 this->solverOption[i]->category = solverOption[i]->category;
06693 this->solverOption[i]->type = solverOption[i]->type;
06694 this->solverOption[i]->description = solverOption[i]->description;
06695
06696 if (solverOption[i]->numberOfItems > 0)
06697 {
06698 this->solverOption[i]->item = new std::string[solverOption[i]->numberOfItems];
06699 for (int j=0; j<solverOption[i]->numberOfItems; j++)
06700 this->solverOption[i]->item[j] = solverOption[i]->item[j];
06701 }
06702 }
06703 return true;
06704 }
06705 catch(const ErrorClass& eclass)
06706 {
06707 cout << eclass.errormsg << endl;
06708 return false;
06709 }
06710 }
06711
06722 bool SolverOptions::addSolverOption(std::string name, std::string value, std::string solver,
06723 std::string category, std::string type, std::string description)
06724 {
06725 try
06726 {
06727 int nopt;
06728 int i;
06729 if (name.empty() )
06730 throw ErrorClass( "the name of a solver option cannot be empty." );
06731
06732 if (this->solverOption == NULL)
06733 nopt = 0;
06734 else
06735 nopt = this->numberOfSolverOptions;
06736
06737 SolverOption** temp = new SolverOption*[nopt+1];
06738 for (i = 0; i < nopt; i++)
06739 temp[i] = this->solverOption[i];
06740
06741 delete[] this->solverOption;
06742
06743
06744 temp[ nopt] = new SolverOption();
06745
06746 temp[ nopt]->numberOfItems = 0;
06747 temp[ nopt]->name = name;
06748 temp[ nopt]->value = value;
06749 temp[ nopt]->solver = solver;
06750 temp[ nopt]->type = type;
06751 temp[ nopt]->category = category;
06752 temp[ nopt]->description = description;
06753
06754 this->solverOption = temp;
06755 this->numberOfSolverOptions = ++nopt;
06756
06757 return true;
06758 }
06759 catch(const ErrorClass& eclass)
06760 {
06761 cout << eclass.errormsg << endl;
06762 return false;
06763 }
06764 }
06765
06770 bool OSOption::setOptionHeader(std::string name, std::string source,
06771 std::string description, std::string fileCreator, std::string licence)
06772 {
06773 if (this->optionHeader == NULL)
06774 this->optionHeader = new GeneralFileHeader();
06775 return this->optionHeader->setHeader(name, source, description, fileCreator, licence);
06776 }
06777
06782 bool OSOption::setServiceURI( std::string serviceURI)
06783 {
06784 if (this->general == NULL)
06785 this->general = new GeneralOption();
06786 this->general->serviceURI = serviceURI;
06787 return true;
06788 }
06789
06790 bool OSOption::setServiceName( std::string serviceName)
06791 {
06792 if (this->general == NULL)
06793 this->general = new GeneralOption();
06794 this->general->serviceName = serviceName;
06795 return true;
06796 }
06797
06798 bool OSOption::setInstanceName( std::string instanceName)
06799 {
06800 if (this->general == NULL)
06801 this->general = new GeneralOption();
06802 this->general->instanceName = instanceName;
06803 return true;
06804 }
06805
06806 bool OSOption::setInstanceLocation( std::string instanceLocation)
06807 {
06808 if (this->general == NULL)
06809 this->general = new GeneralOption();
06810 if (this->general->instanceLocation == NULL)
06811 this->general->instanceLocation = new InstanceLocationOption();
06812 this->general->instanceLocation->value = instanceLocation;
06813 return true;
06814 }
06815
06816 bool OSOption::setInstanceLocation( std::string instanceLocation, std::string locationType)
06817 {
06818 if (verifyLocationType(locationType) == 0)
06819 return false;
06820
06821 if (this->general == NULL)
06822 this->general = new GeneralOption();
06823 if (this->general->instanceLocation == NULL)
06824 this->general->instanceLocation = new InstanceLocationOption();
06825 this->general->instanceLocation->value = instanceLocation;
06826 this->general->instanceLocation->locationType = locationType;
06827 return true;
06828 }
06829
06830 bool OSOption::setInstanceLocationType( std::string locationType)
06831 {
06832 try
06833 {
06834 if (this->general == NULL)
06835 this->general = new GeneralOption();
06836 if (this->general->instanceLocation == NULL)
06837 this->general->instanceLocation = new InstanceLocationOption();
06838
06839 if (verifyLocationType(locationType) == 0)
06840 return false;
06841
06842 this->general->instanceLocation->locationType = locationType;
06843 return true;
06844 }
06845 catch(const ErrorClass& eclass)
06846 {
06847 cout << eclass.errormsg << endl;
06848 return false;
06849 }
06850 }
06851
06852 bool OSOption::setJobID( std::string jobID)
06853 {
06854 if (this->general == NULL)
06855 this->general = new GeneralOption();
06856 this->general->jobID = jobID;
06857 return true;
06858 }
06859
06860 bool OSOption::setSolverToInvoke( std::string solverToInvoke)
06861 {
06862 if (this->general == NULL)
06863 this->general = new GeneralOption();
06864 this->general->solverToInvoke = solverToInvoke;
06865 return true;
06866 }
06867
06868 bool OSOption::setLicense( std::string license)
06869 {
06870 if (this->general == NULL)
06871 this->general = new GeneralOption();
06872 this->general->license = license;
06873 return true;
06874 }
06875
06876 bool OSOption::setUserName( std::string userName)
06877 {
06878 if (this->general == NULL)
06879 this->general = new GeneralOption();
06880 this->general->userName = userName;
06881 return true;
06882 }
06883
06884 bool OSOption::setPassword( std::string password)
06885 {
06886 if (this->general == NULL)
06887 this->general = new GeneralOption();
06888 this->general->password = password;
06889 return true;
06890 }
06891
06892 bool OSOption::setContact( std::string contact)
06893 {
06894 if (this->general == NULL)
06895 this->general = new GeneralOption();
06896 if (this->general->contact == NULL)
06897 this->general->contact = new ContactOption();
06898 this->general->contact->value = contact;
06899 return true;
06900 }
06901
06902 bool OSOption::setContact(std::string contact,std::string transportType)
06903 {
06904 if (verifyTransportType(transportType) == 0)
06905 return false;
06906
06907 if (this->general == NULL)
06908 this->general = new GeneralOption();
06909 if (this->general->contact == NULL)
06910 this->general->contact = new ContactOption();
06911 this->general->contact->value = contact;
06912 this->general->contact->transportType = transportType;
06913 return true;
06914 }
06915
06916 bool OSOption::setContactTransportType( std::string transportType)
06917 {
06918 try
06919 {
06920 if (this->general == NULL)
06921 this->general = new GeneralOption();
06922 if (this->general->contact == NULL)
06923 this->general->contact = new ContactOption();
06924
06925 if (verifyTransportType(transportType) == 0)
06926 throw ErrorClass( "transport type not recognized.");
06927
06928 this->general->contact->transportType = transportType;
06929 return true;
06930 }
06931 catch(const ErrorClass& eclass)
06932 {
06933 cout << eclass.errormsg << endl;
06934 return false;
06935 }
06936 }
06937
06938 bool OSOption::setOtherGeneralOptions(int numberOfOptions, OtherOption** other)
06939 {
06940 if (this->general == NULL)
06941 this->general = new GeneralOption();
06942 if (this->general->otherOptions == NULL)
06943 this->general->otherOptions = new OtherOptions();
06944 else
06945 {
06946 int i;
06947 for (i = 0; i < this->general->otherOptions->numberOfOtherOptions; i++)
06948 delete this->general->otherOptions->other[i];
06949 delete[] this->general->otherOptions->other;
06950 this->general->otherOptions->other = NULL;
06951 }
06952 return this->general->otherOptions->setOther(numberOfOptions, other);
06953 }
06954
06955 bool OSOption::setAnOtherGeneralOption(std::string name, std::string value, std::string description)
06956 {
06957 if (this->general == NULL)
06958 this->general = new GeneralOption();
06959 if (this->general->otherOptions == NULL)
06960 this->general->otherOptions = new OtherOptions();
06961 return this->general->otherOptions->addOther(name, value, description);
06962 }
06963
06964
06965
06970 bool OSOption::setMinDiskSpace(std::string unit, std::string description, double value)
06971 {
06972 if (verifyStorageUnit(unit) == 0)
06973 return false;
06974
06975 if (this->system == NULL)
06976 this->system = new SystemOption();
06977 if (this->system->minDiskSpace == NULL)
06978 this->system->minDiskSpace = new StorageCapacity();
06979 this->system->minDiskSpace->unit = unit;
06980 this->system->minDiskSpace->value = value;
06981 this->system->minDiskSpace->description = description;
06982 return true;
06983 }
06984
06985 bool OSOption::setMinDiskSpace(double value)
06986 {
06987 if (this->system == NULL)
06988 this->system = new SystemOption();
06989 if (this->system->minDiskSpace == NULL)
06990 this->system->minDiskSpace = new StorageCapacity();
06991 this->system->minDiskSpace->value = value;
06992 return true;
06993 }
06994
06995 bool OSOption::setMinDiskSpaceUnit(std::string unit)
06996 {
06997 try
06998 {
06999 if (this->system == NULL)
07000 this->system = new SystemOption();
07001 if (this->system->minDiskSpace == NULL)
07002 this->system->minDiskSpace = new StorageCapacity();
07003
07004 if (verifyStorageUnit(unit) == 0)
07005 throw ErrorClass( "disk space unit not recognized.");
07006
07007 this->system->minDiskSpace->unit = unit;
07008 return true;
07009 }
07010 catch(const ErrorClass& eclass)
07011 {
07012 cout << eclass.errormsg << endl;
07013 return false;
07014 }
07015 }
07016
07017 bool OSOption::setMinMemorySize(std::string unit, std::string description, double value)
07018 {
07019 if (verifyStorageUnit(unit) == 0)
07020 return false;
07021
07022 if (this->system == NULL)
07023 this->system = new SystemOption();
07024 if (this->system->minMemorySize == NULL)
07025 this->system->minMemorySize = new StorageCapacity();
07026 this->system->minMemorySize->unit = unit;
07027 this->system->minMemorySize->value = value;
07028 this->system->minMemorySize->description = description;
07029 return true;
07030 }
07031
07032 bool OSOption::setMinMemorySize(double value)
07033 {
07034 if (this->system == NULL)
07035 this->system = new SystemOption();
07036 if (this->system->minMemorySize == NULL)
07037 this->system->minMemorySize = new StorageCapacity();
07038 this->system->minMemorySize->value = value;
07039 return true;
07040 }
07041
07042 bool OSOption::setMinMemoryUnit(std::string unit)
07043 {
07044 try
07045 {
07046 if (this->system == NULL)
07047 this->system = new SystemOption();
07048 if (this->system->minMemorySize == NULL)
07049 this->system->minMemorySize = new StorageCapacity();
07050
07051 if (verifyStorageUnit(unit) == 0)
07052 throw ErrorClass( "memory size unit not recognized.");
07053
07054 this->system->minMemorySize->unit = unit;
07055 return true;
07056 }
07057 catch(const ErrorClass& eclass)
07058 {
07059 cout << eclass.errormsg << endl;
07060 return false;
07061 }
07062 }
07063
07064 bool OSOption::setMinCPUSpeed(double value)
07065 {
07066 if (this->system == NULL)
07067 this->system = new SystemOption();
07068 if (this->system->minCPUSpeed == NULL)
07069 this->system->minCPUSpeed = new CPUSpeed();
07070 this->system->minCPUSpeed->value = value;
07071 return true;
07072 }
07073
07074 bool OSOption::setMinCPUSpeed(std::string unit, std::string description, double value)
07075 {
07076 if (verifyCPUSpeedUnit(unit) == 0)
07077 return false;
07078
07079 if (this->system == NULL)
07080 this->system = new SystemOption();
07081 if (this->system->minCPUSpeed == NULL)
07082 this->system->minCPUSpeed = new CPUSpeed();
07083 this->system->minCPUSpeed->unit = unit;
07084 this->system->minCPUSpeed->value = value;
07085 this->system->minCPUSpeed->description = description;
07086 return true;
07087 }
07088
07089 bool OSOption::setMinCPUSpeedUnit(std::string unit)
07090 {
07091 try
07092 {
07093 if (this->system == NULL)
07094 this->system = new SystemOption();
07095 if (this->system->minCPUSpeed == NULL)
07096 this->system->minCPUSpeed = new CPUSpeed();
07097
07098 if (verifyCPUSpeedUnit(unit) == 0)
07099 throw ErrorClass( "CPU speed unit not recognized.");
07100
07101 this->system->minCPUSpeed->unit = unit;
07102 return true;
07103 }
07104 catch(const ErrorClass& eclass)
07105 {
07106 cout << eclass.errormsg << endl;
07107 return false;
07108 }
07109 }
07110
07111 bool OSOption::setMinCPUNumber(int number)
07112 {
07113 if (this->system == NULL)
07114 this->system = new SystemOption();
07115 if (this->system->minCPUNumber == NULL)
07116 this->system->minCPUNumber = new CPUNumber();
07117 this->system->minCPUNumber->value = number;
07118 return true;
07119 }
07120
07121 bool OSOption::setMinCPUNumber(int number, std::string description)
07122 {
07123 if (this->system == NULL)
07124 this->system = new SystemOption();
07125 if (this->system->minCPUNumber == NULL)
07126 this->system->minCPUNumber = new CPUNumber();
07127 this->system->minCPUNumber->value = number;
07128 this->system->minCPUNumber->description = description;
07129 return true;
07130 }
07131
07132 bool OSOption::setOtherSystemOptions(int numberOfOptions, OtherOption** other)
07133 {
07134 if (this->system == NULL)
07135 this->system = new SystemOption();
07136 if (this->system->otherOptions == NULL)
07137 this->system->otherOptions = new OtherOptions();
07138 else
07139 {
07140 int i;
07141 for (i = 0; i < this->system->otherOptions->numberOfOtherOptions; i++)
07142 delete this->system->otherOptions->other[i];
07143 delete[] this->system->otherOptions->other;
07144 this->system->otherOptions->other = NULL;
07145 this->system->otherOptions->numberOfOtherOptions = 0;
07146 }
07147 return this->system->otherOptions->setOther(numberOfOptions, other);
07148 }
07149
07150 bool OSOption::setAnOtherSystemOption(std::string name, std::string value, std::string description)
07151 {
07152 if (this->system == NULL)
07153 this->system = new SystemOption();
07154 if (this->system->otherOptions == NULL)
07155 this->system->otherOptions = new OtherOptions();
07156 return this->system->otherOptions->addOther(name, value, description);
07157 }
07158
07159
07164 bool OSOption::setServiceType( std::string serviceType)
07165 {
07166 try
07167 {
07168 if (this->service == NULL)
07169 this->service = new ServiceOption();
07170
07171 if (verifyServiceType(serviceType) == 0)
07172 throw ErrorClass( "service type not recognized.");
07173
07174 this->service->type = serviceType;
07175 return true;
07176 }
07177 catch(const ErrorClass& eclass)
07178 {
07179 cout << eclass.errormsg << endl;
07180 return false;
07181 }
07182 }
07183
07184 bool OSOption::setOtherServiceOptions(int numberOfOptions, OtherOption** other)
07185 {
07186 if (this->service == NULL)
07187 this->service = new ServiceOption();
07188 if (this->service->otherOptions == NULL)
07189 this->service->otherOptions = new OtherOptions();
07190 else
07191 {
07192 int i;
07193 for (i = 0; i < this->service->otherOptions->numberOfOtherOptions; i++)
07194 delete this->service->otherOptions->other[i];
07195 delete[] this->service->otherOptions->other;
07196 this->service->otherOptions->other = NULL;
07197 }
07198 return this->service->otherOptions->setOther(numberOfOptions, other);
07199 }
07200
07201 bool OSOption::setAnOtherServiceOption(std::string name, std::string value, std::string description)
07202 {
07203 if (this->service == NULL)
07204 this->service = new ServiceOption();
07205 if (this->service->otherOptions == NULL)
07206 this->service->otherOptions = new OtherOptions();
07207 return this->service->otherOptions->addOther(name, value, description);
07208 }
07209
07214 bool OSOption::setMaxTime(double value)
07215 {
07216 if (this->job == NULL)
07217 this->job = new JobOption();
07218 if (this->job->maxTime == NULL)
07219 this->job->maxTime = new TimeSpan();
07220 this->job->maxTime->value = value;
07221 return true;
07222 }
07223
07224 bool OSOption::setMaxTime(double value, std::string unit)
07225 {
07226 if (verifyTimeUnit(unit) == 0)
07227 return false;
07228
07229 if (this->job == NULL)
07230 this->job = new JobOption();
07231 if (this->job->maxTime == NULL)
07232 this->job->maxTime = new TimeSpan();
07233 this->job->maxTime->value = value;
07234 this->job->maxTime->unit = unit;
07235 return true;
07236 }
07237
07238 bool OSOption::setMaxTimeUnit(std::string unit)
07239 {
07240 try
07241 {
07242 if (this->job == NULL)
07243 this->job = new JobOption();
07244 if (this->job->maxTime == NULL)
07245 this->job->maxTime = new TimeSpan();
07246
07247 if (verifyTimeUnit(unit) == 0)
07248 throw ErrorClass( "time unit not recognized.");
07249
07250 this->job->maxTime->unit = unit;
07251 return true;
07252 }
07253 catch(const ErrorClass& eclass)
07254 {
07255 cout << eclass.errormsg << endl;
07256 return false;
07257 }
07258 }
07259
07260 bool OSOption::setRequestedStartTime(std::string time)
07261 {
07262 if (this->job == NULL)
07263 this->job = new JobOption();
07264 this->job->requestedStartTime = time;
07265 return true;
07266 }
07267
07268
07269 bool OSOption::setJobDependencies(int numberOfDependencies, std::string* jobDependencies)
07270 {
07271 if (this->job == NULL)
07272 this->job = new JobOption();
07273 if (this->job->dependencies == NULL)
07274 this->job->dependencies = new JobDependencies();
07275 else
07276 delete[] this->job->dependencies->jobID;
07277 this->job->dependencies->jobID = NULL;
07278 return this->job->dependencies->setJobID(numberOfDependencies, jobDependencies);
07279 }
07280
07281 bool OSOption::setAnotherJobDependency(std::string jobID)
07282 {
07283 if (this->job == NULL)
07284 this->job = new JobOption();
07285 if (this->job->dependencies == NULL)
07286 this->job->dependencies = new JobDependencies();
07287 return this->job->dependencies->addJobID(jobID);
07288 }
07289
07290
07291 bool OSOption::setRequiredDirectories(int numberOfPaths, std::string* paths)
07292 {
07293 if (this->job == NULL)
07294 this->job = new JobOption();
07295 if (this->job->requiredDirectories == NULL)
07296 this->job->requiredDirectories = new DirectoriesAndFiles();
07297 else
07298 delete[] this->job->requiredDirectories->path;
07299 this->job->requiredDirectories->path = NULL;
07300 return this->job->requiredDirectories->setPath(numberOfPaths, paths);
07301 }
07302
07303 bool OSOption::setAnotherRequiredDirectory(std::string path)
07304 {
07305 if (this->job == NULL)
07306 this->job = new JobOption();
07307 if (this->job->requiredDirectories == NULL)
07308 this->job->requiredDirectories = new DirectoriesAndFiles();
07309 return this->job->requiredDirectories->addPath(path);
07310 }
07311
07312
07313 bool OSOption::setRequiredFiles(int numberOfPaths, std::string* paths)
07314 {
07315 if (this->job == NULL)
07316 this->job = new JobOption();
07317 if (this->job->requiredFiles == NULL)
07318 this->job->requiredFiles = new DirectoriesAndFiles();
07319 else
07320 delete[] this->job->requiredFiles->path;
07321 this->job->requiredFiles->path = NULL;
07322 return this->job->requiredFiles->setPath(numberOfPaths, paths);
07323 }
07324
07325 bool OSOption::setAnotherRequiredFile(std::string path)
07326 {
07327 if (this->job == NULL)
07328 this->job = new JobOption();
07329 if (this->job->requiredFiles == NULL)
07330 this->job->requiredFiles = new DirectoriesAndFiles();
07331 return this->job->requiredFiles->addPath(path);
07332 }
07333
07334
07335 bool OSOption::setDirectoriesToMake(int numberOfPaths, std::string* paths)
07336 {
07337 if (this->job == NULL)
07338 this->job = new JobOption();
07339 if (this->job->directoriesToMake == NULL)
07340 this->job->directoriesToMake = new DirectoriesAndFiles();
07341 else
07342 delete[] this->job->directoriesToMake->path;
07343 this->job->directoriesToMake->path = NULL;
07344 return this->job->directoriesToMake->setPath(numberOfPaths, paths);
07345 }
07346
07347 bool OSOption::setAnotherDirectoryToMake(std::string path)
07348 {
07349 if (this->job == NULL)
07350 this->job = new JobOption();
07351 if (this->job->directoriesToMake == NULL)
07352 this->job->directoriesToMake = new DirectoriesAndFiles();
07353 return this->job->directoriesToMake->addPath(path);
07354 }
07355
07356
07357 bool OSOption::setFilesToMake(int numberOfPaths, std::string* paths)
07358 {
07359 if (this->job == NULL)
07360 this->job = new JobOption();
07361 if (this->job->filesToMake == NULL)
07362 this->job->filesToMake = new DirectoriesAndFiles();
07363 else
07364 delete[] this->job->filesToMake->path;
07365 this->job->filesToMake->path = NULL;
07366 return this->job->filesToMake->setPath(numberOfPaths, paths);
07367 }
07368
07369 bool OSOption::setAnotherFileToMake(std::string path)
07370 {
07371 if (this->job == NULL)
07372 this->job = new JobOption();
07373 if (this->job->filesToMake == NULL)
07374 this->job->filesToMake = new DirectoriesAndFiles();
07375 return this->job->filesToMake->addPath(path);
07376 }
07377
07378 bool OSOption::setPathPairs(int object, std::string *from, std::string *to, bool *makeCopy, int numberOfPathPairs)
07379 {
07380 if (numberOfPathPairs < 0) return false;
07381 if (this->job == NULL)
07382 this->job = new JobOption();
07383 switch (object)
07384 {
07385 case ENUM_PATHPAIR_input_dir:
07386 {
07387 if (this->job->inputDirectoriesToMove == NULL)
07388 this->job->inputDirectoriesToMove = new PathPairs();
07389 return this->job->inputDirectoriesToMove->setPathPair(from, to, makeCopy, numberOfPathPairs);
07390 }
07391 case ENUM_PATHPAIR_input_file:
07392 {
07393 if (this->job->inputFilesToMove == NULL)
07394 this->job->inputFilesToMove = new PathPairs();
07395 return this->job->inputFilesToMove->setPathPair(from, to, makeCopy, numberOfPathPairs);
07396 }
07397 case ENUM_PATHPAIR_output_file:
07398 {
07399 if (this->job->outputFilesToMove == NULL)
07400 this->job->outputFilesToMove = new PathPairs();
07401 return this->job->outputFilesToMove->setPathPair(from, to, makeCopy, numberOfPathPairs);
07402 }
07403 case ENUM_PATHPAIR_output_dir:
07404 {
07405 if (this->job->outputDirectoriesToMove == NULL)
07406 this->job->outputDirectoriesToMove = new PathPairs();
07407 return this->job->outputDirectoriesToMove->setPathPair(from, to, makeCopy, numberOfPathPairs);
07408 }
07409 default:
07410 throw ErrorClass("target object not implemented in setPathPairs");
07411 }
07412
07413 }
07414
07415
07416 bool OSOption::setInputDirectoriesToMove(int numberOfPathPairs, PathPair** pathPair)
07417 {
07418 if (this->job == NULL)
07419 this->job = new JobOption();
07420 if (this->job->inputDirectoriesToMove == NULL)
07421 this->job->inputDirectoriesToMove = new PathPairs();
07422 else
07423 delete[] this->job->inputDirectoriesToMove->pathPair;
07424 this->job->inputDirectoriesToMove->pathPair = NULL;
07425 return this->job->inputDirectoriesToMove->setPathPair(numberOfPathPairs, pathPair);
07426 }
07427
07428 bool OSOption::setAnotherInputDirectoryToMove(std::string fromPath, std::string toPath, bool makeCopy)
07429 {
07430 if (this->job == NULL)
07431 this->job = new JobOption();
07432 if (this->job->inputDirectoriesToMove == NULL)
07433 this->job->inputDirectoriesToMove = new PathPairs();
07434 return this->job->inputDirectoriesToMove->addPathPair(fromPath, toPath, makeCopy);
07435 }
07436
07437
07438 bool OSOption::setInputFilesToMove(int numberOfPathPairs, PathPair** pathPair)
07439 {
07440 if (this->job == NULL)
07441 this->job = new JobOption();
07442 if (this->job->inputFilesToMove == NULL)
07443 this->job->inputFilesToMove = new PathPairs();
07444 else
07445 delete[] this->job->inputFilesToMove->pathPair;
07446 this->job->inputFilesToMove->pathPair = NULL;
07447 return this->job->inputFilesToMove->setPathPair(numberOfPathPairs, pathPair);
07448 }
07449
07450 bool OSOption::setAnotherInputFileToMove(std::string fromPath, std::string toPath, bool makeCopy)
07451 {
07452 if (this->job == NULL)
07453 this->job = new JobOption();
07454 if (this->job->inputFilesToMove == NULL)
07455 this->job->inputFilesToMove = new PathPairs();
07456 return this->job->inputFilesToMove->addPathPair(fromPath, toPath, makeCopy);
07457 }
07458
07459
07460 bool OSOption::setOutputFilesToMove(int numberOfPathPairs, PathPair** pathPair)
07461 {
07462 if (this->job == NULL)
07463 this->job = new JobOption();
07464 if (this->job->outputFilesToMove == NULL)
07465 this->job->outputFilesToMove = new PathPairs();
07466 else
07467 delete[] this->job->outputFilesToMove->pathPair;
07468 this->job->outputFilesToMove->pathPair = NULL;
07469 return this->job->outputFilesToMove->setPathPair(numberOfPathPairs, pathPair);
07470 }
07471
07472 bool OSOption::setAnotherOutputFileToMove(std::string fromPath, std::string toPath, bool makeCopy)
07473 {
07474 if (this->job == NULL)
07475 this->job = new JobOption();
07476 if (this->job->outputFilesToMove == NULL)
07477 this->job->outputFilesToMove = new PathPairs();
07478 return this->job->outputFilesToMove->addPathPair(fromPath, toPath, makeCopy);
07479 }
07480
07481
07482 bool OSOption::setOutputDirectoriesToMove(int numberOfPathPairs, PathPair** pathPair)
07483 {
07484 if (this->job == NULL)
07485 this->job = new JobOption();
07486 if (this->job->outputDirectoriesToMove == NULL)
07487 this->job->outputDirectoriesToMove = new PathPairs();
07488 else
07489 delete[] this->job->outputDirectoriesToMove->pathPair;
07490 this->job->outputDirectoriesToMove->pathPair = NULL;
07491 return this->job->outputDirectoriesToMove->setPathPair(numberOfPathPairs, pathPair);
07492 }
07493
07494 bool OSOption::setAnotherOutputDirectoryToMove(std::string fromPath, std::string toPath, bool makeCopy)
07495 {
07496 if (this->job == NULL)
07497 this->job = new JobOption();
07498 if (this->job->outputDirectoriesToMove == NULL)
07499 this->job->outputDirectoriesToMove = new PathPairs();
07500 return this->job->outputDirectoriesToMove->addPathPair(fromPath, toPath, makeCopy);
07501 }
07502
07503
07504 bool OSOption::setFilesToDelete(int numberOfPaths, std::string* paths)
07505 {
07506 if (this->job == NULL)
07507 this->job = new JobOption();
07508 if (this->job->filesToDelete == NULL)
07509 this->job->filesToDelete = new DirectoriesAndFiles();
07510 else
07511 delete[] this->job->filesToDelete->path;
07512 this->job->filesToDelete->path = NULL;
07513 return this->job->filesToDelete->setPath(numberOfPaths, paths);
07514 }
07515
07516 bool OSOption::setAnotherFileToDelete(std::string path)
07517 {
07518 if (this->job == NULL)
07519 this->job = new JobOption();
07520 if (this->job->filesToDelete == NULL)
07521 this->job->filesToDelete = new DirectoriesAndFiles();
07522 return this->job->filesToDelete->addPath(path);
07523 }
07524
07525
07526 bool OSOption::setDirectoriesToDelete(int numberOfPaths, std::string* paths)
07527 {
07528 if (this->job == NULL)
07529 this->job = new JobOption();
07530 if (this->job->directoriesToDelete == NULL)
07531 this->job->directoriesToDelete = new DirectoriesAndFiles();
07532 else
07533 delete[] this->job->directoriesToDelete->path;
07534 this->job->directoriesToDelete->path = NULL;
07535 return this->job->directoriesToDelete->setPath(numberOfPaths, paths);
07536 }
07537
07538 bool OSOption::setAnotherDirectoryToDelete(std::string path)
07539 {
07540 if (this->job == NULL)
07541 this->job = new JobOption();
07542 if (this->job->directoriesToDelete == NULL)
07543 this->job->directoriesToDelete = new DirectoriesAndFiles();
07544 return this->job->directoriesToDelete->addPath(path);
07545 }
07546
07547
07548 bool OSOption::setProcessesToKill(int numberOfProcesses, std::string* processes)
07549 {
07550 if (this->job == NULL)
07551 this->job = new JobOption();
07552 if (this->job->processesToKill == NULL)
07553 this->job->processesToKill = new Processes();
07554 else
07555 delete[] this->job->processesToKill->process;
07556 this->job->processesToKill->process = NULL;
07557 return this->job->processesToKill->setProcess(numberOfProcesses, processes);
07558 }
07559
07560 bool OSOption::setAnotherProcessToKill(std::string process)
07561 {
07562 if (this->job == NULL)
07563 this->job = new JobOption();
07564 if (this->job->processesToKill == NULL)
07565 this->job->processesToKill = new Processes();
07566 return this->job->processesToKill->addProcess(process);
07567 }
07568
07569
07570 bool OSOption::setOtherJobOptions(int numberOfOptions, OtherOption** other)
07571 {
07572 if (this->job == NULL)
07573 this->job = new JobOption();
07574 if (this->job->otherOptions == NULL)
07575 this->job->otherOptions = new OtherOptions();
07576 else
07577 {
07578 int i;
07579 for (i = 0; i < this->job->otherOptions->numberOfOtherOptions; i++)
07580 delete this->job->otherOptions->other[i];
07581 delete[] this->job->otherOptions->other;
07582 this->job->otherOptions->other = NULL;
07583 }
07584 return this->job->otherOptions->setOther(numberOfOptions, other);
07585 }
07586
07587 bool OSOption::setAnOtherJobOption(std::string name, std::string value, std::string description)
07588 {
07589 if (this->job == NULL)
07590 this->job = new JobOption();
07591 if (this->job->otherOptions == NULL)
07592 this->job->otherOptions = new OtherOptions();
07593 return this->job->otherOptions->addOther(name, value, description);
07594 }
07595
07596
07597
07598 bool OSOption::setNumberOfVariables(int numberOfVariables)
07599 {
07600 if (this->optimization == NULL)
07601 this->optimization = new OptimizationOption();
07602 this->optimization->numberOfVariables = numberOfVariables;
07603 return true;
07604 }
07605
07606 bool OSOption::setNumberOfObjectives(int numberOfObjectives)
07607 {
07608 if (this->optimization == NULL)
07609 this->optimization = new OptimizationOption();
07610 this->optimization->numberOfObjectives = numberOfObjectives;
07611 return true;
07612 }
07613
07614 bool OSOption::setNumberOfConstraints(int numberOfConstraints)
07615 {
07616 if (this->optimization == NULL)
07617 this->optimization = new OptimizationOption();
07618 this->optimization->numberOfConstraints = numberOfConstraints;
07619 return true;
07620 }
07621
07622
07623 bool OSOption::setInitVarValues(int numberOfVar, int* idx, double* value, std::string* name)
07624 {
07625 if (this->optimization == NULL)
07626 this->optimization = new OptimizationOption();
07627 if (this->optimization->variables == NULL)
07628 this->optimization->variables = new VariableOption();
07629 if (this->optimization->variables->initialVariableValues != NULL)
07630 return false;
07631
07632 this->optimization->variables->initialVariableValues = new InitVariableValues();
07633
07634 return this->optimization->variables->initialVariableValues->setVar(numberOfVar, idx, value, name);
07635 }
07636
07637
07638 bool OSOption::setInitVarValuesSparse(int numberOfVar, InitVarValue** var)
07639 {
07640 if (this->optimization == NULL)
07641 this->optimization = new OptimizationOption();
07642 if (this->optimization->variables == NULL)
07643 this->optimization->variables = new VariableOption();
07644 if (this->optimization->variables->initialVariableValues == NULL)
07645 this->optimization->variables->initialVariableValues = new InitVariableValues();
07646 else
07647 {
07648 int i;
07649 for (i = 0; i < this->optimization->variables->initialVariableValues->numberOfVar; i++)
07650 delete this->optimization->variables->initialVariableValues->var[i];
07651 delete[] this->optimization->variables->initialVariableValues->var;
07652 this->optimization->variables->initialVariableValues->var = NULL;
07653 }
07654 return this->optimization->variables->initialVariableValues->setVar(numberOfVar, var);
07655 }
07656
07657 bool OSOption::setInitVarValuesDense(int numberOfVar, double *value)
07658 {
07659 if (this->optimization == NULL)
07660 this->optimization = new OptimizationOption();
07661 if (this->optimization->variables == NULL)
07662 this->optimization->variables = new VariableOption();
07663 if (this->optimization->variables->initialVariableValues == NULL)
07664 this->optimization->variables->initialVariableValues = new InitVariableValues();
07665 else
07666 {
07667 delete[] this->optimization->variables->initialVariableValues->var;
07668 this->optimization->variables->initialVariableValues->var = NULL;
07669 }
07670
07671 int i;
07672 for (i = 0; i < numberOfVar; i++)
07673 {
07674
07675 if (!this->optimization->variables->initialVariableValues->addVar(i, value[i]))
07676 return false;
07677 }
07678 return true;
07679 }
07680
07681 bool OSOption::setAnotherInitVarValue(int idx, double value)
07682 {
07683 if (this->optimization == NULL)
07684 this->optimization = new OptimizationOption();
07685 if (this->optimization->variables == NULL)
07686 this->optimization->variables = new VariableOption();
07687 if (this->optimization->variables->initialVariableValues == NULL)
07688 this->optimization->variables->initialVariableValues = new InitVariableValues();
07689 return this->optimization->variables->initialVariableValues->addVar(idx, value);
07690 }
07691
07692 bool OSOption::setInitVarValuesString(int numberOfVar, int* idx, std::string* value, std::string* name)
07693 {
07694 if (this->optimization == NULL)
07695 this->optimization = new OptimizationOption();
07696 if (this->optimization->variables == NULL)
07697 this->optimization->variables = new VariableOption();
07698 if (this->optimization->variables->initialVariableValuesString != NULL)
07699 return false;
07700
07701 this->optimization->variables->initialVariableValuesString = new InitVariableValuesString();
07702
07703 return this->optimization->variables->initialVariableValuesString->setVar(numberOfVar, idx, value, name);
07704 }
07705
07706 bool OSOption::setInitVarValuesStringSparse(int numberOfVar, InitVarValueString** var)
07707 {
07708 if (this->optimization == NULL)
07709 this->optimization = new OptimizationOption();
07710 if (this->optimization->variables == NULL)
07711 this->optimization->variables = new VariableOption();
07712 if (this->optimization->variables->initialVariableValuesString == NULL)
07713 this->optimization->variables->initialVariableValuesString = new InitVariableValuesString();
07714 else
07715 {
07716 int i;
07717 for (i = 0; i < this->optimization->variables->initialVariableValuesString->numberOfVar; i++)
07718 delete this->optimization->variables->initialVariableValuesString->var[i];
07719 delete[] this->optimization->variables->initialVariableValuesString->var;
07720 this->optimization->variables->initialVariableValuesString->var = NULL;
07721 }
07722 return this->optimization->variables->initialVariableValuesString->setVar(numberOfVar, var);
07723 }
07724
07725 bool OSOption::setInitVarValuesStringDense(int numberOfVar, std::string *value)
07726 {
07727 if (this->optimization == NULL)
07728 this->optimization = new OptimizationOption();
07729 if (this->optimization->variables == NULL)
07730 this->optimization->variables = new VariableOption();
07731 if (this->optimization->variables->initialVariableValuesString == NULL)
07732 this->optimization->variables->initialVariableValuesString = new InitVariableValuesString();
07733 else
07734 {
07735 delete[] this->optimization->variables->initialVariableValuesString->var;
07736 this->optimization->variables->initialVariableValuesString->var = NULL;
07737 }
07738 int i;
07739 for (i = 0; i < numberOfVar; i++)
07740 {
07741 if (value[i] != "")
07742 if (!this->optimization->variables->initialVariableValuesString->addVar(i, value[i]))
07743 return false;
07744 }
07745 return true;
07746 }
07747
07748 bool OSOption::setAnotherInitVarValueString(int idx, std::string value)
07749 {
07750 if (this->optimization == NULL)
07751 this->optimization = new OptimizationOption();
07752 if (this->optimization->variables == NULL)
07753 this->optimization->variables = new VariableOption();
07754 if (this->optimization->variables->initialVariableValuesString == NULL)
07755 this->optimization->variables->initialVariableValuesString = new InitVariableValuesString();
07756 return this->optimization->variables->initialVariableValuesString->addVar(idx, value);
07757 }
07758
07759 bool OSOption::setInitBasisStatus(int object, int status, int *i, int ni)
07760 {
07761 if (optimization == NULL) return false;
07762
07763 switch (object)
07764 {
07765 case ENUM_PROBLEM_COMPONENT_variables:
07766 {
07767 if (optimization->variables == NULL)
07768 optimization->variables = new VariableOption();
07769 if (optimization->variables->initialBasisStatus == NULL)
07770 optimization->variables->initialBasisStatus = new BasisStatus();
07771
07772 for (int j=0; j<ni; j++)
07773 {
07774 if (i[j] < 0)
07775 return false;
07776 }
07777 return optimization->variables->initialBasisStatus->setIntVector(status, i, ni);
07778 }
07779 case ENUM_PROBLEM_COMPONENT_objectives:
07780 {
07781 if (optimization->objectives == NULL)
07782 optimization->objectives = new ObjectiveOption();
07783 if (optimization->objectives->initialBasisStatus == NULL)
07784 optimization->objectives->initialBasisStatus = new BasisStatus();
07785 for (int j=0; j<ni; j++)
07786 {
07787 if (i[j] >= 0)
07788 return false;
07789 }
07790 return optimization->objectives->initialBasisStatus->setIntVector(status, i, ni);
07791 }
07792 case ENUM_PROBLEM_COMPONENT_constraints:
07793 {
07794 if (optimization->constraints == NULL)
07795 optimization->constraints = new ConstraintOption();
07796 if (optimization->constraints->initialBasisStatus == NULL)
07797 optimization->constraints->initialBasisStatus = new BasisStatus();
07798 for (int j=0; j<ni; j++)
07799 {
07800 if (i[j] < 0)
07801 return false;
07802 }
07803 return optimization->constraints->initialBasisStatus->setIntVector(status, i, ni);
07804 }
07805 default:
07806 throw ErrorClass("target object not implemented in setInitBasisStatus");
07807 }
07808 }
07809
07810 bool OSOption::setAnotherInitBasisStatus(int object, int idx, int status)
07811 {
07812 if (optimization == NULL) return false;
07813
07814 switch (object)
07815 {
07816 case ENUM_PROBLEM_COMPONENT_variables:
07817 {
07818 if (optimization->variables == NULL)
07819 optimization->variables = new VariableOption();
07820 if (optimization->variables->initialBasisStatus == NULL)
07821 optimization->variables->initialBasisStatus = new BasisStatus();
07822 if (idx < 0) return false;
07823 return optimization->variables->initialBasisStatus->addIdx(status, idx);
07824 }
07825 case ENUM_PROBLEM_COMPONENT_objectives:
07826 {
07827 if (optimization->objectives == NULL)
07828 optimization->objectives = new ObjectiveOption();
07829 if (optimization->objectives->initialBasisStatus == NULL)
07830 optimization->objectives->initialBasisStatus = new BasisStatus();
07831 if (idx >= 0) return false;
07832 return optimization->objectives->initialBasisStatus->addIdx(status, idx);
07833 }
07834 case ENUM_PROBLEM_COMPONENT_constraints:
07835 {
07836 if (optimization->constraints == NULL)
07837 optimization->constraints = new ConstraintOption();
07838 if (optimization->constraints->initialBasisStatus == NULL)
07839 optimization->constraints->initialBasisStatus = new BasisStatus();
07840 if (idx < 0) return false;
07841 return optimization->constraints->initialBasisStatus->addIdx(status, idx);
07842 }
07843 default:
07844 throw ErrorClass("target object not implemented in setAnotherInitBasisStatus");
07845 }
07846 }
07847
07848 bool OSOption::setIntegerVariableBranchingWeights(int numberOfVar, int* idx, double* value, std::string* name)
07849 {
07850 if (this->optimization == NULL)
07851 this->optimization = new OptimizationOption();
07852 if (this->optimization->variables == NULL)
07853 this->optimization->variables = new VariableOption();
07854 if (this->optimization->variables->integerVariableBranchingWeights != NULL)
07855 return false;
07856
07857 this->optimization->variables->integerVariableBranchingWeights = new IntegerVariableBranchingWeights();
07858
07859 return this->optimization->variables->integerVariableBranchingWeights->setVar(numberOfVar, idx, value, name);
07860 }
07861
07862 bool OSOption::setIntegerVariableBranchingWeightsSparse(int numberOfVar, BranchingWeight** var)
07863 {
07864 if (this->optimization == NULL)
07865 this->optimization = new OptimizationOption();
07866 if (this->optimization->variables == NULL)
07867 this->optimization->variables = new VariableOption();
07868 if (this->optimization->variables->integerVariableBranchingWeights == NULL)
07869 this->optimization->variables->integerVariableBranchingWeights = new IntegerVariableBranchingWeights();
07870 else
07871 {
07872 int i;
07873 for (i = 0; i < this->optimization->variables->integerVariableBranchingWeights->numberOfVar; i++)
07874 delete this->optimization->variables->integerVariableBranchingWeights->var[i];
07875 delete[] this->optimization->variables->integerVariableBranchingWeights->var;
07876 this->optimization->variables->integerVariableBranchingWeights->var = NULL;
07877 }
07878 return this->optimization->variables->integerVariableBranchingWeights->setVar(numberOfVar, var);
07879 }
07880
07881 bool OSOption::setIntegerVariableBranchingWeightsDense(int numberOfVar, double *value)
07882 {
07883 if (this->optimization == NULL)
07884 this->optimization = new OptimizationOption();
07885 if (this->optimization->variables == NULL)
07886 this->optimization->variables = new VariableOption();
07887 if (this->optimization->variables->integerVariableBranchingWeights == NULL)
07888 this->optimization->variables->integerVariableBranchingWeights = new IntegerVariableBranchingWeights();
07889 else
07890 {
07891 delete[] this->optimization->variables->integerVariableBranchingWeights->var;
07892 this->optimization->variables->integerVariableBranchingWeights->var = NULL;
07893 }
07894 int i;
07895 for (i = 0; i < numberOfVar; i++)
07896 {
07897
07898 if (!this->optimization->variables->integerVariableBranchingWeights->addVar(i, value[i]))
07899 return false;
07900 }
07901 return true;
07902 }
07903
07904 bool OSOption::setAnotherIntegerVariableBranchingWeight(int idx, double value)
07905 {
07906 if (this->optimization == NULL)
07907 this->optimization = new OptimizationOption();
07908 if (this->optimization->variables == NULL)
07909 this->optimization->variables = new VariableOption();
07910 if (this->optimization->variables->integerVariableBranchingWeights == NULL)
07911 this->optimization->variables->integerVariableBranchingWeights = new IntegerVariableBranchingWeights();
07912 return this->optimization->variables->integerVariableBranchingWeights->addVar(idx, value);
07913 }
07914
07915
07916 bool OSOption::setSOSVariableBranchingWeights(int numberOfSOS, SOSWeights** sos)
07917 {
07918 if (this->optimization == NULL)
07919 this->optimization = new OptimizationOption();
07920 if (this->optimization->variables == NULL)
07921 this->optimization->variables = new VariableOption();
07922 if (this->optimization->variables->sosVariableBranchingWeights == NULL)
07923 this->optimization->variables->sosVariableBranchingWeights = new SOSVariableBranchingWeights();
07924 else
07925 {
07926 int i;
07927 for (i = 0; i < this->optimization->variables->sosVariableBranchingWeights->numberOfSOS; i++)
07928 delete this->optimization->variables->sosVariableBranchingWeights->sos[i];
07929 delete[] this->optimization->variables->sosVariableBranchingWeights->sos;
07930 this->optimization->variables->sosVariableBranchingWeights->sos = NULL;
07931 }
07932 return this->optimization->variables->sosVariableBranchingWeights->setSOS(numberOfSOS, sos);
07933 }
07934
07935 bool OSOption::setAnotherSOSVariableBranchingWeight(int sosIdx, int nvar, double weight, int* idx, double* value, std::string* name)
07936 {
07937 if (this->optimization == NULL)
07938 this->optimization = new OptimizationOption();
07939 if (this->optimization->variables == NULL)
07940 this->optimization->variables = new VariableOption();
07941 if (this->optimization->variables->sosVariableBranchingWeights == NULL)
07942 this->optimization->variables->sosVariableBranchingWeights = new SOSVariableBranchingWeights();
07943 return this->optimization->variables->sosVariableBranchingWeights->addSOS(sosIdx, nvar, weight, idx, value, name);
07944 }
07945
07946 bool OSOption::setNumberOfOtherVariableOptions(int numberOfOther)
07947 {
07948 if (optimization == NULL) return false;
07949 if (optimization->variables == NULL)
07950 optimization->variables = new VariableOption();
07951 if(optimization->variables->numberOfOtherVariableOptions < 0) return false;
07952
07953 optimization->variables->numberOfOtherVariableOptions = numberOfOther;
07954
07955 if (numberOfOther > 0)
07956 {
07957 optimization->variables->other = new OtherVariableOption*[numberOfOther];
07958
07959 for (int j=0; j < numberOfOther; j++)
07960 optimization->variables->other[j] = new OtherVariableOption();
07961 }
07962
07963 return true;
07964 }
07965
07966 bool OSOption::setOtherVariableOptionAttributes(int iOther, int numberOfVar,
07967 int numberOfEnumerations, std::string name,
07968 std::string value, std::string solver,
07969 std::string category, std::string type,
07970 std::string description)
07971 {
07972 if (optimization == NULL) return false;
07973 if (optimization->variables == NULL) return false;
07974 if (optimization->variables->other == NULL) return false;
07975
07976 if (iOther < 0 || iOther >= optimization->variables->numberOfOtherVariableOptions) return false;
07977
07978
07979 optimization->variables->other[iOther]->numberOfVar = numberOfVar;
07980 optimization->variables->other[iOther]->numberOfEnumerations = numberOfEnumerations;
07981 optimization->variables->other[iOther]->name = name;
07982 optimization->variables->other[iOther]->value = value;
07983 optimization->variables->other[iOther]->solver = solver;
07984 optimization->variables->other[iOther]->category = category;
07985 optimization->variables->other[iOther]->type = type;
07986 optimization->variables->other[iOther]->description = description;
07987
07988 if (numberOfVar > 0)
07989 {
07990 optimization->variables->other[iOther]->var = new OtherVarOption*[numberOfVar];
07991 for (int j=0; j<numberOfVar; j++)
07992 optimization->variables->other[iOther]->var[j] = new OtherVarOption();
07993 }
07994
07995 if (numberOfEnumerations > 0)
07996 {
07997 optimization->variables->other[iOther]->enumeration = new OtherOptionEnumeration*[numberOfEnumerations];
07998 for (int j=0; j<numberOfEnumerations; j++)
07999 optimization->variables->other[iOther]->enumeration[j] = new OtherOptionEnumeration();
08000 }
08001 return true;
08002 }
08003
08004 bool OSOption::setOtherOptionEnumeration(int object, int otherOptionNumber, int enumerationNumber,
08005 int numberOfEl, std::string value, std::string description, int* idxArray)
08006 {
08007 if (optimization == NULL) return false;
08008 if (numberOfEl < 0) return false;
08009
08010 switch (object)
08011 {
08012 case ENUM_PROBLEM_COMPONENT_variables:
08013 {
08014 if (optimization->variables == NULL) return false;
08015 if (optimization->variables->other == NULL) return false;
08016 if (otherOptionNumber < 0 || otherOptionNumber >= optimization->variables->numberOfOtherVariableOptions) return false;
08017 if (optimization->variables->other[otherOptionNumber] == NULL) return false;
08018 for (int j=0; j<numberOfEl; j++) if (idxArray[j] < 0) return false;
08019
08020 if (optimization->variables->other[otherOptionNumber]->enumeration == NULL) return false;
08021 if (enumerationNumber < 0 || enumerationNumber >= optimization->variables->other[otherOptionNumber]->numberOfEnumerations) return false;
08022 if (optimization->variables->other[otherOptionNumber]->enumeration[enumerationNumber] == NULL) return false;
08023
08024 return optimization->variables->other[otherOptionNumber]->enumeration[enumerationNumber]->setOtherOptionEnumeration(value, description, idxArray, numberOfEl);
08025 }
08026
08027 case ENUM_PROBLEM_COMPONENT_objectives:
08028 {
08029 if (optimization->objectives == NULL) return false;
08030 if (optimization->objectives->other == NULL) return false;
08031 if (otherOptionNumber < 0 || otherOptionNumber >= optimization->objectives->numberOfOtherObjectiveOptions) return false;
08032 if (optimization->objectives->other[otherOptionNumber] == NULL) return false;
08033 for (int j=0; j<numberOfEl; j++) if (idxArray[j] >= 0) return false;
08034
08035 if (optimization->objectives->other[otherOptionNumber]->enumeration == NULL) return false;
08036 if (enumerationNumber < 0 || enumerationNumber >= optimization->objectives->other[otherOptionNumber]->numberOfEnumerations) return false;
08037 if (optimization->objectives->other[otherOptionNumber]->enumeration[enumerationNumber] == NULL) return false;
08038
08039 return optimization->objectives->other[otherOptionNumber]->enumeration[enumerationNumber]->setOtherOptionEnumeration(value, description, idxArray, numberOfEl);
08040 }
08041
08042 case ENUM_PROBLEM_COMPONENT_constraints:
08043 {
08044 if (optimization->constraints == NULL) return false;
08045 if (optimization->constraints->other == NULL) return false;
08046 if (otherOptionNumber < 0 || otherOptionNumber >= optimization->constraints->numberOfOtherConstraintOptions) return false;
08047 if (optimization->constraints->other[otherOptionNumber] == NULL) return false;
08048 for (int j=0; j<numberOfEl; j++) if (idxArray[j] < 0) return false;
08049
08050 if (optimization->constraints->other[otherOptionNumber]->enumeration == NULL) return false;
08051 if (enumerationNumber < 0 || enumerationNumber >= optimization->constraints->other[otherOptionNumber]->numberOfEnumerations) return false;
08052 if (optimization->constraints->other[otherOptionNumber]->enumeration[enumerationNumber] == NULL) return false;
08053
08054 return optimization->constraints->other[otherOptionNumber]->enumeration[enumerationNumber]->setOtherOptionEnumeration(value, description, idxArray, numberOfEl);
08055 }
08056 default:
08057 throw ErrorClass("target object not implemented in setOtherOptionEnumeration");
08058 }
08059
08060 }
08061
08062 bool OSOption::setOtherVariableOptionVar(int otherOptionNumber, int varNumber,
08063 int idx, std::string name, std::string value, std::string lbValue, std::string ubValue)
08064 {
08065 if (optimization == NULL) return false;
08066
08067 if (optimization->variables == NULL) return false;
08068 if (optimization->variables->other == NULL) return false;
08069 if (otherOptionNumber < 0 || otherOptionNumber >= optimization->variables->numberOfOtherVariableOptions) return false;
08070 if (optimization->variables->other[otherOptionNumber] == NULL) return false;
08071 if (idx < 0) return false;
08072
08073 if (optimization->variables->other[otherOptionNumber]->var == NULL) return false;
08074 if (varNumber < 0 || varNumber >= optimization->variables->other[otherOptionNumber]->numberOfVar) return false;
08075 if (optimization->variables->other[otherOptionNumber]->var[varNumber] == NULL) return false;
08076
08077 optimization->variables->other[otherOptionNumber]->var[varNumber]->idx = idx;
08078 optimization->variables->other[otherOptionNumber]->var[varNumber]->name = name;
08079 optimization->variables->other[otherOptionNumber]->var[varNumber]->value = value;
08080 optimization->variables->other[otherOptionNumber]->var[varNumber]->lbValue = lbValue;
08081 optimization->variables->other[otherOptionNumber]->var[varNumber]->ubValue = ubValue;
08082 return true;
08083 }
08084
08085
08086 bool OSOption::setOtherVariableOptions(int numberOfOptions, OtherVariableOption** other)
08087 {
08088 if (this->optimization == NULL)
08089 this->optimization = new OptimizationOption();
08090 if (this->optimization->variables == NULL)
08091 this->optimization->variables = new VariableOption();
08092 else
08093 {
08094 int i;
08095 for (i = 0; i < this->optimization->variables->numberOfOtherVariableOptions; i++)
08096 delete this->optimization->variables->other[i];
08097 delete[] this->optimization->variables->other;
08098 this->optimization->variables->other = NULL;
08099 }
08100 return this->optimization->variables->setOther(numberOfOptions, other);
08101 }
08102
08103 bool OSOption::setAnOtherVariableOption(OtherVariableOption* optionValue)
08104 {
08105 if (this->optimization == NULL)
08106 this->optimization = new OptimizationOption();
08107 if (this->optimization->variables == NULL)
08108 this->optimization->variables = new VariableOption();
08109 return this->optimization->variables->addOther(optionValue);
08110 }
08111
08112 bool OSOption::setInitObjValues(int numberOfObj, int* idx, double* value, std::string* name)
08113 {
08114 if (this->optimization == NULL)
08115 this->optimization = new OptimizationOption();
08116 if (this->optimization->objectives == NULL)
08117 this->optimization->objectives = new ObjectiveOption();
08118 if (this->optimization->objectives->initialObjectiveValues != NULL)
08119 return false;
08120
08121 this->optimization->objectives->initialObjectiveValues = new InitObjectiveValues();
08122
08123 return this->optimization->objectives->initialObjectiveValues->setObj(numberOfObj, idx, value, name);
08124 }
08125
08126 bool OSOption::setInitObjValuesSparse(int numberOfObj, InitObjValue** obj)
08127 {
08128 if (this->optimization == NULL)
08129 this->optimization = new OptimizationOption();
08130 if (this->optimization->objectives == NULL)
08131 this->optimization->objectives = new ObjectiveOption();
08132 if (this->optimization->objectives->initialObjectiveValues == NULL)
08133 this->optimization->objectives->initialObjectiveValues = new InitObjectiveValues();
08134 else
08135 {
08136 int i;
08137 for (i = 0; i < this->optimization->objectives->initialObjectiveValues->numberOfObj; i++)
08138 delete this->optimization->objectives->initialObjectiveValues->obj[i];
08139 delete[] this->optimization->objectives->initialObjectiveValues->obj;
08140 this->optimization->objectives->initialObjectiveValues->obj = NULL;
08141 }
08142 return this->optimization->objectives->initialObjectiveValues->setObj(numberOfObj, obj);
08143 }
08144
08145 bool OSOption::setInitObjValuesDense(int numberOfObj, double *value)
08146 {
08147 if (this->optimization == NULL)
08148 this->optimization = new OptimizationOption();
08149 if (this->optimization->objectives == NULL)
08150 this->optimization->objectives = new ObjectiveOption();
08151 if (this->optimization->objectives->initialObjectiveValues == NULL)
08152 this->optimization->objectives->initialObjectiveValues = new InitObjectiveValues();
08153 else
08154 {
08155 delete[] this->optimization->objectives->initialObjectiveValues->obj;
08156 this->optimization->objectives->initialObjectiveValues->obj = NULL;
08157 }
08158 int i;
08159 for (i = 0; i < numberOfObj; i++)
08160 {
08161
08162 if (!this->optimization->objectives->initialObjectiveValues->addObj(-1-i, value[i]))
08163 return false;
08164 }
08165 return true;
08166 }
08167
08168 bool OSOption::setAnotherInitObjValue(int idx, double value)
08169 {
08170 if (this->optimization == NULL)
08171 this->optimization = new OptimizationOption();
08172 if (this->optimization->objectives == NULL)
08173 this->optimization->objectives = new ObjectiveOption();
08174 if (this->optimization->objectives->initialObjectiveValues == NULL)
08175 this->optimization->objectives->initialObjectiveValues = new InitObjectiveValues();
08176 return this->optimization->objectives->initialObjectiveValues->addObj(idx, value);
08177 }
08178
08179 bool OSOption::setInitObjBounds(int numberOfObj, int* idx, double* lbValue, double* ubValue, std::string* name)
08180 {
08181 if (this->optimization == NULL)
08182 this->optimization = new OptimizationOption();
08183 if (this->optimization->objectives == NULL)
08184 this->optimization->objectives = new ObjectiveOption();
08185 if (this->optimization->objectives->initialObjectiveBounds != NULL)
08186 return false;
08187
08188 this->optimization->objectives->initialObjectiveBounds = new InitObjectiveBounds();
08189
08190 return this->optimization->objectives->initialObjectiveBounds->setObj(numberOfObj, idx, lbValue, ubValue, name);
08191 }
08192
08193 bool OSOption::setInitObjBoundsSparse(int numberOfObj, InitObjBound** obj)
08194 {
08195 if (this->optimization == NULL)
08196 this->optimization = new OptimizationOption();
08197 if (this->optimization->objectives == NULL)
08198 this->optimization->objectives = new ObjectiveOption();
08199 if (this->optimization->objectives->initialObjectiveBounds == NULL)
08200 this->optimization->objectives->initialObjectiveBounds = new InitObjectiveBounds();
08201 else
08202 {
08203 int i;
08204 for (i = 0; i < this->optimization->objectives->initialObjectiveBounds->numberOfObj; i++)
08205 delete this->optimization->objectives->initialObjectiveBounds->obj[i];
08206 delete[] this->optimization->objectives->initialObjectiveBounds->obj;
08207 this->optimization->objectives->initialObjectiveBounds->obj = NULL;
08208 }
08209 return this->optimization->objectives->initialObjectiveBounds->setObj(numberOfObj, obj);
08210 }
08211
08212 bool OSOption::setInitObjBoundsDense(int numberOfObj, double* lb, double* ub)
08213 {
08214 if (this->optimization == NULL)
08215 this->optimization = new OptimizationOption();
08216 if (this->optimization->objectives == NULL)
08217 this->optimization->objectives = new ObjectiveOption();
08218 if (this->optimization->objectives->initialObjectiveBounds == NULL)
08219 this->optimization->objectives->initialObjectiveBounds = new InitObjectiveBounds();
08220 else
08221 {
08222 delete[] this->optimization->objectives->initialObjectiveBounds->obj;
08223 this->optimization->objectives->initialObjectiveBounds->obj = NULL;
08224 }
08225 int i;
08226 for (i = 0; i < numberOfObj; i++)
08227 {
08228 if (!this->optimization->objectives->initialObjectiveBounds->addObj(-1-i, lb[i], ub[i]))
08229 return false;
08230 }
08231 return true;
08232 }
08233
08234 bool OSOption::setAnotherInitObjBound(int idx, double lb, double ub)
08235 {
08236 if (this->optimization == NULL)
08237 this->optimization = new OptimizationOption();
08238 if (this->optimization->objectives == NULL)
08239 this->optimization->objectives = new ObjectiveOption();
08240 if (this->optimization->objectives->initialObjectiveBounds == NULL)
08241 this->optimization->objectives->initialObjectiveBounds = new InitObjectiveBounds();
08242 return this->optimization->objectives->initialObjectiveBounds->addObj(idx, lb, ub);
08243 }
08244
08245 bool OSOption::setOtherObjectiveOptionObj(int otherOptionNumber, int objNumber,
08246 int idx, std::string name, std::string value, std::string lbValue, std::string ubValue)
08247 {
08248 if (optimization == NULL) return false;
08249
08250 if (optimization->objectives == NULL) return false;
08251 if (optimization->objectives->other == NULL) return false;
08252 if (otherOptionNumber < 0 || otherOptionNumber >= optimization->objectives->numberOfOtherObjectiveOptions) return false;
08253 if (optimization->objectives->other[otherOptionNumber] == NULL) return false;
08254 if (idx >= 0) return false;
08255
08256 if (optimization->objectives->other[otherOptionNumber]->obj == NULL) return false;
08257 if (objNumber < 0 || objNumber >= optimization->objectives->other[otherOptionNumber]->numberOfObj) return false;
08258 if (optimization->objectives->other[otherOptionNumber]->obj[objNumber] == NULL) return false;
08259
08260 optimization->objectives->other[otherOptionNumber]->obj[objNumber]->idx = idx;
08261 optimization->objectives->other[otherOptionNumber]->obj[objNumber]->name = name;
08262 optimization->objectives->other[otherOptionNumber]->obj[objNumber]->value = value;
08263 optimization->objectives->other[otherOptionNumber]->obj[objNumber]->lbValue = lbValue;
08264 optimization->objectives->other[otherOptionNumber]->obj[objNumber]->ubValue = ubValue;
08265 return true;
08266 }
08267
08268 bool OSOption::setNumberOfOtherObjectiveOptions(int numberOfOther)
08269 {
08270 if (optimization == NULL) return false;
08271 if (optimization->objectives == NULL)
08272 optimization->objectives = new ObjectiveOption();
08273 if (optimization->objectives->numberOfOtherObjectiveOptions < 0) return false;
08274
08275 optimization->objectives->numberOfOtherObjectiveOptions = numberOfOther;
08276
08277 if (numberOfOther > 0)
08278 {
08279 optimization->objectives->other = new OtherObjectiveOption*[numberOfOther];
08280
08281 for (int j=0; j < numberOfOther; j++)
08282 optimization->objectives->other[j] = new OtherObjectiveOption();
08283 }
08284 return true;
08285
08286 }
08287
08288 bool OSOption::setOtherObjectiveOptionAttributes(int iOther, int numberOfObj,
08289 int numberOfEnumerations, std::string name,
08290 std::string value, std::string solver,
08291 std::string category, std::string type,
08292 std::string description)
08293 {
08294 if (optimization == NULL) return false;
08295 if (optimization->objectives == NULL) return false;
08296 if (optimization->objectives->other == NULL) return false;
08297
08298 if (iOther < 0 || iOther >= optimization->objectives->numberOfOtherObjectiveOptions) return false;
08299
08300 optimization->objectives->other[iOther]->numberOfObj = numberOfObj;
08301 optimization->objectives->other[iOther]->numberOfEnumerations = numberOfEnumerations;
08302 optimization->objectives->other[iOther]->name = name;
08303 optimization->objectives->other[iOther]->value = value;
08304 optimization->objectives->other[iOther]->solver = solver;
08305 optimization->objectives->other[iOther]->category = category;
08306 optimization->objectives->other[iOther]->type = type;
08307 optimization->objectives->other[iOther]->description = description;
08308
08309 if (numberOfObj > 0)
08310 {
08311 optimization->objectives->other[iOther]->obj = new OtherObjOption*[numberOfObj];
08312 for (int j=0; j<numberOfObj; j++)
08313 optimization->objectives->other[iOther]->obj[j] = new OtherObjOption();
08314 }
08315
08316 if (numberOfEnumerations > 0)
08317 {
08318 optimization->objectives->other[iOther]->enumeration = new OtherOptionEnumeration*[numberOfEnumerations];
08319 for (int j=0; j<numberOfEnumerations; j++)
08320 optimization->objectives->other[iOther]->enumeration[j] = new OtherOptionEnumeration();
08321 }
08322 return true;
08323 }
08324
08325 bool OSOption::setOtherObjectiveOptions(int numberOfOptions, OtherObjectiveOption** other)
08326 {
08327 if (this->optimization == NULL)
08328 this->optimization = new OptimizationOption();
08329 if (this->optimization->objectives == NULL)
08330 this->optimization->objectives = new ObjectiveOption();
08331 else
08332 {
08333 int i;
08334 for (i = 0; i < this->optimization->objectives->numberOfOtherObjectiveOptions; i++)
08335 delete this->optimization->objectives->other[i];
08336 delete[] this->optimization->objectives->other;
08337 this->optimization->objectives->other = NULL;
08338 }
08339 return this->optimization->objectives->setOther(numberOfOptions, other);
08340 }
08341
08342 bool OSOption::setAnOtherObjectiveOption(OtherObjectiveOption* optionValue)
08343 {
08344 if (this->optimization == NULL)
08345 this->optimization = new OptimizationOption();
08346 if (this->optimization->objectives == NULL)
08347 this->optimization->objectives = new ObjectiveOption();
08348 return this->optimization->objectives->addOther(optionValue);
08349 }
08350
08351
08352 bool OSOption::setInitConValues(int numberOfCon, int* idx, double* value, std::string* name)
08353 {
08354 if (this->optimization == NULL)
08355 this->optimization = new OptimizationOption();
08356 if (this->optimization->constraints == NULL)
08357 this->optimization->constraints = new ConstraintOption();
08358 if (this->optimization->constraints->initialConstraintValues != NULL)
08359 return false;
08360
08361 this->optimization->constraints->initialConstraintValues = new InitConstraintValues();
08362
08363 return this->optimization->constraints->initialConstraintValues->setCon(numberOfCon, idx, value, name);
08364 }
08365
08366
08367 bool OSOption::setInitConValuesSparse(int numberOfCon, InitConValue** con)
08368 {
08369 if (this->optimization == NULL)
08370 this->optimization = new OptimizationOption();
08371 if (this->optimization->constraints == NULL)
08372 this->optimization->constraints = new ConstraintOption();
08373 if (this->optimization->constraints->initialConstraintValues == NULL)
08374 this->optimization->constraints->initialConstraintValues = new InitConstraintValues();
08375 else
08376 {
08377 int i;
08378 for (i = 0; i < this->optimization->constraints->initialConstraintValues->numberOfCon; i++)
08379 delete this->optimization->constraints->initialConstraintValues->con[i];
08380 delete[] this->optimization->constraints->initialConstraintValues->con;
08381 this->optimization->constraints->initialConstraintValues->con = NULL;
08382 }
08383 return this->optimization->constraints->initialConstraintValues->setCon(numberOfCon, con);
08384 }
08385
08386 bool OSOption::setInitConValuesDense(int numberOfCon, double *value)
08387 {
08388 if (this->optimization == NULL)
08389 this->optimization = new OptimizationOption();
08390 if (this->optimization->constraints == NULL)
08391 this->optimization->constraints = new ConstraintOption();
08392 if (this->optimization->constraints->initialConstraintValues == NULL)
08393 this->optimization->constraints->initialConstraintValues = new InitConstraintValues();
08394 else
08395 {
08396 delete[] this->optimization->constraints->initialConstraintValues->con;
08397 this->optimization->constraints->initialConstraintValues->con = NULL;
08398 }
08399 int i;
08400 for (i = 0; i < numberOfCon; i++)
08401 {
08402
08403 if (!this->optimization->constraints->initialConstraintValues->addCon(i, value[i]))
08404 return false;
08405 }
08406 return true;
08407 }
08408
08409 bool OSOption::setAnotherInitConValue(int idx, double value)
08410 {
08411 if (this->optimization == NULL)
08412 this->optimization = new OptimizationOption();
08413 if (this->optimization->constraints == NULL)
08414 this->optimization->constraints = new ConstraintOption();
08415 if (this->optimization->constraints->initialConstraintValues == NULL)
08416 this->optimization->constraints->initialConstraintValues = new InitConstraintValues();
08417 return this->optimization->constraints->initialConstraintValues->addCon(idx, value);
08418 }
08419
08420 bool OSOption::setInitDualValues(int numberOfCon, int* idx, double* lbValue, double* ubValue, std::string* name)
08421 {
08422 if (this->optimization == NULL)
08423 this->optimization = new OptimizationOption();
08424 if (this->optimization->constraints == NULL)
08425 this->optimization->constraints = new ConstraintOption();
08426 if (this->optimization->constraints->initialDualValues != NULL)
08427 return false;
08428
08429 this->optimization->constraints->initialDualValues = new InitDualVariableValues();
08430
08431 return this->optimization->constraints->initialDualValues->setCon(numberOfCon, idx, lbValue, ubValue, name);
08432 }
08433
08434
08435 bool OSOption::setInitDualVarValuesSparse(int numberOfCon, InitDualVarValue** con)
08436 {
08437 if (this->optimization == NULL)
08438 this->optimization = new OptimizationOption();
08439 if (this->optimization->constraints == NULL)
08440 this->optimization->constraints = new ConstraintOption();
08441 if (this->optimization->constraints->initialDualValues == NULL)
08442 this->optimization->constraints->initialDualValues = new InitDualVariableValues();
08443 else
08444 {
08445 int i;
08446 for (i = 0; i < this->optimization->constraints->initialDualValues->numberOfCon; i++)
08447 delete this->optimization->constraints->initialDualValues->con[i];
08448 delete[] this->optimization->constraints->initialDualValues->con;
08449 this->optimization->constraints->initialDualValues->con = NULL;
08450 }
08451 return this->optimization->constraints->initialDualValues->setCon(numberOfCon, con);
08452 }
08453
08454 bool OSOption::setInitDualVarValuesDense(int numberOfCon, double* lb, double* ub)
08455 {
08456 if (this->optimization == NULL)
08457 this->optimization = new OptimizationOption();
08458 if (this->optimization->constraints == NULL)
08459 this->optimization->constraints = new ConstraintOption();
08460 if (this->optimization->constraints->initialDualValues == NULL)
08461 this->optimization->constraints->initialDualValues = new InitDualVariableValues();
08462 else
08463 {
08464 delete[] this->optimization->constraints->initialDualValues->con;
08465 this->optimization->constraints->initialDualValues->con = NULL;
08466 }
08467 int i;
08468 for (i = 0; i < numberOfCon; i++)
08469 {
08470 if ((lb[i] != 0.0) || (ub[i] != 0.0))
08471 if (!this->optimization->constraints->initialDualValues->addCon(i, lb[i], ub[i]))
08472 return false;
08473 }
08474 return true;
08475 }
08476
08477 bool OSOption::setAnotherInitDualVarValue(int idx, double lbValue, double ubValue)
08478 {
08479 if (this->optimization == NULL)
08480 this->optimization = new OptimizationOption();
08481 if (this->optimization->constraints == NULL)
08482 this->optimization->constraints = new ConstraintOption();
08483 if (this->optimization->constraints->initialDualValues == NULL)
08484 this->optimization->constraints->initialDualValues = new InitDualVariableValues();
08485 return this->optimization->constraints->initialDualValues->addCon(idx, lbValue, ubValue);
08486 }
08487
08488 bool OSOption::setNumberOfOtherConstraintOptions(int numberOfOther)
08489 {
08490 if (optimization == NULL) return false;
08491 if (optimization->constraints == NULL)
08492 optimization->constraints = new ConstraintOption();
08493 if (optimization->constraints->numberOfOtherConstraintOptions < 0) return false;
08494
08495 optimization->constraints->numberOfOtherConstraintOptions = numberOfOther;
08496
08497 if (numberOfOther > 0)
08498 {
08499 optimization->constraints->other = new OtherConstraintOption*[numberOfOther];
08500
08501 for (int j=0; j < numberOfOther; j++)
08502 optimization->constraints->other[j] = new OtherConstraintOption();
08503 }
08504
08505 return true;
08506 }
08507
08508 bool OSOption::setOtherConstraintOptionAttributes(int iOther, int numberOfCon,
08509 int numberOfEnumerations, std::string name,
08510 std::string value, std::string solver,
08511 std::string category, std::string type,
08512 std::string description)
08513 {
08514 if (optimization == NULL) return false;
08515 if (optimization->constraints == NULL) return false;
08516 if (optimization->constraints->other == NULL) return false;
08517 if (iOther < 0 || iOther >= optimization->constraints->numberOfOtherConstraintOptions) return false;
08518
08519 optimization->constraints->other[iOther]->numberOfCon = numberOfCon;
08520 optimization->constraints->other[iOther]->numberOfEnumerations = numberOfEnumerations;
08521 optimization->constraints->other[iOther]->name = name;
08522 optimization->constraints->other[iOther]->value = value;
08523 optimization->constraints->other[iOther]->solver = solver;
08524 optimization->constraints->other[iOther]->category = category;
08525 optimization->constraints->other[iOther]->type = type;
08526 optimization->constraints->other[iOther]->description = description;
08527
08528 if (numberOfCon > 0)
08529 {
08530 optimization->constraints->other[iOther]->con = new OtherConOption*[numberOfCon];
08531 for (int j=0; j<numberOfCon; j++)
08532 optimization->constraints->other[iOther]->con[j] = new OtherConOption();
08533 }
08534
08535 if (numberOfEnumerations > 0)
08536 {
08537 optimization->constraints->other[iOther]->enumeration = new OtherOptionEnumeration*[numberOfEnumerations];
08538 for (int j=0; j<numberOfEnumerations; j++)
08539 optimization->constraints->other[iOther]->enumeration[j] = new OtherOptionEnumeration();
08540 }
08541 return true;
08542 }
08543
08544
08545 bool OSOption::setOtherConstraintOptionCon(int otherOptionNumber, int conNumber,
08546 int idx, std::string name, std::string value, std::string lbValue, std::string ubValue)
08547 {
08548 if (optimization == NULL) return false;
08549
08550 if (optimization->constraints == NULL) return false;
08551 if (optimization->constraints->other == NULL) return false;
08552 if (otherOptionNumber < 0 || otherOptionNumber >= optimization->constraints->numberOfOtherConstraintOptions) return false;
08553 if (optimization->constraints->other[otherOptionNumber] == NULL) return false;
08554 if (idx < 0) return false;
08555
08556 if (optimization->constraints->other[otherOptionNumber]->con == NULL) return false;
08557 if (conNumber < 0 || conNumber >= optimization->constraints->other[otherOptionNumber]->numberOfCon) return false;
08558 if (optimization->constraints->other[otherOptionNumber]->con[conNumber] == NULL) return false;
08559
08560 optimization->constraints->other[otherOptionNumber]->con[conNumber]->idx = idx;
08561 optimization->constraints->other[otherOptionNumber]->con[conNumber]->name = name;
08562 optimization->constraints->other[otherOptionNumber]->con[conNumber]->value = value;
08563 optimization->constraints->other[otherOptionNumber]->con[conNumber]->lbValue = lbValue;
08564 optimization->constraints->other[otherOptionNumber]->con[conNumber]->ubValue = ubValue;
08565 return true;
08566 }
08567
08568
08569
08570 bool OSOption::setOtherConstraintOptions(int numberOfOptions, OtherConstraintOption** other)
08571 {
08572 if (this->optimization == NULL)
08573 this->optimization = new OptimizationOption();
08574 if (this->optimization->constraints == NULL)
08575 this->optimization->constraints = new ConstraintOption();
08576 else
08577 {
08578 int i;
08579 for (i = 0; i < this->optimization->constraints->numberOfOtherConstraintOptions; i++)
08580 delete this->optimization->constraints->other[i];
08581 delete[] this->optimization->constraints->other;
08582 this->optimization->constraints->other = NULL;
08583 }
08584 return this->optimization->constraints->setOther(numberOfOptions, other);
08585 }
08586
08587 bool OSOption::setAnOtherConstraintOption(OtherConstraintOption* optionValue)
08588 {
08589 if (this->optimization == NULL)
08590 this->optimization = new OptimizationOption();
08591 if (this->optimization->constraints == NULL)
08592 this->optimization->constraints = new ConstraintOption();
08593 return this->optimization->constraints->addOther(optionValue);
08594 }
08595
08596
08597 bool OSOption::setNumberOfSolverOptions(int numberOfOptions)
08598 {
08599 if (optimization == NULL) return false;
08600 if (optimization->solverOptions != NULL) return false;
08601
08602 optimization->solverOptions = new SolverOptions();
08603 optimization->solverOptions->numberOfSolverOptions = numberOfOptions;
08604 optimization->solverOptions->solverOption = new SolverOption*[numberOfOptions];
08605
08606 for (int j=0; j < numberOfOptions; j++)
08607 optimization->solverOptions->solverOption[j] = new SolverOption();
08608 return true;
08609 }
08610
08611 bool OSOption::setSolverOptionContent(int iOption, int numberOfItems,
08612 std::string name,
08613 std::string value, std::string solver,
08614 std::string category, std::string type,
08615 std::string description, std::string *itemList)
08616 {
08617 if (optimization == NULL) return false;
08618 if (optimization->solverOptions == NULL) return false;
08619 if (optimization->solverOptions->solverOption == NULL) return false;
08620
08621 if (iOption < 0 || iOption >= optimization->solverOptions->numberOfSolverOptions) return false;
08622
08623 optimization->solverOptions->solverOption[iOption]->numberOfItems = numberOfItems;
08624 optimization->solverOptions->solverOption[iOption]->name = name;
08625 optimization->solverOptions->solverOption[iOption]->value = value;
08626 optimization->solverOptions->solverOption[iOption]->solver = solver;
08627 optimization->solverOptions->solverOption[iOption]->category = category;
08628 optimization->solverOptions->solverOption[iOption]->type = type;
08629 optimization->solverOptions->solverOption[iOption]->description = description;
08630
08631 if (numberOfItems > 0)
08632 {
08633 optimization->solverOptions->solverOption[iOption]->item = new std::string[numberOfItems];
08634 for (int j=0; j<numberOfItems; j++)
08635 optimization->solverOptions->solverOption[iOption]->item[j] = itemList[j];
08636 }
08637
08638 return true;
08639 }
08640
08641 bool OSOption::setSolverOptions(int numberOfSolverOptions, SolverOption** solverOption)
08642 {
08643 if (this->optimization == NULL)
08644 this->optimization = new OptimizationOption();
08645 if (this->optimization->solverOptions == NULL)
08646 this->optimization->solverOptions = new SolverOptions();
08647 else
08648 {
08649 int i;
08650 for (i = 0; i < this->optimization->solverOptions->numberOfSolverOptions; i++)
08651 delete this->optimization->solverOptions->solverOption[i];
08652 delete[] this->optimization->solverOptions->solverOption;
08653 this->optimization->solverOptions->solverOption = NULL;
08654 }
08655 return this->optimization->solverOptions->setSolverOptions(numberOfSolverOptions, solverOption);
08656 }
08657
08658 bool OSOption::setAnotherSolverOption(std::string name, std::string value, std::string solver,
08659 std::string category, std::string type, std::string description)
08660 {
08661 if (this->optimization == NULL)
08662 this->optimization = new OptimizationOption();
08663 if (this->optimization->solverOptions == NULL)
08664 this->optimization->solverOptions = new SolverOptions();
08665 return this->optimization->solverOptions->addSolverOption(name, value, solver, category, type, description);
08666 }
08667
08668
08669 bool OSOption::setOptionStr(std::string optionName, std::string optionValue)
08670 {
08671 if (optionName == "serviceURI")
08672 return this->setServiceURI(optionValue);
08673
08674 if (optionName == "serviceName")
08675 return this->setServiceName(optionValue);
08676
08677 if (optionName == "instanceName")
08678 return this->setInstanceName(optionValue);
08679
08680 if (optionName == "instanceLocation")
08681 return this->setInstanceLocation(optionValue);
08682
08683 if (optionName == "locationType")
08684 return this->setInstanceLocationType(optionValue);
08685
08686 if (optionName == "jobID")
08687 return this->setJobID(optionValue);
08688
08689 if (optionName == "solverName")
08690 return this->setSolverToInvoke(optionValue);
08691
08692 if (optionName == "solverToInvoke")
08693 return this->setSolverToInvoke(optionValue);
08694
08695 if (optionName == "license")
08696 return this->setLicense(optionValue);
08697
08698 if (optionName == "userName")
08699 return this->setUserName(optionValue);
08700
08701 if (optionName == "password")
08702 return this->setPassword(optionValue);
08703
08704 if (optionName == "contact")
08705 return this->setContact(optionValue);
08706
08707 if (optionName == "transportType")
08708 return this->setContactTransportType(optionValue);
08709
08710 if (optionName == "minDiskSpaceUnit")
08711 return this->setMinDiskSpaceUnit(optionValue);
08712
08713 if (optionName == "minMemoryUnit")
08714 return this->setMinMemoryUnit(optionValue);
08715
08716 if (optionName == "minCPUSpeedUnit")
08717 return this->setMinCPUSpeedUnit(optionValue);
08718
08719 if (optionName == "serviceType")
08720 return this->setServiceType(optionValue);
08721
08722 if (optionName == "maxTimeUnit")
08723 return this->setMaxTimeUnit(optionValue);
08724
08725 if (optionName == "requestedStartTime")
08726 return this->setRequestedStartTime(optionValue);
08727
08728 return false;
08729 }
08730
08731
08732 bool OSOption::setOptionInt(std::string optionName, int optionValue)
08733 {
08734 if (optionName == "minCPUNumber")
08735 return this->setMinCPUNumber(optionValue);
08736
08737 return false;
08738 }
08739
08740
08741 bool OSOption::setOptionDbl(std::string optionName, double value)
08742 {
08743 if (optionName == "minDiskSpaceValue")
08744 return this->setMinDiskSpace(value);
08745
08746 if (optionName == "minMemoryValue")
08747 return this->setMinMemorySize(value);
08748
08749 if (optionName == "minCPUSpeedValue")
08750
08751 return this->setMinCPUSpeed(value);
08752
08753 if (optionName == "maxTime")
08754 return this->setMaxTime(value);
08755
08756 return false;
08757 }
08758
08759
08760
08761
08762
08763 bool OSOption::IsEqual(OSOption *that)
08764 {
08765 #ifdef DEBUG_OSOPTION
08766 cout << "Start comparing in OSOption" << endl;
08767 #endif
08768 if (this == NULL)
08769 {
08770 if (that == NULL)
08771 return true;
08772 else
08773 {
08774 #ifdef DEBUG_OSOPTION
08775 cout << "First object is NULL, second is not" << endl;
08776 #endif
08777 return false;
08778 }
08779 }
08780 else
08781 {
08782 if (that == NULL)
08783 {
08784 #ifdef DEBUG_OSOPTION
08785 cout << "Second object is NULL, first is not" << endl;
08786 #endif
08787 return false;
08788 }
08789 else
08790 {
08791 if (!this->optionHeader->IsEqual(that->optionHeader))
08792 return false;
08793 if (!this->general->IsEqual(that->general))
08794 return false;
08795 if (!this->system->IsEqual(that->system))
08796
08797 return false;
08798 if (!this->service->IsEqual(that->service))
08799 return false;
08800 if (!this->job->IsEqual(that->job))
08801 return false;
08802 if (!this->optimization->IsEqual(that->optimization))
08803 return false;
08804 return true;
08805 }
08806 }
08807 }
08808
08809
08810 bool GeneralOption::IsEqual(GeneralOption *that)
08811 {
08812 #ifdef DEBUG_OSOPTION
08813 cout << "Start comparing in GeneralOption" << endl;
08814 #endif
08815 if (this == NULL)
08816 {
08817 if (that == NULL)
08818 return true;
08819 else
08820 {
08821 #ifdef DEBUG_OSOPTION
08822 cout << "First object is NULL, second is not" << endl;
08823 #endif
08824 return false;
08825 }
08826 }
08827 else
08828 {
08829 if (that == NULL)
08830 {
08831 #ifdef DEBUG_OSOPTION
08832 cout << "Second object is NULL, first is not" << endl;
08833 #endif
08834 return false;
08835 }
08836 else
08837 {
08838 bool same;
08839 same = (this->serviceURI == that->serviceURI);
08840 same = ((this->serviceName == that->serviceName ) && same);
08841 same = ((this->instanceName == that->instanceName ) && same);
08842 same = ((this->jobID == that->jobID ) && same);
08843 same = ((this->solverToInvoke == that->solverToInvoke) && same);
08844 same = ((this->license == that->license ) && same);
08845 same = ((this->userName == that->userName ) && same);
08846 same = ((this->password == that->password ) && same);
08847 if (!same)
08848 {
08849 #ifdef DEBUG_OSOPTION
08850 cout << "serviceURI: " << this->serviceURI << " vs. " << that->serviceURI << endl;
08851 cout << "serviceName: " << this->serviceName << " vs. " << that->serviceName << endl;
08852 cout << "instanceName: " << this->instanceName << " vs. " << that->instanceName << endl;
08853 cout << "jobID: " << this->jobID << " vs. " << that->jobID << endl;
08854 cout << "solverToInvoke:" << this->solverToInvoke << " vs. " << that->solverToInvoke << endl;
08855 cout << "license: " << this->license << " vs. " << that->license << endl;
08856 cout << "userName: " << this->userName << " vs. " << that->userName << endl;
08857 cout << "password: " << this->password << " vs. " << that->password << endl;
08858 #endif
08859 return false;
08860 }
08861 if (!this->instanceLocation->IsEqual(that->instanceLocation))
08862 return false;
08863 if (!this->contact->IsEqual(that->contact))
08864 return false;
08865 if (!this->otherOptions->IsEqual(that->otherOptions))
08866 return false;
08867 return true;
08868 }
08869 }
08870 }
08871
08872
08873 bool SystemOption::IsEqual(SystemOption *that)
08874 {
08875 #ifdef DEBUG_OSOPTION
08876 cout << "Start comparing in SystemOption" << endl;
08877 #endif
08878 if (this == NULL)
08879 {
08880 if (that == NULL)
08881 return true;
08882 else
08883 {
08884 #ifdef DEBUG_OSOPTION
08885 cout << "First object is NULL, second is not" << endl;
08886 #endif
08887 return false;
08888 }
08889 }
08890 else
08891 {
08892 if (that == NULL)
08893 {
08894 #ifdef DEBUG_OSOPTION
08895 cout << "Second object is NULL, first is not" << endl;
08896 #endif
08897 return false;
08898 }
08899 else
08900 {
08901 if (!this->minDiskSpace->IsEqual(that->minDiskSpace))
08902 return false;
08903 if (!this->minMemorySize->IsEqual(that->minMemorySize))
08904 return false;
08905 if (!this->minCPUSpeed->IsEqual(that->minCPUSpeed))
08906 return false;
08907 if (!this->minCPUNumber->IsEqual(that->minCPUNumber))
08908 return false;
08909 if (!this->otherOptions->IsEqual(that->otherOptions))
08910 return false;
08911 return true;
08912 }
08913 }
08914 }
08915
08916
08917 bool ServiceOption::IsEqual(ServiceOption *that)
08918 {
08919 #ifdef DEBUG_OSOPTION
08920 cout << "Start comparing in ServiceOption" << endl;
08921 #endif
08922 if (this == NULL)
08923 {
08924 if (that == NULL)
08925 return true;
08926 else
08927 {
08928 #ifdef DEBUG_OSOPTION
08929 cout << "First object is NULL, second is not" << endl;
08930 #endif
08931 return false;
08932 }
08933 }
08934 else
08935 {
08936 if (that == NULL)
08937 {
08938 #ifdef DEBUG_OSOPTION
08939 cout << "Second object is NULL, first is not" << endl;
08940 #endif
08941 return false;
08942 }
08943 else
08944 {
08945 if (this->type != that->type)
08946 {
08947 #ifdef DEBUG_OSOPTION
08948 cout << "service type: " << this->type << " vs. " << that->type << endl;
08949 #endif
08950 return false;
08951 }
08952
08953 if (!this->otherOptions->IsEqual(that->otherOptions))
08954 return false;
08955 return true;
08956 }
08957 }
08958 }
08959
08960
08961 bool JobOption::IsEqual(JobOption *that)
08962 {
08963 #ifdef DEBUG_OSOPTION
08964 cout << "Start comparing in JobOption" << endl;
08965 #endif
08966 if (this == NULL)
08967 {
08968 if (that == NULL)
08969 return true;
08970 else
08971 {
08972 #ifdef DEBUG_OSOPTION
08973 cout << "First object is NULL, second is not" << endl;
08974 #endif
08975 return false;
08976 }
08977 }
08978 else
08979 {
08980 if (that == NULL)
08981 {
08982 #ifdef DEBUG_OSOPTION
08983 cout << "Second object is NULL, first is not" << endl;
08984 #endif
08985 return false;
08986 }
08987 else
08988 {
08989 if (this->requestedStartTime != that->requestedStartTime)
08990 {
08991 #ifdef DEBUG_OSOPTION
08992 cout << "requestedStartTime: " << this->requestedStartTime << " vs. " << that->requestedStartTime << endl;
08993 #endif
08994 return false;
08995 }
08996
08997 if (!this->maxTime->IsEqual(that->maxTime))
08998 return false;
08999 if (!this->dependencies->IsEqual(that->dependencies))
09000 return false;
09001 if (!this->requiredDirectories->IsEqual(that->requiredDirectories))
09002 return false;
09003 if (!this->requiredFiles->IsEqual(that->requiredFiles))
09004 return false;
09005 if (!this->directoriesToMake->IsEqual(that->directoriesToMake))
09006 return false;
09007 if (!this->filesToMake->IsEqual(that->filesToMake))
09008 return false;
09009 if (!this->inputDirectoriesToMove->IsEqual(that->inputDirectoriesToMove))
09010 return false;
09011 if (!this->inputFilesToMove->IsEqual(that->inputFilesToMove))
09012 return false;
09013 if (!this->outputFilesToMove->IsEqual(that->outputFilesToMove))
09014 return false;
09015 if (!this->outputDirectoriesToMove->IsEqual(that->outputDirectoriesToMove))
09016 return false;
09017 if (!this->filesToDelete->IsEqual(that->filesToDelete))
09018 return false;
09019 if (!this->directoriesToDelete->IsEqual(that->directoriesToDelete))
09020 return false;
09021 if (!this->processesToKill->IsEqual(that->processesToKill))
09022 return false;
09023 if (!this->otherOptions->IsEqual(that->otherOptions))
09024 return false;
09025 return true;
09026 }
09027 }
09028 }
09029
09030 bool OptimizationOption::IsEqual(OptimizationOption *that)
09031 {
09032 #ifdef DEBUG_OSOPTION
09033 cout << "Start comparing in OptimizationOption" << endl;
09034 #endif
09035 if (this == NULL)
09036 {
09037 if (that == NULL)
09038 return true;
09039 else
09040 {
09041 #ifdef DEBUG_OSOPTION
09042 cout << "First object is NULL, second is not" << endl;
09043 #endif
09044 return false;
09045 }
09046 }
09047 else
09048 {
09049 if (that == NULL)
09050 {
09051 #ifdef DEBUG_OSOPTION
09052 cout << "Second object is NULL, first is not" << endl;
09053 #endif
09054 return false;
09055 }
09056 else
09057 {
09058 if ((this->numberOfVariables != that->numberOfVariables) &&
09059 (this->numberOfVariables * that->numberOfVariables) != 0)
09060 {
09061 #ifdef DEBUG_OSOPTION
09062 cout << "numberOfVariables: "
09063 << this->numberOfVariables << " vs. " << that->numberOfVariables << endl;
09064 #endif
09065 return false;
09066 }
09067 if ((this->numberOfObjectives != that->numberOfObjectives) &&
09068 (this->numberOfObjectives * that->numberOfObjectives) != 0)
09069 {
09070 #ifdef DEBUG_OSOPTION
09071 cout << "numberOfObjectives: "
09072 << this->numberOfObjectives << " vs. " << that->numberOfObjectives << endl;
09073 #endif
09074 return false;
09075 }
09076 if ((this->numberOfConstraints != that->numberOfConstraints) &&
09077 (this->numberOfConstraints * that->numberOfConstraints) != 0)
09078 {
09079 #ifdef DEBUG_OSOPTION
09080 cout << "numberOfConstraints: "
09081 << this->numberOfConstraints << " vs. " << that->numberOfConstraints << endl;
09082 #endif
09083 return false;
09084 }
09085
09086 if (!this->variables->IsEqual(that->variables))
09087 return false;
09088 if (!this->objectives->IsEqual(that->objectives))
09089 return false;
09090 if (!this->constraints->IsEqual(that->constraints))
09091 return false;
09092 if (!this->solverOptions->IsEqual(that->solverOptions))
09093 return false;
09094 return true;
09095 }
09096 }
09097 }
09098
09099 bool InstanceLocationOption::IsEqual(InstanceLocationOption *that)
09100 {
09101 #ifdef DEBUG_OSOPTION
09102 cout << "Start comparing in InstanceLocationOption" << endl;
09103 #endif
09104 if (this == NULL)
09105 {
09106 if (that == NULL)
09107 return true;
09108 else
09109 {
09110 #ifdef DEBUG_OSOPTION
09111 cout << "First object is NULL, second is not" << endl;
09112 #endif
09113 return false;
09114 }
09115 }
09116 else
09117 {
09118 if (that == NULL)
09119 {
09120 #ifdef DEBUG_OSOPTION
09121 cout << "Second object is NULL, first is not" << endl;
09122 #endif
09123 return false;
09124 }
09125 else
09126 {
09127 if ((this->locationType != that->locationType) || (this->value != that->value))
09128 {
09129 #ifdef DEBUG_OSOPTION
09130 cout << "location type: " << this->locationType << " vs. " << that->locationType << endl;
09131 cout << "value: " << this->value << " vs. " << that->value << endl;
09132 #endif
09133 return false;
09134 }
09135 return true;
09136 }
09137 }
09138 }
09139
09140 bool ContactOption::IsEqual(ContactOption *that)
09141 {
09142 #ifdef DEBUG_OSOPTION
09143 cout << "Start comparing in ContactOption" << endl;
09144 #endif
09145 if (this == NULL)
09146 {
09147 if (that == NULL)
09148 return true;
09149 else
09150 {
09151 #ifdef DEBUG_OSOPTION
09152 cout << "First object is NULL, second is not" << endl;
09153 #endif
09154 return false;
09155 }
09156 }
09157 else
09158 {
09159 if (that == NULL)
09160 {
09161 #ifdef DEBUG_OSOPTION
09162 cout << "Second object is NULL, first is not" << endl;
09163 #endif
09164 return false;
09165 }
09166 else
09167 {
09168 if ((this->transportType != that->transportType) || (this->value != that->value))
09169 {
09170 #ifdef DEBUG_OSOPTION
09171 cout << "transport type: " << this->transportType << " vs. " << that->transportType << endl;
09172 cout << "value: " << this->value << " vs. " << that->value << endl;
09173 #endif
09174 return false;
09175 }
09176 return true;
09177 }
09178 }
09179 }
09180
09181 bool OtherOptions::IsEqual(OtherOptions *that)
09182 {
09183 #ifdef DEBUG_OSOPTION
09184 cout << "Start comparing in OtherOptions" << endl;
09185 #endif
09186 if (this == NULL)
09187 {
09188 if (that == NULL)
09189 return true;
09190 else
09191 {
09192 #ifdef DEBUG_OSOPTION
09193 cout << "First object is NULL, second is not" << endl;
09194 #endif
09195 return false;
09196 }
09197 }
09198 else
09199 {
09200 if (that == NULL)
09201 {
09202 #ifdef DEBUG_OSOPTION
09203 cout << "Second object is NULL, first is not" << endl;
09204 #endif
09205 return false;
09206 }
09207 else
09208 {
09209 if (this->numberOfOtherOptions != that->numberOfOtherOptions)
09210 {
09211 #ifdef DEBUG_OSOPTION
09212 cout << "numberOfOtherOptions: " << this->numberOfOtherOptions << " vs. " << that->numberOfOtherOptions << endl;
09213 #endif
09214 return false;
09215 }
09216 int i;
09217 for (i = 0; i < this->numberOfOtherOptions; i++)
09218 if (!this->other[i]->IsEqual(that->other[i]))
09219 return false;
09220 return true;
09221 }
09222 }
09223 }
09224
09225
09226 bool OtherOption::IsEqual(OtherOption *that)
09227 {
09228 #ifdef DEBUG_OSOPTION
09229 cout << "Start comparing in OtherOption" << endl;
09230 #endif
09231 if (this == NULL)
09232 {
09233 if (that == NULL)
09234 return true;
09235 else
09236 {
09237 #ifdef DEBUG_OSOPTION
09238 cout << "First object is NULL, second is not" << endl;
09239 #endif
09240 return false;
09241 }
09242 }
09243 else
09244 {
09245 if (that == NULL)
09246 {
09247 #ifdef DEBUG_OSOPTION
09248 cout << "Second object is NULL, first is not" << endl;
09249 #endif
09250 return false;
09251 }
09252 else
09253 {
09254 if ((this->name != that->name) ||
09255 (this->value != that->value) ||
09256 (this->description != that->description) )
09257 {
09258 #ifdef DEBUG_OSOPTION
09259 cout << "name: " << this->name << " vs. " << that->name << endl;
09260 cout << "value: " << this->value << " vs. " << that->value << endl;
09261 cout << "description: " << this->description << " vs. " << that->description << endl;
09262 #endif
09263 return false;
09264 }
09265 return true;
09266 }
09267 }
09268 }
09269
09270 bool MinDiskSpace::IsEqual(MinDiskSpace *that)
09271 {
09272 #ifdef DEBUG_OSOPTION
09273 cout << "Start comparing in MinDiskSpace" << endl;
09274 #endif
09275 if (this == NULL)
09276 {
09277 if (that == NULL)
09278 return true;
09279 else
09280 {
09281 #ifdef DEBUG_OSOPTION
09282 cout << "First object is NULL, second is not" << endl;
09283 #endif
09284 return false;
09285 }
09286 }
09287 else
09288 {
09289 if (that == NULL)
09290 {
09291 #ifdef DEBUG_OSOPTION
09292 cout << "Second object is NULL, first is not" << endl;
09293 #endif
09294 return false;
09295 }
09296 else
09297 {
09298 if ((this->unit != that->unit) ||
09299 !isEqual(this->value, that->value) ||
09300 (this->description != that->description) )
09301 {
09302 #ifdef DEBUG_OSOPTION
09303 cout << "unit: " << this->unit << " vs. " << that->unit << endl;
09304 cout << "value: " << this->value << " vs. " << that->value << endl;
09305 cout << "description: " << this->description << " vs. " << that->description << endl;
09306 #endif
09307 return false;
09308 }
09309 return true;
09310 }
09311 }
09312 }
09313
09314 bool MinMemorySize::IsEqual(MinMemorySize *that)
09315 {
09316 #ifdef DEBUG_OSOPTION
09317 cout << "Start comparing in MinMemorySize" << endl;
09318 #endif
09319 if (this == NULL)
09320 {
09321 if (that == NULL)
09322 return true;
09323 else
09324 {
09325 #ifdef DEBUG_OSOPTION
09326 cout << "First object is NULL, second is not" << endl;
09327 #endif
09328 return false;
09329 }
09330 }
09331 else
09332 {
09333 if (that == NULL)
09334 {
09335 #ifdef DEBUG_OSOPTION
09336 cout << "Second object is NULL, first is not" << endl;
09337 #endif
09338 return false;
09339 }
09340 else
09341 {
09342 if ((this->unit != that->unit) ||
09343 !isEqual(this->value, that->value) ||
09344 (this->description != that->description) )
09345 {
09346 #ifdef DEBUG_OSOPTION
09347 cout << "unit: " << this->unit << " vs. " << that->unit << endl;
09348 cout << "value: " << this->value << " vs. " << that->value << endl;
09349 #endif
09350 return false;
09351 }
09352 return true;
09353 }
09354 }
09355 }
09356
09357 bool MinCPUSpeed::IsEqual(MinCPUSpeed *that)
09358 {
09359 #ifdef DEBUG_OSOPTION
09360 cout << "Start comparing in MinCPUSpeed" << endl;
09361 #endif
09362 if (this == NULL)
09363 {
09364 if (that == NULL)
09365 return true;
09366 else
09367 {
09368 #ifdef DEBUG_OSOPTION
09369 cout << "First object is NULL, second is not" << endl;
09370 #endif
09371 return false;
09372 }
09373 }
09374 else
09375 {
09376 if (that == NULL)
09377 {
09378 #ifdef DEBUG_OSOPTION
09379 cout << "Second object is NULL, first is not" << endl;
09380 #endif
09381 return false;
09382 }
09383 else
09384 {
09385 if ((this->unit != that->unit) ||
09386 !isEqual(this->value, that->value) ||
09387 (this->description != that->description) )
09388 {
09389 #ifdef DEBUG_OSOPTION
09390 cout << "unit: " << this->unit << " vs. " << that->unit << endl;
09391 cout << "value: " << this->value << " vs. " << that->value << endl;
09392 #endif
09393 return false;
09394 }
09395 return true;
09396 }
09397 }
09398 }
09399
09400 bool MinCPUNumber::IsEqual(MinCPUNumber *that)
09401 {
09402 #ifdef DEBUG_OSOPTION
09403 cout << "Start comparing in MinCPUNumber" << endl;
09404 #endif
09405 if (this == NULL)
09406 {
09407 if (that == NULL)
09408 return true;
09409 else
09410 {
09411 #ifdef DEBUG_OSOPTION
09412 cout << "First object is NULL, second is not" << endl;
09413 #endif
09414 return false;
09415 }
09416 }
09417 else
09418 {
09419 if (that == NULL)
09420 {
09421 #ifdef DEBUG_OSOPTION
09422 cout << "Second object is NULL, first is not" << endl;
09423 #endif
09424 return false;
09425 }
09426 else
09427 {
09428 if ((this->description != that->description) ||
09429 (this->value != that->value) )
09430 {
09431 #ifdef DEBUG_OSOPTION
09432 cout << "description: " << this->description << " vs. " << that->description << endl;
09433 cout << "value: " << this->value << " vs. " << that->value << endl;
09434 #endif
09435 return false;
09436 }
09437 return true;
09438 }
09439 }
09440 }
09441
09442 bool JobDependencies::IsEqual(JobDependencies *that)
09443 {
09444 #ifdef DEBUG_OSOPTION
09445 cout << "Start comparing in JobDependencies" << endl;
09446 #endif
09447 if (this == NULL)
09448 {
09449 if (that == NULL)
09450 return true;
09451 else
09452 {
09453 #ifdef DEBUG_OSOPTION
09454 cout << "First object is NULL, second is not" << endl;
09455 #endif
09456 return false;
09457 }
09458 }
09459 else
09460 {
09461 if (that == NULL)
09462 {
09463 #ifdef DEBUG_OSOPTION
09464 cout << "Second object is NULL, first is not" << endl;
09465 #endif
09466 return false;
09467 }
09468 else
09469 {
09470 if (this->numberOfJobIDs != that->numberOfJobIDs)
09471 {
09472 #ifdef DEBUG_OSOPTION
09473 cout << "numberOfJobIDs: " << this->numberOfJobIDs << " vs. " << that->numberOfJobIDs << endl;
09474 #endif
09475 return false;
09476 }
09477 int i;
09478 for (i = 0; i < numberOfJobIDs; i++)
09479 if (this->jobID[i] != that->jobID[i])
09480 {
09481 #ifdef DEBUG_OSOPTION
09482 cout << "jobID[" << i << "]: " << this->jobID[i] << " vs. " << that->jobID[i] << endl;
09483 #endif
09484 return false;
09485 }
09486 return true;
09487 }
09488 }
09489 }
09490
09491 bool DirectoriesAndFiles::IsEqual(DirectoriesAndFiles *that)
09492 {
09493 #ifdef DEBUG_OSOPTION
09494 cout << "Start comparing in DirectoriesAndFiles" << endl;
09495 #endif
09496 if (this == NULL)
09497 {
09498 if (that == NULL)
09499 return true;
09500 else
09501 {
09502 #ifdef DEBUG_OSOPTION
09503 cout << "First object is NULL, second is not" << endl;
09504 #endif
09505 return false;
09506 }
09507 }
09508 else
09509 {
09510 if (that == NULL)
09511 {
09512 #ifdef DEBUG_OSOPTION
09513 cout << "Second object is NULL, first is not" << endl;
09514 #endif
09515 return false;
09516 }
09517 else
09518 {
09519 if (this->numberOfPaths != that->numberOfPaths)
09520 {
09521 #ifdef DEBUG_OSOPTION
09522 cout << "numberOfPaths: " << this->numberOfPaths << " vs. " << that->numberOfPaths << endl;
09523 #endif
09524 return false;
09525 }
09526 int i;
09527 for (i = 0; i < numberOfPaths; i++)
09528 if (this->path[i] != that->path[i])
09529 {
09530 #ifdef DEBUG_OSOPTION
09531 cout << "path[" << i << "]: \'" << this->path[i] << "\' vs. \'" << that->path[i] << "\'" << endl;
09532 #endif
09533 return false;
09534 }
09535 return true;
09536 }
09537 }
09538 }
09539
09540 bool PathPairs::IsEqual(PathPairs *that)
09541 {
09542 #ifdef DEBUG_OSOPTION
09543 cout << "Start comparing in PathPairs" << endl;
09544 #endif
09545 if (this == NULL)
09546 {
09547 if (that == NULL)
09548 return true;
09549 else
09550 {
09551 #ifdef DEBUG_OSOPTION
09552 cout << "First object is NULL, second is not" << endl;
09553 #endif
09554 return false;
09555 }
09556 }
09557 else
09558 {
09559 if (that == NULL)
09560 {
09561 #ifdef DEBUG_OSOPTION
09562 cout << "Second object is NULL, first is not" << endl;
09563 #endif
09564 return false;
09565 }
09566 else
09567 {
09568 if (this->numberOfPathPairs != that->numberOfPathPairs)
09569 {
09570 #ifdef DEBUG_OSOPTION
09571 cout << "numberOfPathPairs: " << this->numberOfPathPairs << " vs. " << that->numberOfPathPairs << endl;
09572 #endif
09573 return false;
09574 }
09575 int i;
09576 for (i = 0; i < numberOfPathPairs; i++)
09577 if (!this->pathPair[i]->IsEqual(that->pathPair[i]))
09578 return false;
09579 return true;
09580 }
09581 }
09582 }
09583
09584
09585 bool PathPair::IsEqual(PathPair *that)
09586 {
09587 #ifdef DEBUG_OSOPTION
09588 cout << "Start comparing in PathPair" << endl;
09589 #endif
09590 if (this == NULL)
09591 {
09592 if (that == NULL)
09593 return true;
09594 else
09595 {
09596 #ifdef DEBUG_OSOPTION
09597 cout << "First object is NULL, second is not" << endl;
09598 #endif
09599 return false;
09600 }
09601 }
09602 else
09603 {
09604 if (that == NULL)
09605 {
09606 #ifdef DEBUG_OSOPTION
09607 cout << "Second object is NULL, first is not" << endl;
09608 #endif
09609 return false;
09610 }
09611 else
09612 {
09613 if ((this->from != that->from) || (this->to != that->to) ||
09614 (this->makeCopy != that->makeCopy))
09615 {
09616 #ifdef DEBUG_OSOPTION
09617 cout << "from: " << this->from << " vs. " << that->from << endl;
09618 cout << "to: " << this->to << " vs. " << that->to << endl;
09619 cout << "makeCopy: " << this->makeCopy << " vs. " << that->makeCopy << endl;
09620 #endif
09621 return false;
09622 }
09623 return true;
09624 }
09625 }
09626 }
09627
09628 bool Processes::IsEqual(Processes *that)
09629 {
09630 #ifdef DEBUG_OSOPTION
09631 cout << "Start comparing in Processes" << endl;
09632 #endif
09633 if (this == NULL)
09634 {
09635 if (that == NULL)
09636 return true;
09637 else
09638 {
09639 #ifdef DEBUG_OSOPTION
09640 cout << "First object is NULL, second is not" << endl;
09641 #endif
09642 return false;
09643 }
09644 }
09645 else
09646 {
09647 if (that == NULL)
09648 {
09649 #ifdef DEBUG_OSOPTION
09650 cout << "Second object is NULL, first is not" << endl;
09651 #endif
09652 return false;
09653 }
09654 else
09655 {
09656 if (this->numberOfProcesses != that->numberOfProcesses)
09657 {
09658 #ifdef DEBUG_OSOPTION
09659 cout << "numberOfProcesses: " << this->numberOfProcesses << " vs. " << that->numberOfProcesses << endl;
09660 #endif
09661 return false;
09662 }
09663 int i;
09664 for (i = 0; i < numberOfProcesses; i++)
09665 if (this->process[i] != that->process[i])
09666 {
09667 #ifdef DEBUG_OSOPTION
09668 cout << "process[" << i << "]: " << this->process[i] << " vs. " << that->process[i] << endl;
09669 #endif
09670 return false;
09671 }
09672 return true;
09673 }
09674 }
09675 }
09676
09677
09678 bool VariableOption::IsEqual(VariableOption *that)
09679 {
09680 #ifdef DEBUG_OSOPTION
09681 cout << "Start comparing in VariableOption" << endl;
09682 #endif
09683 if (this == NULL)
09684 {
09685 if (that == NULL)
09686 return true;
09687 else
09688 {
09689 #ifdef DEBUG_OSOPTION
09690 cout << "First object is NULL, second is not" << endl;
09691 #endif
09692 return false;
09693 }
09694 }
09695 else
09696 {
09697 if (that == NULL)
09698 {
09699 #ifdef DEBUG_OSOPTION
09700 cout << "Second object is NULL, first is not" << endl;
09701 #endif
09702 return false;
09703 }
09704 else
09705 {
09706 if (!this->initialVariableValues->IsEqual(that->initialVariableValues))
09707 return false;
09708 if (!this->initialVariableValuesString->IsEqual(that->initialVariableValuesString))
09709 return false;
09710 if (!this->initialBasisStatus->IsEqual(that->initialBasisStatus))
09711 return false;
09712 if (!this->integerVariableBranchingWeights->IsEqual(that->integerVariableBranchingWeights))
09713 return false;
09714 if (!this->sosVariableBranchingWeights->IsEqual(that->sosVariableBranchingWeights))
09715 return false;
09716
09717 if (this->numberOfOtherVariableOptions != that->numberOfOtherVariableOptions)
09718 {
09719 #ifdef DEBUG_OSOPTION
09720 cout << "numberOfOtherVariableOptions: " << this->numberOfOtherVariableOptions << " vs. " << that->numberOfOtherVariableOptions << endl;
09721 #endif
09722 return false;
09723 }
09724
09725 int i;
09726 for (i = 0; i < numberOfOtherVariableOptions; i++)
09727 if (!this->other[i]->IsEqual(that->other[i]))
09728 {
09729 #ifdef DEBUG_OSOPTION
09730 cout << "other[" << i << "]: " << this->other[i] << " vs. " << that->other[i] << endl;
09731 #endif
09732 return false;
09733 }
09734
09735 return true;
09736 }
09737 }
09738 }
09739
09740 bool InitVariableValues::IsEqual(InitVariableValues *that)
09741 {
09742 #ifdef DEBUG_OSOPTION
09743 cout << "Start comparing in InitVariableValues" << endl;
09744 #endif
09745 if (this == NULL)
09746 {
09747 if (that == NULL)
09748 return true;
09749 else
09750 {
09751 #ifdef DEBUG_OSOPTION
09752 cout << "First object is NULL, second is not" << endl;
09753 #endif
09754 return false;
09755 }
09756 }
09757 else
09758 {
09759 if (that == NULL)
09760 {
09761 #ifdef DEBUG_OSOPTION
09762 cout << "Second object is NULL, first is not" << endl;
09763 #endif
09764 return false;
09765 }
09766 else
09767 {
09768 if (this->numberOfVar != that->numberOfVar)
09769 {
09770 #ifdef DEBUG_OSOPTION
09771 cout << "numberOfVar: " << this->numberOfVar << " vs. " << that->numberOfVar << endl;
09772 #endif
09773 return false;
09774 }
09775 int i;
09776 for (i = 0; i < numberOfVar; i++)
09777 if (!this->var[i]->IsEqual(that->var[i]))
09778 return false;
09779 return true;
09780 }
09781 }
09782 }
09783
09784 bool InitVarValue::IsEqual(InitVarValue *that)
09785 {
09786 #ifdef DEBUG_OSOPTION
09787 cout << "Start comparing in InitVarValue" << endl;
09788 #endif
09789 if (this == NULL)
09790 {
09791 if (that == NULL)
09792 return true;
09793 else
09794 {
09795 #ifdef DEBUG_OSOPTION
09796 cout << "First object is NULL, second is not" << endl;
09797 #endif
09798 return false;
09799 }
09800 }
09801 else
09802 {
09803 if (that == NULL)
09804 {
09805 #ifdef DEBUG_OSOPTION
09806 cout << "Second object is NULL, first is not" << endl;
09807 #endif
09808 return false;
09809 }
09810 else
09811 {
09812 if ((this->idx != that->idx) || this->name != that->name || !isEqual(this->value, that->value))
09813
09814 {
09815 #ifdef DEBUG_OSOPTION
09816 cout << "idx: " << this->idx << " vs. " << that->idx << endl;
09817 cout << "value: " << this->value << " vs. " << that->value << endl;
09818 #endif
09819 return false;
09820 }
09821 return true;
09822 }
09823 }
09824 }
09825
09826
09827 bool InitVariableValuesString::IsEqual(InitVariableValuesString *that)
09828 {
09829 #ifdef DEBUG_OSOPTION
09830 cout << "Start comparing in InitVariableValuesString" << endl;
09831 #endif
09832 if (this == NULL)
09833 {
09834 if (that == NULL)
09835 return true;
09836 else
09837 {
09838 #ifdef DEBUG_OSOPTION
09839 cout << "First object is NULL, second is not" << endl;
09840 #endif
09841 return false;
09842 }
09843 }
09844 else
09845 {
09846 if (that == NULL)
09847 {
09848 #ifdef DEBUG_OSOPTION
09849 cout << "Second object is NULL, first is not" << endl;
09850 #endif
09851 return false;
09852 }
09853 else
09854 {
09855 if (this->numberOfVar != that->numberOfVar)
09856 {
09857 #ifdef DEBUG_OSOPTION
09858 cout << "numberOfVar: " << this->numberOfVar << " vs. " << that->numberOfVar << endl;
09859 #endif
09860 return false;
09861 }
09862 int i;
09863 for (i = 0; i < numberOfVar; i++)
09864 if (!this->var[i]->IsEqual(that->var[i]))
09865 return false;
09866 return true;
09867 }
09868 }
09869 }
09870
09871 bool InitVarValueString::IsEqual(InitVarValueString *that)
09872 {
09873 #ifdef DEBUG_OSOPTION
09874 cout << "Start comparing in InitVarValueString" << endl;
09875 #endif
09876 if (this == NULL)
09877 {
09878 if (that == NULL)
09879 return true;
09880 else
09881 {
09882 #ifdef DEBUG_OSOPTION
09883 cout << "First object is NULL, second is not" << endl;
09884 #endif
09885 return false;
09886 }
09887 }
09888 else
09889 {
09890 if (that == NULL)
09891 {
09892 #ifdef DEBUG_OSOPTION
09893 cout << "Second object is NULL, first is not" << endl;
09894 #endif
09895 return false;
09896 }
09897 else
09898 {
09899 if ((this->idx != that->idx) || this->name != that->name || (this->value != that->value))
09900 {
09901 #ifdef DEBUG_OSOPTION
09902 cout << "idx: " << this->idx << " vs. " << that->idx << endl;
09903 cout << "value: " << this->value << " vs. " << that->value << endl;
09904 #endif
09905 return false;
09906 }
09907 return true;
09908 }
09909 }
09910 }
09911
09912 bool InitialBasisStatus::IsEqual(InitialBasisStatus *that)
09913 {
09914 #ifdef DEBUG_OSOPTION
09915 cout << "Start comparing in InitialBasisStatus" << endl;
09916 #endif
09917 if (this == NULL)
09918 {
09919 if (that == NULL)
09920 return true;
09921 else
09922 {
09923 #ifdef DEBUG_OSOPTION
09924 cout << "First object is NULL, second is not" << endl;
09925 #endif
09926 return false;
09927 }
09928 }
09929 else
09930 {
09931 if (that == NULL)
09932 {
09933 #ifdef DEBUG_OSOPTION
09934 cout << "Second object is NULL, first is not" << endl;
09935 #endif
09936 return false;
09937 }
09938 else
09939 {
09940 if (this->numberOfVar != that->numberOfVar)
09941 {
09942 #ifdef DEBUG_OSOPTION
09943 cout << "numberOfVar: " << this->numberOfVar << " vs. " << that->numberOfVar << endl;
09944 #endif
09945 return false;
09946 }
09947 int i;
09948 for (i = 0; i < numberOfVar; i++)
09949 if (!this->var[i]->IsEqual(that->var[i]))
09950 return false;
09951 return true;
09952 }
09953 }
09954 }
09955
09956 bool InitBasStatus::IsEqual(InitBasStatus *that)
09957 {
09958 #ifdef DEBUG_OSOPTION
09959 cout << "Start comparing in InitBasStatus" << endl;
09960 #endif
09961 if (this == NULL)
09962 {
09963 if (that == NULL)
09964 return true;
09965 else
09966 {
09967 #ifdef DEBUG_OSOPTION
09968 cout << "First object is NULL, second is not" << endl;
09969 #endif
09970 return false;
09971 }
09972 }
09973 else
09974 {
09975 if (that == NULL)
09976 {
09977 #ifdef DEBUG_OSOPTION
09978 cout << "Second object is NULL, first is not" << endl;
09979 #endif
09980 return false;
09981 }
09982 else
09983 {
09984 if ((this->idx != that->idx) || (this->value != that->value))
09985 if ((this->value != "unknown" && that->value != "") ||
09986 (that->value != "unknown" && this->value != "") )
09987 {
09988 #ifdef DEBUG_OSOPTION
09989 cout << "idx: " << this->idx << " vs. " << that->idx << endl;
09990 cout << "value: " << this->value << " vs. " << that->value << endl;
09991 #endif
09992 return false;
09993 }
09994 return true;
09995 }
09996 }
09997 }
09998
09999
10000 bool IntegerVariableBranchingWeights::IsEqual(IntegerVariableBranchingWeights *that)
10001 {
10002 #ifdef DEBUG_OSOPTION
10003 cout << "Start comparing in IntegerVariableBranchingWeights" << endl;
10004 #endif
10005 if (this == NULL)
10006 {
10007 if (that == NULL)
10008 return true;
10009 else
10010 {
10011 #ifdef DEBUG_OSOPTION
10012 cout << "First object is NULL, second is not" << endl;
10013 #endif
10014 return false;
10015 }
10016 }
10017 else
10018 {
10019 if (that == NULL)
10020 {
10021 #ifdef DEBUG_OSOPTION
10022 cout << "Second object is NULL, first is not" << endl;
10023 #endif
10024 return false;
10025 }
10026 else
10027 {
10028 if (this->numberOfVar != that->numberOfVar)
10029 {
10030 #ifdef DEBUG_OSOPTION
10031 cout << "numberOfVar: " << this->numberOfVar << " vs. " << that->numberOfVar << endl;
10032 #endif
10033 return false;
10034 }
10035 int i;
10036 for (i = 0; i < numberOfVar; i++)
10037 if (!this->var[i]->IsEqual(that->var[i]))
10038 return false;
10039 return true;
10040 }
10041 }
10042 }
10043
10044 bool SOSVariableBranchingWeights::IsEqual(SOSVariableBranchingWeights *that)
10045 {
10046 #ifdef DEBUG_OSOPTION
10047 cout << "Start comparing in SOSVariableBranchingWeights" << endl;
10048 #endif
10049 if (this == NULL)
10050 {
10051 if (that == NULL)
10052 return true;
10053 else
10054 {
10055 #ifdef DEBUG_OSOPTION
10056 cout << "First object is NULL, second is not" << endl;
10057 #endif
10058 return false;
10059 }
10060 }
10061 else
10062 {
10063 if (that == NULL)
10064 {
10065 #ifdef DEBUG_OSOPTION
10066 cout << "Second object is NULL, first is not" << endl;
10067 #endif
10068 return false;
10069 }
10070 else
10071 {
10072 if (this->numberOfSOS != that->numberOfSOS)
10073 {
10074 #ifdef DEBUG_OSOPTION
10075 cout << "numberOfSOS: " << this->numberOfSOS << " vs. " << that->numberOfSOS << endl;
10076 #endif
10077 return false;
10078 }
10079 int i;
10080 for (i = 0; i < numberOfSOS; i++)
10081 {
10082 if (!this->sos[i]->IsEqual(that->sos[i]))
10083 return false;
10084 }
10085 return true;
10086 }
10087 }
10088 }
10089
10090
10091 bool SOSWeights::IsEqual(SOSWeights *that)
10092 {
10093 #ifdef DEBUG_OSOPTION
10094 cout << "Start comparing in SOSWeights" << endl;
10095 #endif
10096 if (this == NULL)
10097 {
10098 if (that == NULL)
10099 return true;
10100 else
10101 {
10102 #ifdef DEBUG_OSOPTION
10103 cout << "First object is NULL, second is not" << endl;
10104 #endif
10105 return false;
10106 }
10107 }
10108 else
10109 {
10110 if (that == NULL)
10111 {
10112 #ifdef DEBUG_OSOPTION
10113 cout << "Second object is NULL, first is not" << endl;
10114 #endif
10115 return false;
10116 }
10117 else
10118 {
10119 if ((this->sosIdx != that->sosIdx) ||
10120 !isEqual(this->groupWeight, that->groupWeight))
10121 {
10122 #ifdef DEBUG_OSOPTION
10123 cout << "sosIdx: " << this->sosIdx << " vs. " << that->sosIdx << endl;
10124 cout << "groupWeight: " << this->groupWeight << " vs. " << that->groupWeight << endl;
10125 #endif
10126 return false;
10127 }
10128
10129 if (this->numberOfVar != that->numberOfVar)
10130 {
10131 #ifdef DEBUG_OSOPTION
10132 cout << "numberOfVar: " << this->numberOfVar << " vs. " << that->numberOfVar << endl;
10133 #endif
10134 return false;
10135 }
10136 int i;
10137 for (i = 0; i < numberOfVar; i++)
10138 {
10139
10140 if (!this->var[i]->IsEqual(that->var[i]))
10141 return false;
10142 }
10143 return true;
10144 }
10145 }
10146 }
10147
10148
10149 bool BranchingWeight::IsEqual(BranchingWeight *that)
10150 {
10151 #ifdef DEBUG_OSOPTION
10152 cout << "Start comparing in BranchingWeight" << endl;
10153 #endif
10154 if (this == NULL)
10155 {
10156 if (that == NULL)
10157 return true;
10158 else
10159 {
10160 #ifdef DEBUG_OSOPTION
10161 cout << "First object is NULL, second is not" << endl;
10162 #endif
10163 return false;
10164 }
10165 }
10166 else
10167 {
10168 if (that == NULL)
10169 {
10170 #ifdef DEBUG_OSOPTION
10171 cout << "Second object is NULL, first is not" << endl;
10172 #endif
10173 return false;
10174 }
10175 else
10176 {
10177 if ((this->idx != that->idx) || this->name != that->name || !isEqual(this->value, that->value))
10178 {
10179 #ifdef DEBUG_OSOPTION
10180 cout << "idx: " << this->idx << " vs. " << that->idx << endl;
10181 cout << "value: " << this->value << " vs. " << that->value << endl;
10182 cout << "name: -" << this->name << "- vs. -" << that->name << "-" << endl;
10183 #endif
10184 return false;
10185 }
10186 return true;
10187 }
10188 }
10189 }
10190
10191 bool OtherVariableOption::IsEqual(OtherVariableOption *that)
10192 {
10193 #ifdef DEBUG_OSOPTION
10194 cout << "Start comparing in OtherVariableOption" << endl;
10195 #endif
10196 if (this == NULL)
10197 {
10198 if (that == NULL)
10199 return true;
10200 else
10201 {
10202 #ifdef DEBUG_OSOPTION
10203 cout << "First object is NULL, second is not" << endl;
10204 #endif
10205 return false;
10206 }
10207 }
10208 else
10209 {
10210 if (that == NULL)
10211 {
10212 #ifdef DEBUG_OSOPTION
10213 cout << "Second object is NULL, first is not" << endl;
10214 #endif
10215 return false;
10216 }
10217 else
10218 {
10219 if ((this->name != that->name) ||
10220 (this->value != that->value) ||
10221 (this->solver != that->solver) ||
10222 (this->category != that->category) ||
10223 (this->type != that->type) ||
10224 (this->description != that->description))
10225 {
10226 #ifdef DEBUG_OSOPTION
10227 cout << "name: " << this->name << " vs. " << that->name << endl;
10228 cout << "value: " << this->value << " vs. " << that->value << endl;
10229 cout << "solver: " << this->solver << " vs. " << that->solver << endl;
10230 cout << "category: " << this->category << " vs. " << that->category << endl;
10231 cout << "type: " << this->type << " vs. " << that->type << endl;
10232 cout << "description: " << this->description << " vs. " << that->description << endl;
10233 #endif
10234 return false;
10235 }
10236
10237 if (this->numberOfVar != that->numberOfVar)
10238 {
10239 #ifdef DEBUG_OSOPTION
10240 cout << "numberOfVar: " << this->numberOfVar << " vs. " << that->numberOfVar << endl;
10241 #endif
10242 return false;
10243 }
10244 int i;
10245 for (i = 0; i < numberOfVar; i++)
10246 if (!this->var[i]->IsEqual(that->var[i]))
10247 return false;
10248
10249 if (this->numberOfEnumerations != that->numberOfEnumerations)
10250 {
10251 #ifdef DEBUG_OSOPTION
10252 cout << "numberOfEnumerations: " << this->numberOfEnumerations << " vs. " << that->numberOfEnumerations << endl;
10253 #endif
10254 return false;
10255 }
10256 for (i = 0; i < numberOfEnumerations; i++)
10257 if (!this->enumeration[i]->IsEqual(that->enumeration[i]))
10258 return false;
10259 return true;
10260 }
10261 }
10262 }
10263
10264 bool OtherVarOption::IsEqual(OtherVarOption *that)
10265 {
10266 #ifdef DEBUG_OSOPTION
10267 cout << "Start comparing in OtherVarOption" << endl;
10268 #endif
10269 if (this == NULL)
10270 {
10271 if (that == NULL)
10272 return true;
10273 else
10274 {
10275 #ifdef DEBUG_OSOPTION
10276 cout << "First object is NULL, second is not" << endl;
10277 #endif
10278 return false;
10279 }
10280 }
10281 else
10282 {
10283 if (that == NULL)
10284 {
10285 #ifdef DEBUG_OSOPTION
10286 cout << "Second object is NULL, first is not" << endl;
10287 #endif
10288 return false;
10289 }
10290 else
10291 {
10292 if ((this->idx != that->idx) || this->name != that->name || (this->value != that->value) ||
10293 (this->lbValue != that->lbValue) || (this->ubValue != that->ubValue))
10294 {
10295 #ifdef DEBUG_OSOPTION
10296 cout << "idx: " << this->idx << " vs. " << that->idx << endl;
10297 cout << "value: " << this->value << " vs. " << that->value << endl;
10298 cout << "lbValue: " << this->lbValue << " vs. " << that->lbValue << endl;
10299 cout << "ubValue: " << this->ubValue << " vs. " << that->ubValue << endl;
10300 #endif
10301 return false;
10302 }
10303 return true;
10304 }
10305 }
10306 }
10307
10308 bool ObjectiveOption::IsEqual(ObjectiveOption *that)
10309 {
10310 #ifdef DEBUG_OSOPTION
10311 cout << "Start comparing in ObjectiveOption" << endl;
10312 #endif
10313 if (this == NULL)
10314 {
10315 if (that == NULL)
10316 return true;
10317 else
10318 {
10319 #ifdef DEBUG_OSOPTION
10320 cout << "First object is NULL, second is not" << endl;
10321 #endif
10322 return false;
10323 }
10324 }
10325 else
10326 {
10327 if (that == NULL)
10328 {
10329 #ifdef DEBUG_OSOPTION
10330 cout << "Second object is NULL, first is not" << endl;
10331 #endif
10332 return false;
10333 }
10334 else
10335 {
10336 if (!this->initialObjectiveValues->IsEqual(that->initialObjectiveValues))
10337 return false;
10338 if (!this->initialObjectiveBounds->IsEqual(that->initialObjectiveBounds))
10339 return false;
10340 if (!this->initialBasisStatus->IsEqual(that->initialBasisStatus))
10341 return false;
10342
10343 if (this->numberOfOtherObjectiveOptions != that->numberOfOtherObjectiveOptions)
10344 {
10345 #ifdef DEBUG_OSOPTION
10346 cout << "numberOfOtherObjectiveOptions: " << this->numberOfOtherObjectiveOptions << " vs. " << that->numberOfOtherObjectiveOptions << endl;
10347 #endif
10348 return false;
10349 }
10350 int i;
10351 for (i = 0; i < numberOfOtherObjectiveOptions; i++)
10352 if (!this->other[i]->IsEqual(that->other[i]))
10353 return false;
10354
10355 return true;
10356 }
10357 }
10358 }
10359
10360 bool InitObjectiveValues::IsEqual(InitObjectiveValues *that)
10361 {
10362 #ifdef DEBUG_OSOPTION
10363 cout << "Start comparing in InitObjectiveValues" << endl;
10364 #endif
10365 if (this == NULL)
10366 {
10367 if (that == NULL)
10368 return true;
10369 else
10370 {
10371 #ifdef DEBUG_OSOPTION
10372 cout << "First object is NULL, second is not" << endl;
10373 #endif
10374 return false;
10375 }
10376 }
10377 else
10378 {
10379 if (that == NULL)
10380 {
10381 #ifdef DEBUG_OSOPTION
10382 cout << "Second object is NULL, first is not" << endl;
10383 #endif
10384 return false;
10385 }
10386 else
10387 {
10388 if (this->numberOfObj != that->numberOfObj)
10389 {
10390 #ifdef DEBUG_OSOPTION
10391 cout << "numberOfObj: " << this->numberOfObj << " vs. " << that->numberOfObj << endl;
10392 #endif
10393 return false;
10394 }
10395 int i;
10396 for (i = 0; i < numberOfObj; i++)
10397 if (!this->obj[i]->IsEqual(that->obj[i]))
10398 return false;
10399 return true;
10400 }
10401 }
10402 }
10403
10404 bool InitObjValue::IsEqual(InitObjValue *that)
10405 {
10406 #ifdef DEBUG_OSOPTION
10407 cout << "Start comparing in InitObjValue" << endl;
10408 #endif
10409 if (this == NULL)
10410 {
10411 if (that == NULL)
10412 return true;
10413 else
10414 {
10415 #ifdef DEBUG_OSOPTION
10416 cout << "First object is NULL, second is not" << endl;
10417 #endif
10418 return false;
10419 }
10420 }
10421 else
10422 {
10423 if (that == NULL)
10424 {
10425 #ifdef DEBUG_OSOPTION
10426 cout << "Second object is NULL, first is not" << endl;
10427 #endif
10428 return false;
10429 }
10430 else
10431 {
10432 if ((this->idx != that->idx) || this->name != that->name || !isEqual(this->value, that->value))
10433 {
10434 #ifdef DEBUG_OSOPTION
10435 cout << "idx: " << this->idx << " vs. " << that->idx << endl;
10436 cout << "value: " << this->value << " vs. " << that->value << endl;
10437 #endif
10438 return false;
10439 }
10440 return true;
10441 }
10442 }
10443 }
10444
10445 bool InitObjectiveBounds::IsEqual(InitObjectiveBounds *that)
10446 {
10447 #ifdef DEBUG_OSOPTION
10448 cout << "Start comparing in InitObjectiveBounds" << endl;
10449 #endif
10450 if (this == NULL)
10451 {
10452 if (that == NULL)
10453 return true;
10454 else
10455 {
10456 #ifdef DEBUG_OSOPTION
10457 cout << "First object is NULL, second is not" << endl;
10458 #endif
10459 return false;
10460 }
10461 }
10462 else
10463 {
10464 if (that == NULL)
10465 {
10466 #ifdef DEBUG_OSOPTION
10467 cout << "Second object is NULL, first is not" << endl;
10468 #endif
10469 return false;
10470 }
10471 else
10472 {
10473 if (this->numberOfObj != that->numberOfObj)
10474 {
10475 #ifdef DEBUG_OSOPTION
10476 cout << "numberOfObj: " << this->numberOfObj << " vs. " << that->numberOfObj << endl;
10477 #endif
10478 return false;
10479 }
10480 int i;
10481 for (i = 0; i < numberOfObj; i++)
10482 if (!this->obj[i]->IsEqual(that->obj[i]))
10483 return false;
10484 return true;
10485 }
10486 }
10487 }
10488
10489 bool InitObjBound::IsEqual(InitObjBound *that)
10490 {
10491 #ifdef DEBUG_OSOPTION
10492 cout << "Start comparing in InitObjBound" << endl;
10493 #endif
10494 if (this == NULL)
10495 {
10496 if (that == NULL)
10497 return true;
10498 else
10499 {
10500 #ifdef DEBUG_OSOPTION
10501 cout << "First object is NULL, second is not" << endl;
10502 #endif
10503 return false;
10504 }
10505 }
10506 else
10507 {
10508 if (that == NULL)
10509 {
10510 #ifdef DEBUG_OSOPTION
10511 cout << "Second object is NULL, first is not" << endl;
10512 #endif
10513 return false;
10514 }
10515 else
10516 {
10517 if ((this->idx != that->idx) ||
10518 this->name != that->name ||
10519 !isEqual(this->lbValue, that->lbValue) ||
10520 !isEqual(this->ubValue, that->ubValue) )
10521 {
10522 #ifdef DEBUG_OSOPTION
10523 cout << "idx: " << this->idx << " vs. " << that->idx << endl;
10524 cout << "lbValue: " << this->lbValue << " vs. " << that->lbValue << endl;
10525 cout << "ubValue: " << this->ubValue << " vs. " << that->ubValue << endl;
10526 #endif
10527 return false;
10528 }
10529 return true;
10530 }
10531 }
10532 }
10533
10534 bool OtherObjectiveOption::IsEqual(OtherObjectiveOption *that)
10535 {
10536 #ifdef DEBUG_OSOPTION
10537 cout << "Start comparing in OtherObjectiveOption" << endl;
10538 #endif
10539 if (this == NULL)
10540 {
10541 if (that == NULL)
10542 return true;
10543 else
10544 {
10545 #ifdef DEBUG_OSOPTION
10546 cout << "First object is NULL, second is not" << endl;
10547 #endif
10548 return false;
10549 }
10550 }
10551 else
10552 {
10553 if (that == NULL)
10554 {
10555 #ifdef DEBUG_OSOPTION
10556 cout << "Second object is NULL, first is not" << endl;
10557 #endif
10558 return false;
10559 }
10560 else
10561 {
10562 if ((this->name != that->name) ||
10563 (this->value != that->value) ||
10564 (this->solver != that->solver) ||
10565 (this->category != that->category) ||
10566 (this->type != that->type) ||
10567 (this->description != that->description))
10568 {
10569 #ifdef DEBUG_OSOPTION
10570 cout << "name: " << this->name << " vs. " << that->name << endl;
10571 cout << "value: " << this->value << " vs. " << that->value << endl;
10572 cout << "solver: " << this->solver << " vs. " << that->solver << endl;
10573 cout << "category: " << this->category << " vs. " << that->category << endl;
10574 cout << "type: " << this->type << " vs. " << that->type << endl;
10575 cout << "description: " << this->description << " vs. " << that->description << endl;
10576 #endif
10577 return false;
10578 }
10579
10580 if (this->numberOfObj != that->numberOfObj)
10581 {
10582 #ifdef DEBUG_OSOPTION
10583 cout << "numberOfObj: " << this->numberOfObj << " vs. " << that->numberOfObj << endl;
10584 #endif
10585 return false;
10586 }
10587 int i;
10588 for (i = 0; i < numberOfObj; i++)
10589 if (!this->obj[i]->IsEqual(that->obj[i]))
10590 return false;
10591 return true;
10592 }
10593 }
10594 }
10595
10596 bool OtherObjOption::IsEqual(OtherObjOption *that)
10597 {
10598 #ifdef DEBUG_OSOPTION
10599 cout << "Start comparing in OtherObjOption" << endl;
10600 #endif
10601 if (this == NULL)
10602 {
10603 if (that == NULL)
10604 return true;
10605 else
10606 {
10607 #ifdef DEBUG_OSOPTION
10608 cout << "First object is NULL, second is not" << endl;
10609 #endif
10610 return false;
10611 }
10612 }
10613 else
10614 {
10615 if (that == NULL)
10616 {
10617 #ifdef DEBUG_OSOPTION
10618 cout << "Second object is NULL, first is not" << endl;
10619 #endif
10620 return false;
10621 }
10622 else
10623 {
10624 if ((this->idx != that->idx) || this->name != that->name || (this->value != that->value) ||
10625 (this->lbValue != that->lbValue) || (this->ubValue != that->ubValue))
10626 {
10627 #ifdef DEBUG_OSOPTION
10628 cout << "idx: " << this->idx << " vs. " << that->idx << endl;
10629 cout << "value: " << this->value << " vs. " << that->value << endl;
10630 cout << "lbValue: " << this->lbValue << " vs. " << that->lbValue << endl;
10631 cout << "ubValue: " << this->ubValue << " vs. " << that->ubValue << endl;
10632 #endif
10633 return false;
10634 }
10635 return true;
10636 }
10637 }
10638 }
10639
10640 bool ConstraintOption::IsEqual(ConstraintOption *that)
10641 {
10642 #ifdef DEBUG_OSOPTION
10643 cout << "Start comparing in ConstraintOption" << endl;
10644 #endif
10645 if (this == NULL)
10646 {
10647 if (that == NULL)
10648 return true;
10649 else
10650 {
10651 #ifdef DEBUG_OSOPTION
10652 cout << "First object is NULL, second is not" << endl;
10653 #endif
10654 return false;
10655 }
10656 }
10657 else
10658 {
10659 if (that == NULL)
10660 {
10661 #ifdef DEBUG_OSOPTION
10662 cout << "Second object is NULL, first is not" << endl;
10663 #endif
10664 return false;
10665 }
10666 else
10667 {
10668 if (!this->initialConstraintValues->IsEqual(that->initialConstraintValues))
10669 return false;
10670 if (!this->initialDualValues->IsEqual(that->initialDualValues))
10671 return false;
10672 if (!this->initialBasisStatus->IsEqual(that->initialBasisStatus))
10673 return false;
10674
10675 if (this->numberOfOtherConstraintOptions != that->numberOfOtherConstraintOptions)
10676 {
10677 #ifdef DEBUG_OSOPTION
10678 cout << "numberOfOtherConstraintOptions: " << this->numberOfOtherConstraintOptions << " vs. " << that->numberOfOtherConstraintOptions << endl;
10679 #endif
10680 return false;
10681 }
10682 int i;
10683 for (i = 0; i < numberOfOtherConstraintOptions; i++)
10684 if (!this->other[i]->IsEqual(that->other[i]))
10685 return false;
10686
10687 return true;
10688 }
10689 }
10690 }
10691
10692 bool InitConstraintValues::IsEqual(InitConstraintValues *that)
10693 {
10694 #ifdef DEBUG_OSOPTION
10695 cout << "Start comparing in InitConstraintValues" << endl;
10696 #endif
10697 if (this == NULL)
10698 {
10699 if (that == NULL)
10700 return true;
10701 else
10702 {
10703 #ifdef DEBUG_OSOPTION
10704 cout << "First object is NULL, second is not" << endl;
10705 #endif
10706 return false;
10707 }
10708 }
10709 else
10710 {
10711 if (that == NULL)
10712 {
10713 #ifdef DEBUG_OSOPTION
10714 cout << "Second object is NULL, first is not" << endl;
10715 #endif
10716 return false;
10717 }
10718 else
10719 {
10720 if (this->numberOfCon != that->numberOfCon)
10721 {
10722 #ifdef DEBUG_OSOPTION
10723 cout << "numberOfCon: " << this->numberOfCon << " vs. " << that->numberOfCon << endl;
10724 #endif
10725 return false;
10726 }
10727 int i;
10728 for (i = 0; i < numberOfCon; i++)
10729 if (!this->con[i]->IsEqual(that->con[i]))
10730 return false;
10731 return true;
10732 }
10733 }
10734 }
10735
10736 bool InitConValue::IsEqual(InitConValue *that)
10737 {
10738 #ifdef DEBUG_OSOPTION
10739 cout << "Start comparing in InitConValue" << endl;
10740 #endif
10741 if (this == NULL)
10742 {
10743 if (that == NULL)
10744 return true;
10745 else
10746 {
10747 #ifdef DEBUG_OSOPTION
10748 cout << "First object is NULL, second is not" << endl;
10749 #endif
10750 return false;
10751 }
10752 }
10753 else
10754 {
10755 if (that == NULL)
10756 {
10757 #ifdef DEBUG_OSOPTION
10758 cout << "Second object is NULL, first is not" << endl;
10759 #endif
10760 return false;
10761 }
10762 else
10763 {
10764 if ((this->idx != that->idx) || this->name != that->name || !isEqual(this->value, that->value))
10765 {
10766 #ifdef DEBUG_OSOPTION
10767 cout << "idx: " << this->idx << " vs. " << that->idx << endl;
10768 cout << "value: " << this->value << " vs. " << that->value << endl;
10769 #endif
10770 return false;
10771 }
10772 return true;
10773 }
10774 }
10775 }
10776
10777 bool InitDualVariableValues::IsEqual(InitDualVariableValues *that)
10778 {
10779 #ifdef DEBUG_OSOPTION
10780 cout << "Start comparing in InitDualVariableValues" << endl;
10781 #endif
10782 if (this == NULL)
10783 {
10784 if (that == NULL)
10785 return true;
10786 else
10787 {
10788 #ifdef DEBUG_OSOPTION
10789 cout << "First object is NULL, second is not" << endl;
10790 #endif
10791 return false;
10792 }
10793 }
10794 else
10795 {
10796 if (that == NULL)
10797 {
10798 #ifdef DEBUG_OSOPTION
10799 cout << "Second object is NULL, first is not" << endl;
10800 #endif
10801 return false;
10802 }
10803 else
10804 {
10805 if (this->numberOfCon != that->numberOfCon)
10806 {
10807 #ifdef DEBUG_OSOPTION
10808 cout << "numberOfCon: " << this->numberOfCon << " vs. " << that->numberOfCon << endl;
10809 #endif
10810 return false;
10811 }
10812 int i;
10813 for (i = 0; i < numberOfCon; i++)
10814 if (!this->con[i]->IsEqual(that->con[i]))
10815 return false;
10816 return true;
10817 }
10818 }
10819 }
10820
10821 bool InitDualVarValue::IsEqual(InitDualVarValue *that)
10822 {
10823 #ifdef DEBUG_OSOPTION
10824 cout << "Start comparing in InitDualVarValue" << endl;
10825 #endif
10826 if (this == NULL)
10827 {
10828 if (that == NULL)
10829 return true;
10830 else
10831 {
10832 #ifdef DEBUG_OSOPTION
10833 cout << "First object is NULL, second is not" << endl;
10834 #endif
10835 return false;
10836 }
10837 }
10838 else
10839 {
10840 if (that == NULL)
10841 {
10842 #ifdef DEBUG_OSOPTION
10843 cout << "Second object is NULL, first is not" << endl;
10844 #endif
10845 return false;
10846 }
10847 else
10848 {
10849 if ((this->idx != that->idx) || this->name != that->name ||
10850 !isEqual(this->lbDualValue, that->lbDualValue) ||
10851 !isEqual(this->ubDualValue, that->ubDualValue))
10852 {
10853 #ifdef DEBUG_OSOPTION
10854 cout << "idx: " << this->idx << " vs. " << that->idx << endl;
10855 cout << "lbDualValue: " << this->lbDualValue << " vs. " << that->lbDualValue << endl;
10856 cout << "ubDualValue: " << this->ubDualValue << " vs. " << that->ubDualValue << endl;
10857 #endif
10858 return false;
10859 }
10860 return true;
10861 }
10862 }
10863 }
10864
10865 bool OtherConstraintOption::IsEqual(OtherConstraintOption *that)
10866 {
10867 #ifdef DEBUG_OSOPTION
10868 cout << "Start comparing in OtherConstraintOption" << endl;
10869 #endif
10870 if (this == NULL)
10871 {
10872 if (that == NULL)
10873 return true;
10874 else
10875 {
10876 #ifdef DEBUG_OSOPTION
10877 cout << "First object is NULL, second is not" << endl;
10878 #endif
10879 return false;
10880 }
10881 }
10882 else
10883 {
10884 if (that == NULL)
10885 {
10886 #ifdef DEBUG_OSOPTION
10887 cout << "Second object is NULL, first is not" << endl;
10888 #endif
10889 return false;
10890 }
10891 else
10892 {
10893 if ((this->name != that->name) ||
10894 (this->value != that->value) ||
10895 (this->solver != that->solver) ||
10896 (this->category != that->category) ||
10897 (this->type != that->type) ||
10898 (this->description != that->description))
10899 {
10900 #ifdef DEBUG_OSOPTION
10901 cout << "name: " << this->name << " vs. " << that->name << endl;
10902 cout << "value: " << this->value << " vs. " << that->value << endl;
10903 cout << "solver: " << this->solver << " vs. " << that->solver << endl;
10904 cout << "category: " << this->category << " vs. " << that->category << endl;
10905 cout << "type: " << this->type << " vs. " << that->type << endl;
10906 cout << "description: " << this->description << " vs. " << that->description << endl;
10907 #endif
10908 return false;
10909 }
10910
10911 if (this->numberOfCon != that->numberOfCon)
10912 {
10913 #ifdef DEBUG_OSOPTION
10914 cout << "numberOfCon: " << this->numberOfCon << " vs. " << that->numberOfCon << endl;
10915 #endif
10916 return false;
10917 }
10918 int i;
10919 for (i = 0; i < numberOfCon; i++)
10920 if (!this->con[i]->IsEqual(that->con[i]))
10921 return false;
10922 return true;
10923 }
10924 }
10925 }
10926
10927 bool OtherConOption::IsEqual(OtherConOption *that)
10928 {
10929 #ifdef DEBUG_OSOPTION
10930 cout << "Start comparing in OtherConOption" << endl;
10931 #endif
10932 if (this == NULL)
10933 {
10934 if (that == NULL)
10935 return true;
10936 else
10937 {
10938 #ifdef DEBUG_OSOPTION
10939 cout << "First object is NULL, second is not" << endl;
10940 #endif
10941 return false;
10942 }
10943 }
10944 else
10945 {
10946 if (that == NULL)
10947 {
10948 #ifdef DEBUG_OSOPTION
10949 cout << "Second object is NULL, first is not" << endl;
10950 #endif
10951 return false;
10952 }
10953 else
10954 {
10955 if ((this->idx != that->idx) || this->name != that->name || (this->value != that->value) ||
10956 (this->lbValue != that->lbValue) || (this->ubValue != that->ubValue))
10957 {
10958 #ifdef DEBUG_OSOPTION
10959 cout << "idx: " << this->idx << " vs. " << that->idx << endl;
10960 cout << "value: " << this->value << " vs. " << that->value << endl;
10961 cout << "lbValue: " << this->lbValue << " vs. " << that->lbValue << endl;
10962 cout << "ubValue: " << this->ubValue << " vs. " << that->ubValue << endl;
10963 #endif
10964 return false;
10965 }
10966 return true;
10967 }
10968 }
10969 }
10970
10971
10972 bool SolverOptions::IsEqual(SolverOptions *that)
10973 {
10974 #ifdef DEBUG_OSOPTION
10975 cout << "Start comparing in SolverOptions" << endl;
10976 #endif
10977 if (this == NULL)
10978 {
10979 if (that == NULL)
10980 return true;
10981 else
10982 {
10983 #ifdef DEBUG_OSOPTION
10984 cout << "First object is NULL, second is not" << endl;
10985 #endif
10986 return false;
10987 }
10988 }
10989 else
10990 {
10991 if (that == NULL)
10992 {
10993 #ifdef DEBUG_OSOPTION
10994 cout << "Second object is NULL, first is not" << endl;
10995 #endif
10996 return false;
10997 }
10998 else
10999 {
11000 if (this->numberOfSolverOptions != that->numberOfSolverOptions)
11001 {
11002 #ifdef DEBUG_OSOPTION
11003 cout << "numberOfSolverOptions: " << this->numberOfSolverOptions << " vs. " << that->numberOfSolverOptions << endl;
11004 #endif
11005 return false;
11006 }
11007
11008 int i;
11009 for (i = 0; i < numberOfSolverOptions; i++)
11010 if (!this->solverOption[i]->IsEqual(that->solverOption[i]))
11011 return false;
11012
11013 return true;
11014 }
11015 }
11016 }
11017
11018 bool SolverOption::IsEqual(SolverOption *that )
11019 {
11020 #ifdef DEBUG_OSOPTION
11021 cout << "Start comparing in SolverOption" << endl;
11022 #endif
11023 if (this == NULL)
11024 {
11025 if (that == NULL)
11026 return true;
11027 else
11028 {
11029 #ifdef DEBUG_OSOPTION
11030 cout << "First object is NULL, second is not" << endl;
11031 #endif
11032 return false;
11033 }
11034 }
11035 else
11036 {
11037 if (that == NULL)
11038 {
11039 #ifdef DEBUG_OSOPTION
11040 cout << "Second object is NULL, first is not" << endl;
11041 #endif
11042 return false;
11043 }
11044 else
11045 {
11046 if ((this->name != that->name) ||
11047 (this->value != that->value) ||
11048 (this->solver != that->solver) ||
11049 (this->category != that->category) ||
11050 (this->type != that->type) ||
11051 (this->description != that->description))
11052 {
11053 #ifdef DEBUG_OSOPTION
11054 cout << "name: " << this->name << " vs. " << that->name << endl;
11055 cout << "value: " << this->value << " vs. " << that->value << endl;
11056 cout << "solver: " << this->solver << " vs. " << that->solver << endl;
11057 cout << "category: " << this->category << " vs. " << that->category << endl;
11058 cout << "type: " << this->type << " vs. " << that->type << endl;
11059 cout << "description: " << this->description << " vs. " << that->description << endl;
11060 #endif
11061 return false;
11062 }
11063 return true;
11064 }
11065 }
11066 }
11067
11068
11069
11070
11071
11072
11073
11074
11075
11076
11077
11078
11079
11080
11081 bool OSOption::setRandom( double density, bool conformant )
11082 {
11083 #ifdef DEBUG_OSOPTION
11084 cout << "Set random OSOption" << endl;
11085 #endif
11086 if (OSRand() <= density)
11087 {
11088 optionHeader = new GeneralFileHeader();
11089 optionHeader->setRandom(density, conformant);
11090 }
11091 if (OSRand() <= density)
11092 {
11093 general = new GeneralOption();
11094 general->setRandom(density, conformant);
11095 }
11096 if (OSRand() <= density)
11097 {
11098 system = new SystemOption();
11099 system->setRandom(density, conformant);
11100 }
11101 if (OSRand() <= density)
11102 {
11103 service = new ServiceOption();
11104 service->setRandom(density, conformant);
11105 }
11106 if (OSRand() <= density)
11107 {
11108 job = new JobOption();
11109 job->setRandom(density, conformant);
11110 }
11111 if (OSRand() <= density)
11112 {
11113 optimization = new OptimizationOption();
11114 optimization->setRandom(density, conformant);
11115 }
11116 return true;
11117 }
11118
11119
11120 bool GeneralOption::setRandom( double density, bool conformant )
11121 {
11122 #ifdef DEBUG_OSOPTION
11123 cout << "Set random GeneralOption" << endl;
11124 #endif
11125 if (OSRand() <= density) this->serviceURI = "random string";
11126 if (OSRand() <= density) this->serviceName = "random string";
11127 if (OSRand() <= density) this->instanceName = "random string";
11128 if (OSRand() <= density) this->jobID = "random string";
11129 if (OSRand() <= density) this->solverToInvoke = "random string";
11130 if (OSRand() <= density) this->license = "random string";
11131 if (OSRand() <= density) this->userName = "random string";
11132 if (OSRand() <= density) this->password = "random string";
11133
11134 if (OSRand() <= density)
11135 {
11136 instanceLocation = new InstanceLocationOption();
11137 instanceLocation->setRandom(density, conformant);
11138 }
11139 if (OSRand() <= density)
11140 {
11141 contact = new ContactOption();
11142 contact->setRandom(density, conformant);
11143 }
11144 if (OSRand() <= density)
11145 {
11146 otherOptions = new OtherOptions();
11147 otherOptions->setRandom(density, conformant);
11148 }
11149 return true;
11150 }
11151
11152
11153 bool SystemOption::setRandom( double density, bool conformant )
11154 {
11155 #ifdef DEBUG_OSOPTION
11156 cout << "Set random SystemOption" << endl;
11157 #endif
11158 if (OSRand() <= density)
11159 {
11160 minDiskSpace = new StorageCapacity();
11161 minDiskSpace->setRandom(density, conformant);
11162 }
11163 if (OSRand() <= density)
11164 {
11165 minMemorySize = new StorageCapacity();
11166 minMemorySize->setRandom(density, conformant);
11167 }
11168 if (OSRand() <= density)
11169 {
11170 minCPUSpeed = new CPUSpeed();
11171 minCPUSpeed->setRandom(density, conformant);
11172 }
11173 if (OSRand() <= density)
11174 {
11175 minCPUNumber = new CPUNumber();
11176 minCPUNumber->setRandom(density, conformant);
11177 }
11178 if (OSRand() <= density)
11179 {
11180 otherOptions = new OtherOptions();
11181 otherOptions->setRandom(density, conformant);
11182 }
11183 return true;
11184 }
11185
11186
11187 bool ServiceOption::setRandom( double density, bool conformant )
11188 {
11189 #ifdef DEBUG_OSOPTION
11190 cout << "Set random ServiceOption" << endl;
11191 #endif
11192 if (OSRand() <= density)
11193 {
11194 double temp = OSRand();
11195 if (conformant) temp = 0.5*temp;
11196
11197 if (temp <= 0.25) this->type = "solver";
11198 else if (temp <= 0.50) this->type = "agent";
11199 else if (temp <= 0.75) this->type = "";
11200 else this->type = "spy";
11201 }
11202
11203 if (OSRand() <= density)
11204 {
11205 otherOptions = new OtherOptions();
11206 otherOptions->setRandom(density, conformant);
11207 }
11208
11209 return true;
11210 }
11211
11212
11213 bool JobOption::setRandom( double density, bool conformant )
11214 {
11215 #ifdef DEBUG_OSOPTION
11216 cout << "Set random JobOption" << endl;
11217 #endif
11218 if (OSRand() <= density) this->requestedStartTime = "1997-08-11T01:23:45-09:13";
11219
11220 if (OSRand() <= density)
11221 {
11222 maxTime = new TimeSpan();
11223 maxTime->setRandom(density, conformant);
11224 }
11225 if (OSRand() <= density)
11226 {
11227 dependencies = new JobDependencies();
11228 dependencies->setRandom(density, conformant);
11229 }
11230 if (OSRand() <= density)
11231 {
11232 requiredDirectories = new DirectoriesAndFiles();
11233 requiredDirectories->setRandom(density, conformant);
11234 }
11235 if (OSRand() <= density)
11236 {
11237 requiredFiles = new DirectoriesAndFiles();
11238 requiredFiles->setRandom(density, conformant);
11239 }
11240 if (OSRand() <= density)
11241 {
11242 directoriesToMake = new DirectoriesAndFiles();
11243 directoriesToMake->setRandom(density, conformant);
11244 }
11245 if (OSRand() <= density)
11246 {
11247 filesToMake = new DirectoriesAndFiles();
11248 filesToMake->setRandom(density, conformant);
11249 }
11250 if (OSRand() <= density)
11251 {
11252 inputDirectoriesToMove = new PathPairs();
11253 inputDirectoriesToMove->setRandom(density, conformant);
11254 }
11255 if (OSRand() <= density)
11256 {
11257 inputFilesToMove = new PathPairs();
11258 inputFilesToMove->setRandom(density, conformant);
11259 }
11260 if (OSRand() <= density)
11261 {
11262 outputFilesToMove = new PathPairs();
11263 outputFilesToMove->setRandom(density, conformant);
11264 }
11265 if (OSRand() <= density)
11266 {
11267 outputDirectoriesToMove = new PathPairs();
11268 outputDirectoriesToMove->setRandom(density, conformant);
11269 }
11270 if (OSRand() <= density)
11271 {
11272 filesToDelete = new DirectoriesAndFiles();
11273 filesToDelete->setRandom(density, conformant);
11274 }
11275 if (OSRand() <= density)
11276 {
11277 directoriesToDelete = new DirectoriesAndFiles();
11278 directoriesToDelete->setRandom(density, conformant);
11279 }
11280 if (OSRand() <= density)
11281 {
11282 processesToKill = new Processes();
11283 processesToKill->setRandom(density, conformant);
11284 }
11285 if (OSRand() <= density)
11286 {
11287 otherOptions = new OtherOptions();
11288 otherOptions->setRandom(density, conformant);
11289 }
11290 return true;
11291 }
11292
11293 bool OptimizationOption::setRandom( double density, bool conformant )
11294 {
11295 #ifdef DEBUG_OSOPTION
11296 cout << "Set random OptimizationOption" << endl;
11297 #endif
11298 if (OSRand() <= density && !conformant) this->numberOfVariables = (int)(1+9*OSRand());
11299 if (OSRand() <= density && !conformant) this->numberOfObjectives = (int)(1+9*OSRand());
11300 if (OSRand() <= density && !conformant) this->numberOfConstraints = (int)(1+9*OSRand());
11301
11302 if (OSRand() <= density)
11303 {
11304 variables = new VariableOption();
11305 variables->setRandom(density, conformant);
11306 }
11307 if (OSRand() <= density)
11308 {
11309 objectives = new ObjectiveOption();
11310 objectives->setRandom(density, conformant);
11311 }
11312 if (OSRand() <= density)
11313 {
11314 constraints = new ConstraintOption();
11315 constraints->setRandom(density, conformant);
11316 }
11317 if (OSRand() <= density)
11318 {
11319 solverOptions = new SolverOptions();
11320 solverOptions->setRandom(density, conformant);
11321 }
11322
11323 return true;
11324 }
11325
11326 bool InstanceLocationOption::setRandom( double density, bool conformant )
11327 {
11328 #ifdef DEBUG_OSOPTION
11329 cout << "Set random InstanceLocationOption" << endl;
11330 #endif
11331 if (OSRand() <= density) this->value = "http://www.google.com";
11332 if (OSRand() <= density)
11333 {
11334 double temp = OSRand();
11335 if (conformant) temp = 0.5*temp;
11336
11337 if (temp <= 0.25) this->locationType = "local";
11338 else if (temp <= 0.50) this->locationType = "ftp";
11339 else if (temp <= 0.75) this->locationType = "";
11340 else this->locationType = "global";
11341 }
11342 return true;
11343 }
11344
11345 bool ContactOption::setRandom( double density, bool conformant )
11346 {
11347 #ifdef DEBUG_OSOPTION
11348 cout << "Set random ContactOption" << endl;
11349 #endif
11350 if (OSRand() <= density) this->value = "http://www.google.com";
11351 if (OSRand() <= density)
11352 {
11353 double temp = OSRand();
11354 if (conformant) temp = 0.5*temp;
11355
11356 if (temp <= 0.25) this->transportType = "osp";
11357 else if (temp <= 0.50) this->transportType = "ftp";
11358 else if (temp <= 0.75) this->transportType = "";
11359 else this->transportType = "nlp";
11360 }
11361 return true;
11362 }
11363
11364 bool OtherOptions::setRandom( double density, bool conformant )
11365 {
11366 #ifdef DEBUG_OSOPTION
11367 cout << "Set random OtherOptions" << endl;
11368 #endif
11369 int n;
11370
11371 this->numberOfOtherOptions = (int)(1+4*OSRand());
11372
11373 if (conformant) n = this->numberOfOtherOptions;
11374 else n = (int)(1+4*OSRand());
11375
11376 other = new OtherOption*[n];
11377
11378 for (int i = 0; i < n; i++)
11379 {
11380 other[i] = new OtherOption();
11381 other[i]->setRandom(density, conformant);
11382 }
11383
11384 return true;
11385 }
11386
11387 bool OtherOption::setRandom( double density, bool conformant )
11388 {
11389 #ifdef DEBUG_OSOPTION
11390 cout << "Set random OtherOption" << endl;
11391 #endif
11392 if (OSRand() <= density || conformant) this->name = "random string";
11393 if (OSRand() <= density) this->value = "random string";
11394 if (OSRand() <= density) this->description = "random string";
11395 return true;
11396 }
11397
11398
11399
11400 bool JobDependencies::setRandom( double density, bool conformant )
11401 {
11402 #ifdef DEBUG_OSOPTION
11403 cout << "Set random JobDependencies" << endl;
11404 #endif
11405 int n;
11406
11407 this->numberOfJobIDs = (int)(1+4*OSRand());
11408
11409 if (conformant) n = this->numberOfJobIDs;
11410 else n = (int)(1+4*OSRand());
11411
11412 jobID = new std::string[n];
11413 for (int i = 0; i < n; i++)
11414 jobID[i] = "random string";
11415
11416 return true;
11417 }
11418
11419 bool DirectoriesAndFiles::setRandom( double density, bool conformant )
11420 {
11421 #ifdef DEBUG_OSOPTION
11422 cout << "Set random DirectoriesAndFiles" << endl;
11423 #endif
11424 int n;
11425
11426 this->numberOfPaths = (int)(1+4*OSRand());
11427
11428 if (conformant) n = this->numberOfPaths;
11429 else n = (int)(1+4*OSRand());
11430
11431 path = new std::string[n];
11432 for (int i = 0; i < n; i++)
11433 path[i] = "random string";
11434
11435 return true;
11436 }
11437
11438 bool PathPairs::setRandom( double density, bool conformant )
11439 {
11440 #ifdef DEBUG_OSOPTION
11441 cout << "Set random PathPairs" << endl;
11442 #endif
11443 int n;
11444
11445 this->numberOfPathPairs = (int)(1+4*OSRand());
11446
11447 if (conformant) n = this->numberOfPathPairs;
11448 else n =(int)(1+4*OSRand());
11449
11450 pathPair = new PathPair*[n];
11451 for (int i = 0; i < n; i++)
11452 {
11453 this->pathPair[i] = new PathPair();
11454 this->pathPair[i]->setRandom(density, conformant);
11455 }
11456
11457 return true;
11458 }
11459
11460 bool PathPair::setRandom( double density, bool conformant )
11461 {
11462 #ifdef DEBUG_OSOPTION
11463 cout << "Set random PathPair" << endl;
11464 #endif
11465 this->from = "random string";
11466 this->to = "random string";
11467 if (OSRand() <= density) this->makeCopy = (OSRand() <= 0.5);
11468 return true;
11469 }
11470
11471 bool Processes::setRandom( double density, bool conformant )
11472 {
11473 #ifdef DEBUG_OSOPTION
11474 cout << "Set random Processes" << endl;
11475 #endif
11476 int n;
11477
11478 this->numberOfProcesses = (int)(1+4*OSRand());
11479
11480 if (conformant) n = this->numberOfProcesses;
11481 else n = (int)(1+4*OSRand());
11482
11483 process = new std::string[n];
11484 for (int i = 0; i < n; i++)
11485 process[i] = "random string";
11486
11487 return true;
11488 }
11489
11490 bool VariableOption::setRandom( double density, bool conformant )
11491 {
11492 #ifdef DEBUG_OSOPTION
11493 cout << "Set random VariableOption" << endl;
11494 #endif
11495 if (OSRand() <= density)
11496 {
11497 this->initialVariableValues = new InitVariableValues();
11498 this->initialVariableValues->setRandom(density, conformant);
11499 }
11500 return false;
11501 if (OSRand() <= density)
11502 {
11503 this->initialVariableValuesString = new InitVariableValuesString();
11504 this->initialVariableValuesString->setRandom(density, conformant);
11505 }
11506 if (OSRand() <= density)
11507 {
11508 this->initialBasisStatus = new BasisStatus();
11509 this->initialBasisStatus->setRandom(density, conformant, 0, 9);
11510 }
11511 if (OSRand() <= density)
11512 {
11513 this->integerVariableBranchingWeights = new IntegerVariableBranchingWeights();
11514 this->integerVariableBranchingWeights->setRandom(density, conformant);
11515 }
11516 if (OSRand() <= density)
11517 {
11518 this->sosVariableBranchingWeights = new SOSVariableBranchingWeights();
11519 this->sosVariableBranchingWeights->setRandom(density, conformant);
11520 }
11521
11522
11523 this->numberOfOtherVariableOptions = (int)(4*OSRand());
11524
11525 int n;
11526
11527 if (conformant) n = this->numberOfOtherVariableOptions;
11528 else n = (int)(4*OSRand());
11529
11530 other = new OtherVariableOption*[n];
11531 for (int i = 0; i < n; i++)
11532 {
11533 other[i] = new OtherVariableOption();
11534 other[i]->setRandom(density, conformant);
11535 }
11536 return true;
11537 }
11538
11539 bool InitVariableValues::setRandom( double density, bool conformant )
11540 {
11541 #ifdef DEBUG_OSOPTION
11542 cout << "Set random InitVariableValues" << endl;
11543 #endif
11544 this->numberOfVar = (int)(1+4*OSRand());
11545
11546 int n;
11547
11548 if (conformant) n = this->numberOfVar;
11549 else n = (int)(1+4*OSRand());
11550
11551 var = new InitVarValue*[n];
11552 for (int i = 0; i < n; i++)
11553 {
11554 var[i] = new InitVarValue();
11555 var[i]->setRandom(density, conformant);
11556 }
11557 return true;
11558 }
11559
11560 bool InitVarValue::setRandom( double density, bool conformant )
11561 {
11562 #ifdef DEBUG_OSOPTION
11563 cout << "Set random InitVarValue" << endl;
11564 #endif
11565 this->idx = (int)(4*OSRand());
11566
11567 if (OSRand() <= density)
11568 this->name = "random string";
11569
11570 if (OSRand() <= density)
11571 {
11572 if (OSRand() <= 0.5) this->value = 3.14156;
11573 else this->value = 2.71828;
11574 }
11575 return true;
11576 }
11577
11578
11579 bool InitVariableValuesString::setRandom( double density, bool conformant )
11580 {
11581 #ifdef DEBUG_OSOPTION
11582 cout << "Set random InitVariableValuesString" << endl;
11583 #endif
11584 this->numberOfVar = (int)(1+4*OSRand());
11585
11586 int n;
11587
11588 if (conformant) n = this->numberOfVar;
11589 else n = (int)(1+4*OSRand());
11590
11591 var = new InitVarValueString*[n];
11592 for (int i = 0; i < n; i++)
11593 {
11594 var[i] = new InitVarValueString();
11595 var[i]->setRandom(density, conformant);
11596 }
11597 return true;
11598 }
11599
11600 bool InitVarValueString::setRandom( double density, bool conformant )
11601 {
11602 #ifdef DEBUG_OSOPTION
11603 cout << "Set random InitVarValueString" << endl;
11604 #endif
11605 this->idx = (int)(4*OSRand());
11606
11607 if (OSRand() <= density) this->name = "random string";
11608 if (OSRand() <= density) this->value = "random string";
11609
11610 return true;
11611 }
11612
11613
11614 bool IntegerVariableBranchingWeights::setRandom( double density, bool conformant )
11615 {
11616 #ifdef DEBUG_OSOPTION
11617 cout << "Set random IntegerVariableBranchingWeights" << endl;
11618 #endif
11619 this->numberOfVar = (int)(1+4*OSRand());
11620
11621 int n;
11622
11623 if (conformant) n = this->numberOfVar;
11624 else n = (int)(1+4*OSRand());
11625
11626 var = new BranchingWeight*[n];
11627 for (int i = 0; i < n; i++)
11628 {
11629 var[i] = new BranchingWeight();
11630 var[i]->setRandom(density, conformant);
11631 }
11632 return true;
11633 }
11634
11635 bool SOSVariableBranchingWeights::setRandom( double density, bool conformant )
11636 {
11637 #ifdef DEBUG_OSOPTION
11638 cout << "Set random SOSVariableBranchingWeights" << endl;
11639 #endif
11640 this->numberOfSOS = (int)(1+4*OSRand());
11641
11642 int n;
11643
11644 if (conformant) n = this->numberOfSOS;
11645 else n = (int)(1+4*OSRand());
11646
11647 sos = new SOSWeights*[n];
11648 for (int i = 0; i < n; i++)
11649 {
11650 sos[i] = new SOSWeights();
11651 sos[i]->setRandom(density, conformant);
11652 }
11653 return true;
11654 }
11655
11656
11657 bool SOSWeights::setRandom( double density, bool conformant )
11658 {
11659 #ifdef DEBUG_OSOPTION
11660 cout << "Set random SOSWeights" << endl;
11661 #endif
11662 this->sosIdx = (int)(4*OSRand());
11663 this->numberOfVar = (int)(4*OSRand());
11664
11665 if (OSRand() <= density) this->groupWeight = OSRand();
11666
11667
11668 int n;
11669
11670 if (conformant) n = this->numberOfVar;
11671 else n = (int)(4*OSRand());
11672
11673 var = new BranchingWeight*[n];
11674 for (int i = 0; i < n; i++)
11675 {
11676 var[i] = new BranchingWeight();
11677 var[i]->setRandom(density, conformant);
11678 }
11679 return true;
11680 }
11681
11682
11683 bool BranchingWeight::setRandom( double density, bool conformant )
11684 {
11685 #ifdef DEBUG_OSOPTION
11686 cout << "Set random BranchingWeight" << endl;
11687 #endif
11688 this->idx = (int)(4*OSRand());
11689
11690 if (OSRand() <= density) this->name = "random string";
11691
11692 if (OSRand() <= density)
11693 this->value = OSRand();
11694 return true;
11695 }
11696
11697 bool OtherVariableOption::setRandom( double density, bool conformant )
11698 {
11699 #ifdef DEBUG_OSOPTION
11700 cout << "Set random OtherVariableOption" << endl;
11701 #endif
11702 this->name = "random string";
11703 if (OSRand() <= density) this->name = "randon string";
11704 if (OSRand() <= density) this->value = "randon string";
11705 if (OSRand() <= density) this->solver = "randon string";
11706 if (OSRand() <= density) this->category = "randon string";
11707 if (OSRand() <= density) this->type = "randon string";
11708 if (OSRand() <= density) this->description = "randon string";
11709
11710 if (OSRand() <= density)
11711 {
11712 if (OSRand() <= 0.5)
11713 {
11714 this->numberOfVar = (int)(4*OSRand());
11715
11716 int n;
11717
11718 if (conformant) n = this->numberOfVar;
11719 else n = (int)(4*OSRand());
11720
11721 var = new OtherVarOption*[n];
11722 for (int i = 0; i < n; i++)
11723 {
11724 var[i] = new OtherVarOption();
11725 var[i]->setRandom(density, conformant);
11726 }
11727 }
11728 else
11729 {
11730 this->numberOfEnumerations = (int)(4*OSRand());
11731
11732 int n;
11733
11734 if (conformant) n = this->numberOfEnumerations;
11735 else n = (int)(4*OSRand());
11736
11737 enumeration = new OtherOptionEnumeration*[n];
11738 for (int i = 0; i < n; i++)
11739 {
11740 enumeration[i] = new OtherOptionEnumeration();
11741 enumeration[i]->setRandom(density, conformant, 0, 9);
11742 }
11743 }
11744 }
11745 return true;
11746 }
11747
11748 bool OtherVarOption::setRandom( double density, bool conformant )
11749 {
11750 #ifdef DEBUG_OSOPTION
11751 cout << "Set random OtherVarOption" << endl;
11752 #endif
11753 this->idx = (int)(4*OSRand());
11754 if (OSRand() <= density) this->name = "random string";
11755 if (OSRand() <= density) this->value = "random string";
11756 if (OSRand() <= density) this->lbValue = "random string";
11757 if (OSRand() <= density) this->ubValue = "random string";
11758 return true;
11759 }
11760
11761 bool ObjectiveOption::setRandom( double density, bool conformant )
11762 {
11763 #ifdef DEBUG_OSOPTION
11764 cout << "Set random ObjectiveOption" << endl;
11765 #endif
11766 if (OSRand() <= density)
11767 {
11768 this->initialObjectiveValues = new InitObjectiveValues();
11769 this->initialObjectiveValues->setRandom(density, conformant);
11770 }
11771 return false;
11772 if (OSRand() <= density)
11773 {
11774 this->initialObjectiveBounds = new InitObjectiveBounds();
11775 this->initialObjectiveBounds->setRandom(density, conformant);
11776 }
11777 if (OSRand() <= density)
11778 {
11779 this->initialBasisStatus = new BasisStatus();
11780 this->initialBasisStatus->setRandom(density, conformant, -2, -1);
11781 }
11782
11783 if (OSRand() <= density)
11784 {
11785 this->numberOfOtherObjectiveOptions = (int)(4*OSRand());
11786
11787 int n;
11788
11789 if (conformant) n = this->numberOfOtherObjectiveOptions;
11790 else n = (int)(4*OSRand());
11791
11792 other = new OtherObjectiveOption*[n];
11793 for (int i = 0; i < n; i++)
11794 {
11795 other[i] = new OtherObjectiveOption();
11796 other[i]->setRandom(density, conformant);
11797 }
11798 }
11799 return true;
11800 }
11801
11802 bool InitObjectiveValues::setRandom( double density, bool conformant )
11803 {
11804 #ifdef DEBUG_OSOPTION
11805 cout << "Set random InitObjectiveValues" << endl;
11806 #endif
11807 this->numberOfObj = (int)(1+4*OSRand());
11808
11809 int n;
11810
11811 if (conformant) n = this->numberOfObj;
11812 else n = (int)(1+4*OSRand());
11813
11814 obj = new InitObjValue*[n];
11815 for (int i = 0; i < n; i++)
11816 {
11817 obj[i] = new InitObjValue();
11818 obj[i]->setRandom(density, conformant);
11819 }
11820 return true;
11821 }
11822
11823 bool InitObjValue::setRandom( double density, bool conformant )
11824 {
11825 #ifdef DEBUG_OSOPTION
11826 cout << "Set random InitObjValue" << endl;
11827 #endif
11828 if (OSRand() <= 0.5) idx = -1;
11829 else idx = -2;
11830
11831 if (OSRand() <= density) this->name = "random string";
11832
11833 if (OSRand() <= density)
11834 {
11835 if (OSRand() <= 0.5) this->value = 3.14156;
11836 else this->value = 2.71828;
11837 }
11838 return true;
11839 }
11840
11841 bool InitObjectiveBounds::setRandom( double density, bool conformant )
11842 {
11843 #ifdef DEBUG_OSOPTION
11844 cout << "Set random InitObjectiveBounds" << endl;
11845 #endif
11846 this->numberOfObj = (int)(1+4*OSRand());
11847
11848 int n;
11849
11850 if (conformant) n = this->numberOfObj;
11851 else n = (int)(1+4*OSRand());
11852
11853 obj = new InitObjBound*[n];
11854 for (int i = 0; i < n; i++)
11855 {
11856 obj[i] = new InitObjBound();
11857 obj[i]->setRandom(density, conformant);
11858 }
11859 return true;
11860 }
11861
11862 bool InitObjBound::setRandom( double density, bool conformant )
11863 {
11864 #ifdef DEBUG_OSOPTION
11865 cout << "Set random InitObjBound" << endl;
11866 #endif
11867 if (OSRand() <= 0.5) idx = -1;
11868 else idx = -2;
11869
11870 if (OSRand() <= density) this->name = "random string";
11871
11872 if (OSRand() <= density)
11873 {
11874 if (OSRand() <= 0.5) this->lbValue = 3.14156;
11875 else this->lbValue = 2.71828;
11876 if (OSRand() <= 0.5) this->ubValue = 3.14156;
11877 else this->ubValue = 2.71828;
11878 }
11879 return true;
11880 }
11881
11882 bool OtherObjectiveOption::setRandom( double density, bool conformant )
11883 {
11884 #ifdef DEBUG_OSOPTION
11885 cout << "Set random OtherObjectiveOption" << endl;
11886 #endif
11887 this->name = "random string";
11888 if (OSRand() <= density) this->name = "randon string";
11889 if (OSRand() <= density) this->value = "randon string";
11890 if (OSRand() <= density) this->solver = "randon string";
11891 if (OSRand() <= density) this->category = "randon string";
11892 if (OSRand() <= density) this->type = "randon string";
11893 if (OSRand() <= density) this->description = "randon string";
11894
11895 if (OSRand() <= density)
11896 {
11897 if (OSRand() <= 0.5)
11898 {
11899 this->numberOfObj = (int)(4*OSRand());
11900
11901 int n;
11902
11903 if (conformant) n = this->numberOfObj;
11904 else n = (int)(4*OSRand());
11905
11906 obj = new OtherObjOption*[n];
11907 for (int i = 0; i < n; i++)
11908 {
11909 obj[i] = new OtherObjOption();
11910 obj[i]->setRandom(density, conformant);
11911 }
11912 }
11913 else
11914 {
11915 this->numberOfEnumerations = (int)(4*OSRand());
11916
11917 int n;
11918
11919 if (conformant) n = this->numberOfEnumerations;
11920 else n = (int)(4*OSRand());
11921
11922 enumeration = new OtherOptionEnumeration*[n];
11923 for (int i = 0; i < n; i++)
11924 {
11925 enumeration[i] = new OtherOptionEnumeration();
11926 enumeration[i]->setRandom(density, conformant, -2, -1);
11927 }
11928 }
11929 }
11930 return true;
11931 }
11932
11933 bool OtherObjOption::setRandom( double density, bool conformant )
11934 {
11935 #ifdef DEBUG_OSOPTION
11936 cout << "Set random OtherObjOption" << endl;
11937 #endif
11938 if (OSRand() <= 0.5) this->idx = -1;
11939 else this->idx = -2;
11940 if (OSRand() <= density) this->name = "random string";
11941 if (OSRand() <= density) this->value = "random string";
11942 if (OSRand() <= density) this->lbValue = "random string";
11943 if (OSRand() <= density) this->ubValue = "random string";
11944 return true;
11945 }
11946
11947 bool ConstraintOption::setRandom( double density, bool conformant )
11948 {
11949 #ifdef DEBUG_OSOPTION
11950 cout << "Set random ConstraintOption" << endl;
11951 #endif
11952 if (OSRand() <= density)
11953 {
11954 this->initialConstraintValues = new InitConstraintValues();
11955 this->initialConstraintValues->setRandom(density, conformant);
11956 }
11957 return false;
11958 if (OSRand() <= density)
11959 {
11960 this->initialDualValues = new InitDualVariableValues();
11961 this->initialDualValues->setRandom(density, conformant);
11962 }
11963 if (OSRand() <= density)
11964 {
11965 this->initialBasisStatus = new BasisStatus();
11966 this->initialBasisStatus->setRandom(density, conformant, 0, 4);
11967 }
11968
11969 if (OSRand() <= density)
11970 {
11971 this->numberOfOtherConstraintOptions = (int)(4*OSRand());
11972
11973 int n;
11974
11975 if (conformant) n = this->numberOfOtherConstraintOptions;
11976 else n = (int)(4*OSRand());
11977
11978 other = new OtherConstraintOption*[n];
11979 for (int i = 0; i < n; i++)
11980 {
11981 other[i] = new OtherConstraintOption();
11982 other[i]->setRandom(density, conformant);
11983 }
11984 }
11985 return true;
11986 }
11987
11988 bool InitConstraintValues::setRandom( double density, bool conformant )
11989 {
11990 #ifdef DEBUG_OSOPTION
11991 cout << "Set random InitConstraintValues" << endl;
11992 #endif
11993 this->numberOfCon = (int)(1+4*OSRand());
11994
11995 int n;
11996
11997 if (conformant) n = this->numberOfCon;
11998 else n = (int)(1+4*OSRand());
11999
12000 con = new InitConValue*[n];
12001 for (int i = 0; i < n; i++)
12002 {
12003 con[i] = new InitConValue();
12004 con[i]->setRandom(density, conformant);
12005 }
12006 return true;
12007 }
12008
12009 bool InitConValue::setRandom( double density, bool conformant )
12010 {
12011 #ifdef DEBUG_OSOPTION
12012 cout << "Set random InitConValue" << endl;
12013 #endif
12014 this->idx = (int)(4*OSRand());
12015
12016 if (OSRand() <= density) this->name = "random string";
12017
12018 if (OSRand() <= density)
12019 {
12020 if (OSRand() <= 0.5) this->value = 3.14156;
12021 else this->value = 2.71828;
12022 }
12023 return true;
12024 }
12025
12026 bool InitDualVariableValues::setRandom( double density, bool conformant )
12027 {
12028 #ifdef DEBUG_OSOPTION
12029 cout << "Set random InitDualVariableValues" << endl;
12030 #endif
12031 this->numberOfCon = (int)(1+4*OSRand());
12032
12033 int n;
12034
12035 if (conformant) n = this->numberOfCon;
12036 else n = (int)(1+4*OSRand());
12037
12038 con = new InitDualVarValue*[n];
12039 for (int i = 0; i < n; i++)
12040 {
12041 con[i] = new InitDualVarValue();
12042 con[i]->setRandom(density, conformant);
12043 }
12044 return true;
12045 }
12046
12047 bool InitDualVarValue::setRandom( double density, bool conformant )
12048 {
12049 #ifdef DEBUG_OSOPTION
12050 cout << "Set random InitDualVarValue" << endl;
12051 #endif
12052 this->idx = (int)(4*OSRand());
12053
12054 if (OSRand() <= density) this->name = "random string";
12055
12056 if (OSRand() <= density)
12057 {
12058 if (OSRand() <= 0.5) this->lbDualValue = 3.14156;
12059 else this->lbDualValue = 2.71828;
12060 if (OSRand() <= 0.5) this->ubDualValue = 3.14156;
12061 else this->ubDualValue = 2.71828;
12062 }
12063 return true;
12064 }
12065
12066 bool OtherConstraintOption::setRandom( double density, bool conformant )
12067 {
12068 #ifdef DEBUG_OSOPTION
12069 cout << "Set random OtherConstraintOption" << endl;
12070 #endif
12071 this->name = "random string";
12072 if (OSRand() <= density) this->name = "randon string";
12073 if (OSRand() <= density) this->value = "randon string";
12074 if (OSRand() <= density) this->solver = "randon string";
12075 if (OSRand() <= density) this->category = "randon string";
12076 if (OSRand() <= density) this->type = "randon string";
12077 if (OSRand() <= density) this->description = "randon string";
12078
12079 if (OSRand() <= density)
12080 {
12081 if (OSRand() <= 0.5)
12082 {
12083 this->numberOfCon = (int)(4*OSRand());
12084
12085 int n;
12086
12087 if (conformant) n = this->numberOfCon;
12088 else n = (int)(4*OSRand());
12089
12090 con = new OtherConOption*[n];
12091 for (int i = 0; i < n; i++)
12092 {
12093 con[i] = new OtherConOption();
12094 con[i]->setRandom(density, conformant);
12095 }
12096 }
12097 else
12098 {
12099 this->numberOfEnumerations = (int)(4*OSRand());
12100
12101 int n;
12102
12103 if (conformant) n = this->numberOfEnumerations;
12104 else n = (int)(4*OSRand());
12105
12106 enumeration = new OtherOptionEnumeration*[n];
12107 for (int i = 0; i < n; i++)
12108 {
12109 enumeration[i] = new OtherOptionEnumeration();
12110 enumeration[i]->setRandom(density, conformant, 0, 4);
12111 }
12112 }
12113 }
12114 return true;
12115 }
12116
12117 bool OtherConOption::setRandom( double density, bool conformant )
12118 {
12119 #ifdef DEBUG_OSOPTION
12120 cout << "Set random OtherConOption" << endl;
12121 #endif
12122 this->idx = (int)(4*OSRand());
12123 if (OSRand() <= density) this->name = "random string";
12124 if (OSRand() <= density) this->value = "random string";
12125 if (OSRand() <= density) this->lbValue = "random string";
12126 if (OSRand() <= density) this->ubValue = "random string";
12127 return true;
12128 }
12129
12130
12131 bool SolverOptions::setRandom( double density, bool conformant )
12132 {
12133 #ifdef DEBUG_OSOPTION
12134 cout << "Set random SolverOptions" << endl;
12135 #endif
12136 this->numberOfSolverOptions = (int)(1+4*OSRand());
12137
12138 int n;
12139
12140 if (conformant) n = this->numberOfSolverOptions;
12141 else n = (int)(1+4*OSRand());
12142
12143 solverOption = new SolverOption*[n];
12144 for (int i = 0; i < n; i++)
12145 {
12146 solverOption[i] = new SolverOption();
12147 solverOption[i]->setRandom(density, conformant);
12148 }
12149 return true;
12150 }
12151
12152 bool SolverOption::setRandom( double density, bool conformant )
12153 {
12154 #ifdef DEBUG_OSOPTION
12155 cout << "Set random SolverOption" << endl;
12156 #endif
12157 if (OSRand() <= density || conformant) this->name = "random string";
12158
12159 if (OSRand() <= density) this->value = "random string";
12160 if (OSRand() <= density) this->solver = "random string";
12161 if (OSRand() <= density) this->category = "random string";
12162 if (OSRand() <= density) this->type = "random string";
12163 if (OSRand() <= density) this->description = "random string";
12164
12165 if (OSRand() <= density)
12166 {
12167 this->numberOfItems = (int)(4*OSRand());
12168
12169 int n;
12170
12171 if (conformant) n = this->numberOfItems;
12172 else n = (int)(4*OSRand());
12173
12174 item = new std::string[n];
12175 for (int i = 0; i < n; i++)
12176 item[i] = "random string";
12177 }
12178 return true;
12179 }