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 int num_var;
02806 num_var = this->getNumberOfInitVarValues();
02807
02808 if (m_mdInitVarValuesDense != NULL)
02809 delete [] m_mdInitVarValuesDense;
02810 m_mdInitVarValuesDense = new double[numberOfVariables];
02811 for (k = 0; k < numberOfVariables; k++) m_mdInitVarValuesDense[k] = OSNaN();
02812
02813 for (i = 0; i < num_var; i++)
02814 {
02815 j = this->optimization->variables->initialVariableValues->var[i]->idx;
02816 if (j >= 0 && j < numberOfVariables)
02817 m_mdInitVarValuesDense[j]
02818 = this->optimization->variables->initialVariableValues->var[i]->value;
02819 else
02820 throw ErrorClass("Variable index out of range");
02821 }
02822 return m_mdInitVarValuesDense;
02823 }
02824 }
02825 }
02826 }
02827 catch(const ErrorClass& eclass)
02828 {
02829 throw ErrorClass(eclass.errormsg);
02830 }
02831 return NULL;
02832 }
02833
02838 InitVarValueString** OSOption::getInitVarValuesStringSparse()
02839 {
02840 InitVarValueString** initVarVector;
02841 if (this->optimization != NULL)
02842 {
02843 if (this->optimization->variables != NULL)
02844 {
02845 if (this->optimization->variables->initialVariableValuesString != NULL)
02846 initVarVector = this->optimization->variables->initialVariableValuesString->var;
02847 else
02848 throw ErrorClass("<initialVariableValuesString> object must be defined before getting the data");
02849 }
02850 else
02851 throw ErrorClass("<variables> object must be defined before getting the data");
02852 }
02853 else
02854 throw ErrorClass("<optimization> object must be defined before getting the data");
02855 return initVarVector;
02856 }
02857
02863 std::string *OSOption::getInitVarValuesStringDense()
02864 {
02865 try
02866 {
02867 int numberOfVariables;
02868 numberOfVariables = this->getNumberOfVariables();
02869 if (numberOfVariables < 0)
02870 throw ErrorClass("\"numberOfVariables\" must be present to use dense methods");
02871
02872 if (this->optimization != NULL)
02873 {
02874 if (this->optimization->variables != NULL)
02875 {
02876 if (this->optimization->variables->initialVariableValuesString != NULL)
02877 {
02878 int i,j,k;
02879 int num_var;
02880 num_var = this->getNumberOfInitVarValuesString();
02881
02882 if (m_mdInitVarValuesStringDense != NULL)
02883 delete [] m_mdInitVarValuesStringDense;
02884 m_mdInitVarValuesStringDense = new std::string[numberOfVariables];
02885 for (k = 0; k < numberOfVariables; k++) m_mdInitVarValuesStringDense[k] = "";
02886
02887 for (i = 0; i < num_var; i++)
02888 {
02889 j = this->optimization->variables->initialVariableValuesString->var[i]->idx;
02890 if (j >= 0 && j < numberOfVariables)
02891 m_mdInitVarValuesStringDense[j]
02892 = this->optimization->variables->initialVariableValuesString->var[i]->value;
02893 else
02894 throw ErrorClass("Variable index out of range");
02895 }
02896 return m_mdInitVarValuesStringDense;
02897 }
02898 }
02899 }
02900 }
02901 catch(const ErrorClass& eclass)
02902 {
02903 throw ErrorClass(eclass.errormsg);
02904 }
02905 return NULL;
02906 }
02907
02957 int* OSOption::getVariableInitialBasisStatusDense(int numberOfVariables)
02958 {
02959 try
02960 {
02961 if (numberOfVariables < 0)
02962 throw ErrorClass("\"numberOfVariables\" must be set to use dense methods");
02963
02964 if (this->optimization == NULL)
02965 throw ErrorClass("<optimization> element was never set");
02966
02967 if (this->optimization->variables == NULL)
02968 throw ErrorClass("<optimization> <variables> element was never set");
02969
02970 if (this->optimization->variables->initialBasisStatus == NULL)
02971 throw ErrorClass("initial basis was never set");
02972
02973 int i,j,k;
02974
02975 if (m_mdInitBasisStatusDense != NULL)
02976 delete [] m_mdInitBasisStatusDense;
02977 m_mdInitBasisStatusDense = new int[numberOfVariables];
02978 for (k = 0; k < numberOfVariables; k++) m_mdInitBasisStatusDense[k] = ENUM_BASIS_STATUS_unknown;
02979
02980 int num_var;
02981
02982 if (this->optimization->variables->initialBasisStatus->basic != NULL)
02983 {
02984 num_var = this->optimization->variables->initialBasisStatus->basic->numberOfEl;
02985 for (i = 0; i < num_var; i++)
02986 {
02987 j = this->optimization->variables->initialBasisStatus->basic->el[i];
02988 if (j >= 0 && j < numberOfVariables)
02989 m_mdInitBasisStatusDense[j] = ENUM_BASIS_STATUS_basic;
02990 else
02991 throw ErrorClass("Variable index out of range");
02992 }
02993 }
02994
02995 if (this->optimization->variables->initialBasisStatus->atLower != NULL)
02996 {
02997 num_var = this->optimization->variables->initialBasisStatus->atLower->numberOfEl;
02998 for (i = 0; i < num_var; i++)
02999 {
03000 j = this->optimization->variables->initialBasisStatus->atLower->el[i];
03001 if (j >= 0 && j < numberOfVariables)
03002 m_mdInitBasisStatusDense[j] = ENUM_BASIS_STATUS_atLower;
03003 else
03004 throw ErrorClass("Variable index out of range");
03005 }
03006 }
03007
03008 if (this->optimization->variables->initialBasisStatus->atUpper != NULL)
03009 {
03010 num_var = this->optimization->variables->initialBasisStatus->atUpper->numberOfEl;
03011 for (i = 0; i < num_var; i++)
03012 {
03013 j = this->optimization->variables->initialBasisStatus->atUpper->el[i];
03014 if (j >= 0 && j < numberOfVariables)
03015 m_mdInitBasisStatusDense[j] = ENUM_BASIS_STATUS_atUpper;
03016 else
03017 throw ErrorClass("Variable index out of range");
03018 }
03019 }
03020
03021 if (this->optimization->variables->initialBasisStatus->isFree != NULL)
03022 {
03023 num_var = this->optimization->variables->initialBasisStatus->isFree->numberOfEl;
03024 for (i = 0; i < num_var; i++)
03025 {
03026 j = this->optimization->variables->initialBasisStatus->isFree->el[i];
03027 if (j >= 0 && j < numberOfVariables)
03028 m_mdInitBasisStatusDense[j] = ENUM_BASIS_STATUS_isFree;
03029 else
03030 throw ErrorClass("Variable index out of range");
03031 }
03032 }
03033
03034 if (this->optimization->variables->initialBasisStatus->superbasic != NULL)
03035 {
03036 num_var = this->optimization->variables->initialBasisStatus->superbasic->numberOfEl;
03037 for (i = 0; i < num_var; i++)
03038 {
03039 j = this->optimization->variables->initialBasisStatus->superbasic->el[i];
03040 if (j >= 0 && j < numberOfVariables)
03041 m_mdInitBasisStatusDense[j] = ENUM_BASIS_STATUS_superbasic;
03042 else
03043 throw ErrorClass("Variable index out of range");
03044 }
03045 }
03046
03047 return m_mdInitBasisStatusDense;
03048 }
03049
03050 catch(const ErrorClass& eclass)
03051 {
03052 throw ErrorClass(eclass.errormsg);
03053 }
03054 return NULL;
03055 }
03056
03057
03058 int OSOption::getNumberOfInitialBasisElements(int type, int status)
03059 {
03060 if (this->optimization == NULL)
03061 throw ErrorClass("<optimization> element was never set");
03062
03063 switch (type)
03064 {
03065 case ENUM_PROBLEM_COMPONENT_variables:
03066 {
03067 if (this->optimization->variables == NULL)
03068 throw ErrorClass("<optimization> <variables> element was never set");
03069
03070 if (this->optimization->variables->initialBasisStatus == NULL)
03071 throw ErrorClass("initial basis was never set");
03072
03073 return this->optimization->variables->initialBasisStatus->getNumberOfEl(status);
03074 }
03075 case ENUM_PROBLEM_COMPONENT_objectives:
03076 {
03077 if (this->optimization->objectives == NULL)
03078 throw ErrorClass("<optimization> <objectives> element was never set");
03079
03080 if (this->optimization->objectives->initialBasisStatus == NULL)
03081 throw ErrorClass("initial basis was never set");
03082
03083 return this->optimization->objectives->initialBasisStatus->getNumberOfEl(status);
03084 }
03085 case ENUM_PROBLEM_COMPONENT_constraints:
03086 {
03087 if (this->optimization->constraints == NULL)
03088 throw ErrorClass("<optimization> <constraints> element was never set");
03089
03090 if (this->optimization->constraints->initialBasisStatus == NULL)
03091 throw ErrorClass("initial basis was never set");
03092
03093 return this->optimization->constraints->initialBasisStatus->getNumberOfEl(status);
03094 }
03095 default:
03096 throw ErrorClass("target object not implemented in setPathPairs");
03097 }
03098 }
03099
03100 bool OSOption::getInitialBasisElements(int type, int status, int* elem)
03101 {
03102 if (this->optimization == NULL)
03103 throw ErrorClass("<optimization> element was never set");
03104
03105 switch (type)
03106 {
03107 case ENUM_PROBLEM_COMPONENT_variables:
03108 {
03109 if (this->optimization->variables == NULL)
03110 throw ErrorClass("<optimization> <variables> element was never set");
03111
03112 if (this->optimization->variables->initialBasisStatus == NULL)
03113 throw ErrorClass("initial basis was never set");
03114
03115 return this->optimization->variables->initialBasisStatus->getIntVector(status, elem);
03116 }
03117 case ENUM_PROBLEM_COMPONENT_objectives:
03118 {
03119 if (this->optimization->objectives == NULL)
03120 throw ErrorClass("<optimization> <objectives> element was never set");
03121
03122 if (this->optimization->objectives->initialBasisStatus == NULL)
03123 throw ErrorClass("initial basis was never set");
03124
03125 return this->optimization->objectives->initialBasisStatus->getIntVector(status, elem);
03126 }
03127 case ENUM_PROBLEM_COMPONENT_constraints:
03128 {
03129 if (this->optimization->constraints == NULL)
03130 throw ErrorClass("<optimization> <constraints> element was never set");
03131
03132 if (this->optimization->constraints->initialBasisStatus == NULL)
03133 throw ErrorClass("initial basis was never set");
03134
03135 return this->optimization->constraints->initialBasisStatus->getIntVector(status, elem);
03136 }
03137 default:
03138 throw ErrorClass("target object not implemented in setPathPairs");
03139 }
03140 }
03141
03142
03143
03144
03149 BranchingWeight** OSOption::getIntegerVariableBranchingWeightsSparse()
03150 {
03151 BranchingWeight** intVarVector;
03152 if (this->optimization != NULL)
03153 {
03154 if (this->optimization->variables != NULL)
03155 {
03156 if (this->optimization->variables->integerVariableBranchingWeights != NULL)
03157 intVarVector = this->optimization->variables->integerVariableBranchingWeights->var;
03158 else
03159 throw ErrorClass("<integerVariableBranchingWeights> object must be defined before getting the data");
03160 }
03161 else
03162 throw ErrorClass("<variables> object must be defined before getting the data");
03163 }
03164 else
03165 throw ErrorClass("<optimization> object must be defined before getting the data");
03166 return intVarVector;
03167 }
03168
03169
03175 double* OSOption::getIntegerVariableBranchingWeightsDense()
03176 {
03177 try
03178 {
03179 int numberOfVariables;
03180 numberOfVariables = this->getNumberOfVariables();
03181 if (numberOfVariables < 0)
03182 throw ErrorClass("\"numberOfVariables\" must be present to use dense methods");
03183
03184 if (this->optimization != NULL)
03185 {
03186 if (this->optimization->variables != NULL)
03187 {
03188 if (this->optimization->variables->integerVariableBranchingWeights != NULL)
03189 {
03190 int i,j,k;
03191 int num_var;
03192 num_var = this->getNumberOfIntegerVariableBranchingWeights();
03193
03194 if (m_mdIntegerVariableBranchingWeightsDense != NULL)
03195 delete [] m_mdIntegerVariableBranchingWeightsDense;
03196 m_mdIntegerVariableBranchingWeightsDense = new double[numberOfVariables];
03197 for (k = 0; k < numberOfVariables; k++) m_mdIntegerVariableBranchingWeightsDense[k] = OSNaN();
03198
03199 for (i = 0; i < num_var; i++)
03200 {
03201 j = this->optimization->variables->integerVariableBranchingWeights->var[i]->idx;
03202 if (j >= 0 && j < numberOfVariables)
03203 m_mdIntegerVariableBranchingWeightsDense[j]
03204 = this->optimization->variables->integerVariableBranchingWeights->var[i]->value;
03205 else
03206 throw ErrorClass("Variable index out of range");
03207 }
03208 return m_mdIntegerVariableBranchingWeightsDense;
03209 }
03210 }
03211 }
03212 }
03213 catch(const ErrorClass& eclass)
03214 {
03215 throw ErrorClass(eclass.errormsg);
03216 }
03217 return NULL;
03218 }
03219
03226 double* OSOption::getIntegerVariableBranchingWeightsDense(int numberOfVariables)
03227 {
03228 try
03229 {
03230 if (numberOfVariables < 0)
03231 throw ErrorClass("\"numberOfVariables\" must be present to use dense methods");
03232
03233 if (this->optimization != NULL)
03234 {
03235 if (this->optimization->variables != NULL)
03236 {
03237 if (this->optimization->variables->integerVariableBranchingWeights != NULL)
03238 {
03239 int i,j,k;
03240 int num_var;
03241 num_var = this->getNumberOfIntegerVariableBranchingWeights();
03242
03243 if (m_mdIntegerVariableBranchingWeightsDense != NULL)
03244 delete [] m_mdIntegerVariableBranchingWeightsDense;
03245 m_mdIntegerVariableBranchingWeightsDense = new double[numberOfVariables];
03246 for (k = 0; k < numberOfVariables; k++) m_mdIntegerVariableBranchingWeightsDense[k] = OSNaN();
03247
03248 for (i = 0; i < num_var; i++)
03249 {
03250 j = this->optimization->variables->integerVariableBranchingWeights->var[i]->idx;
03251 if (j >= 0 && j < numberOfVariables)
03252 m_mdIntegerVariableBranchingWeightsDense[j]
03253 = this->optimization->variables->integerVariableBranchingWeights->var[i]->value;
03254 else
03255 throw ErrorClass("Variable index out of range");
03256 }
03257 return m_mdIntegerVariableBranchingWeightsDense;
03258 }
03259 }
03260 }
03261 }
03262 catch(const ErrorClass& eclass)
03263 {
03264 throw ErrorClass(eclass.errormsg);
03265 }
03266 return NULL;
03267 }
03268
03273 SOSWeights** OSOption::getSOSVariableBranchingWeightsSparse()
03274 {
03275 SOSWeights** sosVarVector;
03276 if (this->optimization != NULL)
03277 {
03278 if (this->optimization->variables != NULL)
03279 {
03280 if (this->optimization->variables->sosVariableBranchingWeights != NULL)
03281 sosVarVector = this->optimization->variables->sosVariableBranchingWeights->sos;
03282 else
03283 throw ErrorClass("<sosVariableBranchingWeights> object must be defined before getting the data");
03284 }
03285 else
03286 throw ErrorClass("<variables> object must be defined before getting the data");
03287 }
03288 else
03289 throw ErrorClass("<optimization> object must be defined before getting the data");
03290 return sosVarVector;
03291 }
03292
03293
03299 std::vector<OtherVariableOption*> OSOption::getOtherVariableOptions( std::string solver_name)
03300 {
03301 std::vector<OtherVariableOption*> optionsVector;
03302 if (this->optimization != NULL)
03303 {
03304 if (this->optimization->variables != NULL)
03305 {
03306 int i;
03307 int num_options;
03308 num_options = this->getNumberOfOtherVariableOptions();
03309 for(i = 0; i < num_options; i++)
03310 if (solver_name == this->optimization->variables->other[ i]->solver)
03311 optionsVector.push_back( this->optimization->variables->other[ i]);
03312 }
03313 else
03314 throw ErrorClass("<variables> object must be defined before getting the data");
03315 }
03316 else
03317 throw ErrorClass("<optimization> object must be defined before getting the data");
03318 return optionsVector;
03319 }
03320
03321
03326 OtherVariableOption** OSOption::getAllOtherVariableOptions()
03327 {
03328 OtherVariableOption** optionsVector;
03329 if (this->optimization != NULL)
03330 {
03331 if (this->optimization->variables != NULL)
03332 optionsVector = this->optimization->variables->other;
03333 else
03334 throw ErrorClass("<variables> object must be defined before getting the data");
03335 }
03336 else
03337 throw ErrorClass("<optimization> object must be defined before getting the data");
03338 return optionsVector;
03339 }
03340
03345 InitObjValue** OSOption::getInitObjValuesSparse()
03346 {
03347 InitObjValue** initObjVector;
03348 if (this->optimization != NULL)
03349 {
03350 if (this->optimization->objectives != NULL)
03351 {
03352 if (this->optimization->objectives->initialObjectiveValues != NULL)
03353 initObjVector = this->optimization->objectives->initialObjectiveValues->obj;
03354 else
03355 throw ErrorClass("<initialObjectiveValues> object must be defined before getting the data");
03356 }
03357 else
03358 throw ErrorClass("<objectives> object must be defined before getting the data");
03359 }
03360 else
03361 throw ErrorClass("<optimization> object must be defined before getting the data");
03362 return initObjVector;
03363 }
03364
03370 double* OSOption::getInitObjValuesDense()
03371 {
03372 try
03373 {
03374 int numberOfObjectives;
03375 numberOfObjectives = this->getNumberOfObjectives();
03376 if (numberOfObjectives < 0)
03377 throw ErrorClass("\"numberOfObjectives\" must be present to use dense methods");
03378
03379 if (this->optimization != NULL)
03380 {
03381 if (this->optimization->objectives != NULL)
03382 {
03383 if (this->optimization->objectives->initialObjectiveValues != NULL)
03384 {
03385 int i,j,k;
03386 int num_obj;
03387 num_obj = this->getNumberOfInitObjValues();
03388
03389 if (m_mdInitObjValuesDense != NULL)
03390 delete [] m_mdInitObjValuesDense;
03391 m_mdInitObjValuesDense = new double[numberOfObjectives];
03392 for (k = 0; k < numberOfObjectives; k++) m_mdInitObjValuesDense[k] = OSNaN();
03393
03394 for (i = 0; i < num_obj; i++)
03395 {
03396 j = this->optimization->objectives->initialObjectiveValues->obj[i]->idx;
03397 if (j < 0 && -j <= numberOfObjectives)
03398 m_mdInitObjValuesDense[-1-j]
03399 = this->optimization->objectives->initialObjectiveValues->obj[i]->value;
03400 else
03401 {
03402 throw ErrorClass("Objective index out of range");
03403 }
03404 }
03405 return m_mdInitObjValuesDense;
03406 }
03407 }
03408 }
03409 }
03410 catch(const ErrorClass& eclass)
03411 {
03412 throw ErrorClass(eclass.errormsg);
03413 }
03414 return NULL;
03415 }
03416
03423 double* OSOption::getInitObjValuesDense(int numberOfObjectives)
03424 {
03425 try
03426 {
03427 if (numberOfObjectives < 0)
03428 throw ErrorClass("\"numberOfObjectives\" must be present to use dense methods");
03429
03430 if (this->optimization != NULL)
03431 {
03432 if (this->optimization->objectives != NULL)
03433 {
03434 if (this->optimization->objectives->initialObjectiveValues != NULL)
03435 {
03436 int i,j,k;
03437 int num_obj;
03438 num_obj = this->getNumberOfInitObjValues();
03439
03440 if (m_mdInitObjValuesDense != NULL)
03441 delete [] m_mdInitObjValuesDense;
03442 m_mdInitObjValuesDense = new double[numberOfObjectives];
03443 for (k = 0; k < numberOfObjectives; k++) m_mdInitObjValuesDense[k] = OSNaN();
03444
03445 for (i = 0; i < num_obj; i++)
03446 {
03447 j = this->optimization->objectives->initialObjectiveValues->obj[i]->idx;
03448 if (j < 0 && -j <= numberOfObjectives)
03449 m_mdInitObjValuesDense[-1-j]
03450 = this->optimization->objectives->initialObjectiveValues->obj[i]->value;
03451 else
03452 {
03453 throw ErrorClass("Objective index out of range");
03454 }
03455 }
03456 return m_mdInitObjValuesDense;
03457 }
03458 }
03459 }
03460 }
03461 catch(const ErrorClass& eclass)
03462 {
03463 throw ErrorClass(eclass.errormsg);
03464 }
03465 return NULL;
03466 }
03467
03472 InitObjBound** OSOption::getInitObjBoundsSparse()
03473 {
03474 InitObjBound** initObjBounds;
03475 if (this->optimization != NULL)
03476 {
03477 if (this->optimization->objectives != NULL)
03478 {
03479 if (this->optimization->objectives->initialObjectiveBounds != NULL)
03480 initObjBounds = this->optimization->objectives->initialObjectiveBounds->obj;
03481 else
03482 throw ErrorClass("<initialObjectiveBounds> object must be defined before getting the data");
03483 }
03484 else
03485 throw ErrorClass("<objectives> object must be defined before getting the data");
03486 }
03487 else
03488 throw ErrorClass("<optimization> object must be defined before getting the data");
03489 return initObjBounds;
03490 }
03491
03497 double* OSOption::getInitObjLowerBoundsDense()
03498 {
03499 try
03500 {
03501 int numberOfObjectives;
03502 numberOfObjectives = this->getNumberOfObjectives();
03503 if (numberOfObjectives < 0)
03504 throw ErrorClass("\"numberOfObjectives\" must be present to use dense methods");
03505
03506 if (this->optimization != NULL)
03507 {
03508 if (this->optimization->objectives != NULL)
03509 {
03510 if (this->optimization->objectives->initialObjectiveBounds != NULL)
03511 {
03512 int i,j,k;
03513 int num_obj;
03514 num_obj = this->getNumberOfInitObjBounds();
03515
03516 if (m_mdInitObjLowerBoundsDense != NULL)
03517 delete [] m_mdInitObjLowerBoundsDense;
03518 m_mdInitObjLowerBoundsDense = new double[numberOfObjectives];
03519 for (k = 0; k < numberOfObjectives; k++) m_mdInitObjLowerBoundsDense[k] = OSNaN();
03520
03521 for (i = 0; i < num_obj; i++)
03522 {
03523 j = this->optimization->objectives->initialObjectiveBounds->obj[i]->idx;
03524 if (j < 0 && -j <= numberOfObjectives)
03525 m_mdInitObjLowerBoundsDense[-1-j]
03526 = this->optimization->objectives->initialObjectiveBounds->obj[i]->lbValue;
03527 else
03528 {
03529 throw ErrorClass("Objective index out of range");
03530 }
03531 }
03532 return m_mdInitObjLowerBoundsDense;
03533 }
03534 }
03535 }
03536 }
03537 catch(const ErrorClass& eclass)
03538 {
03539 throw ErrorClass(eclass.errormsg);
03540 }
03541 return NULL;
03542 }
03543
03550 double* OSOption::getInitObjLowerBoundsDense(int numberOfObjectives)
03551 {
03552 try
03553 {
03554 if (numberOfObjectives < 0)
03555 throw ErrorClass("\"numberOfObjectives\" must be present to use dense methods");
03556
03557 if (this->optimization != NULL)
03558 {
03559 if (this->optimization->objectives != NULL)
03560 {
03561 if (this->optimization->objectives->initialObjectiveBounds != NULL)
03562 {
03563 int i,j,k;
03564 int num_obj;
03565 num_obj = this->getNumberOfInitObjBounds();
03566
03567 if (m_mdInitObjLowerBoundsDense != NULL)
03568 delete [] m_mdInitObjLowerBoundsDense;
03569 m_mdInitObjLowerBoundsDense = new double[numberOfObjectives];
03570 for (k = 0; k < numberOfObjectives; k++) m_mdInitObjLowerBoundsDense[k] = OSNaN();
03571
03572 for (i = 0; i < num_obj; i++)
03573 {
03574 j = this->optimization->objectives->initialObjectiveBounds->obj[i]->idx;
03575 if (j < 0 && -j <= numberOfObjectives)
03576 m_mdInitObjLowerBoundsDense[-1-j]
03577 = this->optimization->objectives->initialObjectiveBounds->obj[i]->lbValue;
03578 else
03579 {
03580 throw ErrorClass("Objective index out of range");
03581 }
03582 }
03583 return m_mdInitObjLowerBoundsDense;
03584 }
03585 }
03586 }
03587 }
03588 catch(const ErrorClass& eclass)
03589 {
03590 throw ErrorClass(eclass.errormsg);
03591 }
03592 return NULL;
03593 }
03594
03600 double* OSOption::getInitObjUpperBoundsDense()
03601 {
03602 try
03603 {
03604 int numberOfObjectives;
03605 numberOfObjectives = this->getNumberOfObjectives();
03606 if (numberOfObjectives < 0)
03607 throw ErrorClass("\"numberOfObjectives\" must be present to use dense methods");
03608
03609 if (this->optimization != NULL)
03610 {
03611 if (this->optimization->objectives != NULL)
03612 {
03613 if (this->optimization->objectives->initialObjectiveBounds != NULL)
03614 {
03615 int i,j,k;
03616 int num_obj;
03617 num_obj = this->getNumberOfInitObjBounds();
03618
03619 if (m_mdInitObjUpperBoundsDense != NULL)
03620 delete [] m_mdInitObjUpperBoundsDense;
03621 m_mdInitObjUpperBoundsDense = new double[numberOfObjectives];
03622 for (k = 0; k < numberOfObjectives; k++) m_mdInitObjUpperBoundsDense[k] = OSNaN();
03623
03624 for (i = 0; i < num_obj; i++)
03625 {
03626 j = this->optimization->objectives->initialObjectiveBounds->obj[i]->idx;
03627 if (j < 0 && -j <= numberOfObjectives)
03628 m_mdInitObjUpperBoundsDense[-1-j]
03629 = this->optimization->objectives->initialObjectiveBounds->obj[i]->ubValue;
03630 else
03631 {
03632 throw ErrorClass("Objective index out of range");
03633 }
03634 }
03635 return m_mdInitObjUpperBoundsDense;
03636 }
03637 }
03638 }
03639 }
03640 catch(const ErrorClass& eclass)
03641 {
03642 throw ErrorClass(eclass.errormsg);
03643 }
03644 return NULL;
03645 }
03646
03653 double* OSOption::getInitObjUpperBoundsDense(int numberOfObjectives)
03654 {
03655 try
03656 {
03657 if (numberOfObjectives < 0)
03658 throw ErrorClass("\"numberOfObjectives\" must be present to use dense methods");
03659
03660 if (this->optimization != NULL)
03661 {
03662 if (this->optimization->objectives != NULL)
03663 {
03664 if (this->optimization->objectives->initialObjectiveBounds != NULL)
03665 {
03666 int i,j,k;
03667 int num_obj;
03668 num_obj = this->getNumberOfInitObjBounds();
03669
03670 if (m_mdInitObjUpperBoundsDense != NULL)
03671 delete [] m_mdInitObjUpperBoundsDense;
03672 m_mdInitObjUpperBoundsDense = new double[numberOfObjectives];
03673 for (k = 0; k < numberOfObjectives; k++) m_mdInitObjUpperBoundsDense[k] = OSNaN();
03674
03675 for (i = 0; i < num_obj; i++)
03676 {
03677 j = this->optimization->objectives->initialObjectiveBounds->obj[i]->idx;
03678 if (j < 0 && -j <= numberOfObjectives)
03679 m_mdInitObjUpperBoundsDense[-1-j]
03680 = this->optimization->objectives->initialObjectiveBounds->obj[i]->ubValue;
03681 else
03682 {
03683 throw ErrorClass("Objective index out of range");
03684 }
03685 }
03686 return m_mdInitObjUpperBoundsDense;
03687 }
03688 }
03689 }
03690 }
03691 catch(const ErrorClass& eclass)
03692 {
03693 throw ErrorClass(eclass.errormsg);
03694 }
03695 return NULL;
03696 }
03697
03704 std::string *OSOption::getInitVarValuesStringDense(int numberOfVariables)
03705 {
03706 try
03707 {
03708 if (numberOfVariables < 0)
03709 throw ErrorClass("\"numberOfVariables\" must be present to use dense methods");
03710
03711 if (this->optimization != NULL)
03712 {
03713 if (this->optimization->variables != NULL)
03714 {
03715 if (this->optimization->variables->initialVariableValuesString != NULL)
03716 {
03717 int i,j,k;
03718 int num_var;
03719 num_var = this->getNumberOfInitVarValuesString();
03720
03721 if (m_mdInitVarValuesStringDense != NULL)
03722 delete [] m_mdInitVarValuesStringDense;
03723 m_mdInitVarValuesStringDense = new std::string[numberOfVariables];
03724 for (k = 0; k < numberOfVariables; k++) m_mdInitVarValuesStringDense[k] = "";
03725
03726 for (i = 0; i < num_var; i++)
03727 {
03728 j = this->optimization->variables->initialVariableValuesString->var[i]->idx;
03729 if (j >= 0 && j < numberOfVariables)
03730 m_mdInitVarValuesStringDense[j]
03731 = this->optimization->variables->initialVariableValuesString->var[i]->value;
03732 else
03733 throw ErrorClass("Variable index out of range");
03734 }
03735 return m_mdInitVarValuesStringDense;
03736 }
03737 }
03738 }
03739 }
03740 catch(const ErrorClass& eclass)
03741 {
03742 throw ErrorClass(eclass.errormsg);
03743 }
03744 return NULL;
03745 }
03746
03747
03755 int* OSOption::getObjectiveInitialBasisStatusDense(int numberOfObjectives)
03756 {
03757 try
03758 {
03759 if (numberOfObjectives < 0)
03760 throw ErrorClass("\"numberOfObjectives\" must be set to use dense methods");
03761
03762 if (this->optimization == NULL)
03763 throw ErrorClass("<optimization> element was never set");
03764
03765 if (this->optimization->objectives == NULL)
03766 throw ErrorClass("<optimization> <objectives> element was never set");
03767
03768 if (this->optimization->objectives->initialBasisStatus == NULL)
03769 throw ErrorClass("initial basis was never set");
03770
03771 int i,j,k;
03772
03773 if (m_mdInitBasisStatusDense != NULL)
03774 delete [] m_mdInitBasisStatusDense;
03775 m_mdInitBasisStatusDense = new int[numberOfObjectives];
03776 for (k = 0; k < numberOfObjectives; k++) m_mdInitBasisStatusDense[k] = ENUM_BASIS_STATUS_unknown;
03777
03778 int num_obj;
03779
03780 if (this->optimization->objectives->initialBasisStatus->basic != NULL)
03781 {
03782 num_obj = this->optimization->objectives->initialBasisStatus->basic->numberOfEl;
03783 for (i = 0; i < num_obj; i++)
03784 {
03785 j = this->optimization->objectives->initialBasisStatus->basic->el[i];
03786 if (j >= 0 || j < -numberOfObjectives)
03787 throw ErrorClass("Objective index out of range");
03788 else
03789 m_mdInitBasisStatusDense[j] = ENUM_BASIS_STATUS_basic;
03790 }
03791 }
03792
03793 if (this->optimization->objectives->initialBasisStatus->atLower != NULL)
03794 {
03795 num_obj = this->optimization->objectives->initialBasisStatus->atLower->numberOfEl;
03796 for (i = 0; i < num_obj; i++)
03797 {
03798 j = this->optimization->objectives->initialBasisStatus->atLower->el[i];
03799 if (j >= 0 || j < -numberOfObjectives)
03800 throw ErrorClass("Objective index out of range");
03801 else
03802 m_mdInitBasisStatusDense[j] = ENUM_BASIS_STATUS_atLower;
03803 }
03804 }
03805
03806 if (this->optimization->objectives->initialBasisStatus->atUpper != NULL)
03807 {
03808 num_obj = this->optimization->objectives->initialBasisStatus->atUpper->numberOfEl;
03809 for (i = 0; i < num_obj; i++)
03810 {
03811 j = this->optimization->objectives->initialBasisStatus->atUpper->el[i];
03812 if (j >= 0 || j < -numberOfObjectives)
03813 throw ErrorClass("Objective index out of range");
03814 else
03815 m_mdInitBasisStatusDense[j] = ENUM_BASIS_STATUS_atUpper;
03816 }
03817 }
03818
03819 if (this->optimization->objectives->initialBasisStatus->isFree != NULL)
03820 {
03821 num_obj = this->optimization->objectives->initialBasisStatus->isFree->numberOfEl;
03822 for (i = 0; i < num_obj; i++)
03823 {
03824 j = this->optimization->objectives->initialBasisStatus->isFree->el[i];
03825 if (j >= 0 || j < -numberOfObjectives)
03826 throw ErrorClass("Objective index out of range");
03827 else
03828 m_mdInitBasisStatusDense[j] = ENUM_BASIS_STATUS_isFree;
03829 }
03830 }
03831
03832 if (this->optimization->objectives->initialBasisStatus->superbasic != NULL)
03833 {
03834 num_obj = this->optimization->objectives->initialBasisStatus->superbasic->numberOfEl;
03835 for (i = 0; i < num_obj; i++)
03836 {
03837 j = this->optimization->objectives->initialBasisStatus->superbasic->el[i];
03838 if (j >= 0 || j < -numberOfObjectives)
03839 throw ErrorClass("Objective index out of range");
03840 else
03841 m_mdInitBasisStatusDense[j] = ENUM_BASIS_STATUS_superbasic;
03842 }
03843 }
03844
03845 return m_mdInitBasisStatusDense;
03846 }
03847
03848 catch(const ErrorClass& eclass)
03849 {
03850 throw ErrorClass(eclass.errormsg);
03851 }
03852 return NULL;
03853 }
03854
03855
03856
03857
03863 std::vector<OtherObjectiveOption*> OSOption::getOtherObjectiveOptions( std::string solver_name)
03864 {
03865 std::vector<OtherObjectiveOption*> optionsVector;
03866 if (this->optimization != NULL)
03867 {
03868 if (this->optimization->variables != NULL)
03869 {
03870 int i;
03871 int num_options;
03872 num_options = this->getNumberOfOtherObjectiveOptions();
03873 for(i = 0; i < num_options; i++)
03874 if (solver_name == this->optimization->objectives->other[ i]->solver)
03875 optionsVector.push_back( this->optimization->objectives->other[ i]);
03876 }
03877 else
03878 throw ErrorClass("<objectives> object must be defined before getting the data");
03879 }
03880 else
03881 throw ErrorClass("<optimization> object must be defined before getting the data");
03882 return optionsVector;
03883 }
03884
03889 OtherObjectiveOption** OSOption::getAllOtherObjectiveOptions()
03890 {
03891 OtherObjectiveOption** optionsVector;
03892 if (this->optimization != NULL)
03893 {
03894 if (this->optimization->objectives != NULL)
03895 optionsVector = this->optimization->objectives->other;
03896 else
03897 throw ErrorClass("<objectives> object must be defined before getting the data");
03898 }
03899 else
03900 throw ErrorClass("<optimization> object must be defined before getting the data");
03901 return optionsVector;
03902 }
03903
03904
03909 InitConValue** OSOption::getInitConValuesSparse()
03910 {
03911 InitConValue** initConVector;
03912 if (this->optimization != NULL)
03913 {
03914 if (this->optimization->constraints != NULL)
03915 {
03916 if (this->optimization->constraints->initialConstraintValues != NULL)
03917 initConVector = this->optimization->constraints->initialConstraintValues->con;
03918 else
03919 throw ErrorClass("<initialConstraintValues> object must be defined before getting the data");
03920 }
03921 else
03922 throw ErrorClass("<constraints> object must be defined before getting the data");
03923 }
03924 else
03925 throw ErrorClass("<optimization> object must be defined before getting the data");
03926 return initConVector;
03927 }
03928
03934 double* OSOption::getInitConValuesDense()
03935 {
03936 try
03937 {
03938 int numberOfConstraints;
03939 numberOfConstraints = this->getNumberOfConstraints();
03940 if (numberOfConstraints < 0)
03941 throw ErrorClass("\"numberOfConstraints\" must be present to use dense methods");
03942
03943 if (this->optimization != NULL)
03944 {
03945 if (this->optimization->constraints != NULL)
03946 {
03947 if (this->optimization->constraints->initialConstraintValues != NULL)
03948 {
03949 int i,j,k;
03950 int num_con;
03951 num_con = this->getNumberOfInitConValues();
03952
03953 if (m_mdInitConValuesDense != NULL)
03954 delete [] m_mdInitConValuesDense;
03955 m_mdInitConValuesDense = new double[numberOfConstraints];
03956 for (k = 0; k < numberOfConstraints; k++) m_mdInitConValuesDense[k] = OSNaN();
03957
03958 for (i = 0; i < num_con; i++)
03959 {
03960 j = this->optimization->constraints->initialConstraintValues->con[i]->idx;
03961 if (j >= 0 && j < numberOfConstraints)
03962 m_mdInitConValuesDense[j]
03963 = this->optimization->constraints->initialConstraintValues->con[i]->value;
03964 else
03965 throw ErrorClass("Constraint index out of range");
03966 }
03967 return m_mdInitConValuesDense;
03968 }
03969 }
03970 }
03971 }
03972 catch(const ErrorClass& eclass)
03973 {
03974 throw ErrorClass(eclass.errormsg);
03975 }
03976 return NULL;
03977 }
03978
03985 double* OSOption::getInitConValuesDense(int numberOfConstraints)
03986 {
03987 try
03988 {
03989 if (numberOfConstraints < 0)
03990 throw ErrorClass("\"numberOfConstraints\" must be present to use dense methods");
03991
03992 if (this->optimization != NULL)
03993 {
03994 if (this->optimization->constraints != NULL)
03995 {
03996 if (this->optimization->constraints->initialConstraintValues != NULL)
03997 {
03998 int i,j,k;
03999 int num_con;
04000 num_con = this->getNumberOfInitConValues();
04001
04002 if (m_mdInitConValuesDense != NULL)
04003 delete [] m_mdInitConValuesDense;
04004 m_mdInitConValuesDense = new double[numberOfConstraints];
04005 for (k = 0; k < numberOfConstraints; k++) m_mdInitConValuesDense[k] = OSNaN();
04006
04007 for (i = 0; i < num_con; i++)
04008 {
04009 j = this->optimization->constraints->initialConstraintValues->con[i]->idx;
04010 if (j >= 0 && j < numberOfConstraints)
04011 m_mdInitConValuesDense[j]
04012 = this->optimization->constraints->initialConstraintValues->con[i]->value;
04013 else
04014 throw ErrorClass("Constraint index out of range");
04015 }
04016 return m_mdInitConValuesDense;
04017 }
04018 }
04019 }
04020 }
04021 catch(const ErrorClass& eclass)
04022 {
04023 throw ErrorClass(eclass.errormsg);
04024 }
04025 return NULL;
04026 }
04027
04032 InitDualVarValue** OSOption::getInitDualVarValuesSparse()
04033 {
04034 InitDualVarValue** initDualVector;
04035 if (this->optimization != NULL)
04036 {
04037 if (this->optimization->constraints != NULL)
04038 {
04039 if (this->optimization->constraints->initialDualValues != NULL)
04040 initDualVector = this->optimization->constraints->initialDualValues->con;
04041 else
04042 throw ErrorClass("<initialDualValues> object must be defined before getting the data");
04043 }
04044 else
04045 throw ErrorClass("<constraints> object must be defined before getting the data");
04046 }
04047 else
04048 throw ErrorClass("<optimization> object must be defined before getting the data");
04049 return initDualVector;
04050 }
04051
04057 double* OSOption::getInitDualVarLowerBoundsDense()
04058 {
04059 try
04060 {
04061 int numberOfConstraints;
04062 numberOfConstraints = this->getNumberOfConstraints();
04063 if (numberOfConstraints < 0)
04064 throw ErrorClass("\"numberOfConstraints\" must be present to use dense methods");
04065
04066 if (this->optimization != NULL)
04067 {
04068 if (this->optimization->constraints != NULL)
04069 {
04070 if (this->optimization->constraints->initialDualValues != NULL)
04071 {
04072 int i,j,k;
04073 int num_con;
04074 num_con = this->getNumberOfInitDualVarValues();
04075
04076 if (m_mdInitDualVarLowerBoundsDense != NULL)
04077 delete [] m_mdInitDualVarLowerBoundsDense;
04078 m_mdInitDualVarLowerBoundsDense = new double[numberOfConstraints];
04079 for (k = 0; k < numberOfConstraints; k++) m_mdInitDualVarLowerBoundsDense[k] = 0.0;
04080
04081 for (i = 0; i < num_con; i++)
04082 {
04083 j = this->optimization->constraints->initialDualValues->con[i]->idx;
04084 if (j >= 0 && j < numberOfConstraints)
04085 m_mdInitDualVarLowerBoundsDense[j]
04086 = this->optimization->constraints->initialDualValues->con[i]->lbDualValue;
04087 else
04088 throw ErrorClass("Constraint index out of range");
04089 }
04090 return m_mdInitDualVarLowerBoundsDense;
04091 }
04092 }
04093 }
04094 }
04095 catch(const ErrorClass& eclass)
04096 {
04097 throw ErrorClass(eclass.errormsg);
04098 }
04099 return NULL;
04100 }
04101
04108 double* OSOption::getInitDualVarLowerBoundsDense(int numberOfConstraints)
04109 {
04110 try
04111 {
04112 if (numberOfConstraints < 0)
04113 throw ErrorClass("\"numberOfConstraints\" must be present to use dense methods");
04114
04115 if (this->optimization != NULL)
04116 {
04117 if (this->optimization->constraints != NULL)
04118 {
04119 if (this->optimization->constraints->initialDualValues != NULL)
04120 {
04121 int i,j,k;
04122 int num_con;
04123 num_con = this->getNumberOfInitDualVarValues();
04124
04125 if (m_mdInitDualVarLowerBoundsDense != NULL)
04126 delete [] m_mdInitDualVarLowerBoundsDense;
04127 m_mdInitDualVarLowerBoundsDense = new double[numberOfConstraints];
04128 for (k = 0; k < numberOfConstraints; k++) m_mdInitDualVarLowerBoundsDense[k] = 0.0;
04129
04130 for (i = 0; i < num_con; i++)
04131 {
04132 j = this->optimization->constraints->initialDualValues->con[i]->idx;
04133 if (j >= 0 && j < numberOfConstraints)
04134 m_mdInitDualVarLowerBoundsDense[j]
04135 = this->optimization->constraints->initialDualValues->con[i]->lbDualValue;
04136 else
04137 throw ErrorClass("Constraint index out of range");
04138 }
04139 return m_mdInitDualVarLowerBoundsDense;
04140 }
04141 }
04142 }
04143 }
04144 catch(const ErrorClass& eclass)
04145 {
04146 throw ErrorClass(eclass.errormsg);
04147 }
04148 return NULL;
04149 }
04150
04156 double* OSOption::getInitDualVarUpperBoundsDense()
04157 {
04158 try
04159 {
04160 int numberOfConstraints;
04161 numberOfConstraints = this->getNumberOfConstraints();
04162 if (numberOfConstraints < 0)
04163 throw ErrorClass("\"numberOfConstraints\" must be present to use dense methods");
04164
04165 if (this->optimization != NULL)
04166 {
04167 if (this->optimization->constraints != NULL)
04168 {
04169 if (this->optimization->constraints->initialDualValues != NULL)
04170 {
04171 int i,j,k;
04172 int num_con;
04173 num_con = this->getNumberOfInitDualVarValues();
04174 numberOfConstraints = this->getNumberOfConstraints();
04175
04176 if (m_mdInitDualVarUpperBoundsDense != NULL)
04177 delete [] m_mdInitDualVarUpperBoundsDense;
04178 m_mdInitDualVarUpperBoundsDense = new double[numberOfConstraints];
04179 for (k = 0; k < numberOfConstraints; k++) m_mdInitDualVarUpperBoundsDense[k] = 0.0;
04180
04181 for (i = 0; i < num_con; i++)
04182 {
04183 j = this->optimization->constraints->initialDualValues->con[i]->idx;
04184 if (j >= 0 && j < numberOfConstraints)
04185 m_mdInitDualVarUpperBoundsDense[j]
04186 = this->optimization->constraints->initialDualValues->con[i]->ubDualValue;
04187 else
04188 throw ErrorClass("Constraint index out of range");
04189 }
04190 return m_mdInitDualVarUpperBoundsDense;
04191 }
04192 }
04193 }
04194 }
04195 catch(const ErrorClass& eclass)
04196 {
04197 throw ErrorClass(eclass.errormsg);
04198 }
04199 return NULL;
04200 }
04201
04208 double* OSOption::getInitDualVarUpperBoundsDense(int numberOfConstraints)
04209 {
04210 try
04211 {
04212 if (numberOfConstraints < 0)
04213 throw ErrorClass("\"numberOfConstraints\" must be present to use dense methods");
04214
04215 if (this->optimization != NULL)
04216 {
04217 if (this->optimization->constraints != NULL)
04218 {
04219 if (this->optimization->constraints->initialDualValues != NULL)
04220 {
04221 int i,j,k;
04222 int num_con;
04223 num_con = this->getNumberOfInitDualVarValues();
04224 numberOfConstraints = this->getNumberOfConstraints();
04225
04226 if (m_mdInitDualVarUpperBoundsDense != NULL)
04227 delete [] m_mdInitDualVarUpperBoundsDense;
04228 m_mdInitDualVarUpperBoundsDense = new double[numberOfConstraints];
04229 for (k = 0; k < numberOfConstraints; k++) m_mdInitDualVarUpperBoundsDense[k] = 0.0;
04230
04231 for (i = 0; i < num_con; i++)
04232 {
04233 j = this->optimization->constraints->initialDualValues->con[i]->idx;
04234 if (j >= 0 && j < numberOfConstraints)
04235 m_mdInitDualVarUpperBoundsDense[j]
04236 = this->optimization->constraints->initialDualValues->con[i]->ubDualValue;
04237 else
04238 throw ErrorClass("Constraint index out of range");
04239 }
04240 return m_mdInitDualVarUpperBoundsDense;
04241 }
04242 }
04243 }
04244 }
04245 catch(const ErrorClass& eclass)
04246 {
04247 throw ErrorClass(eclass.errormsg);
04248 }
04249 return NULL;
04250 }
04251
04252
04259 int* OSOption::getSlackVariableInitialBasisStatusDense(int numberOfConstraints)
04260 {
04261 try
04262 {
04263 if (numberOfConstraints < 0)
04264 throw ErrorClass("\"numberOfConstraints\" must be set to use dense methods");
04265
04266 if (this->optimization == NULL)
04267 throw ErrorClass("<optimization> element was never set");
04268
04269 if (this->optimization->constraints == NULL)
04270 throw ErrorClass("<optimization> <constraints> element was never set");
04271
04272 if (this->optimization->constraints->initialBasisStatus == NULL)
04273 throw ErrorClass("initial basis was never set");
04274
04275 int i,j,k;
04276
04277 if (m_mdInitBasisStatusDense != NULL)
04278 delete [] m_mdInitBasisStatusDense;
04279 m_mdInitBasisStatusDense = new int[numberOfConstraints];
04280 for (k = 0; k < numberOfConstraints; k++) m_mdInitBasisStatusDense[k] = ENUM_BASIS_STATUS_unknown;
04281
04282 int num_slack;
04283
04284 if (this->optimization->constraints->initialBasisStatus->basic != NULL)
04285 {
04286 num_slack = this->optimization->constraints->initialBasisStatus->basic->numberOfEl;
04287 for (i = 0; i < num_slack; i++)
04288 {
04289 j = this->optimization->constraints->initialBasisStatus->basic->el[i];
04290 if (j >= 0 && j < numberOfConstraints)
04291 m_mdInitBasisStatusDense[j] = ENUM_BASIS_STATUS_basic;
04292 else
04293 throw ErrorClass("Constraint index out of range");
04294 }
04295 }
04296
04297 if (this->optimization->constraints->initialBasisStatus->atLower != NULL)
04298 {
04299 num_slack = this->optimization->constraints->initialBasisStatus->atLower->numberOfEl;
04300 for (i = 0; i < num_slack; i++)
04301 {
04302 j = this->optimization->constraints->initialBasisStatus->atLower->el[i];
04303 if (j >= 0 && j < numberOfConstraints)
04304 m_mdInitBasisStatusDense[j] = ENUM_BASIS_STATUS_atLower;
04305 else
04306 throw ErrorClass("Constraint index out of range");
04307 }
04308 }
04309
04310 if (this->optimization->constraints->initialBasisStatus->atUpper != NULL)
04311 {
04312 num_slack = this->optimization->constraints->initialBasisStatus->atUpper->numberOfEl;
04313 for (i = 0; i < num_slack; i++)
04314 {
04315 j = this->optimization->constraints->initialBasisStatus->atUpper->el[i];
04316 if (j >= 0 && j < numberOfConstraints)
04317 m_mdInitBasisStatusDense[j] = ENUM_BASIS_STATUS_atUpper;
04318 else
04319 throw ErrorClass("Constraint index out of range");
04320 }
04321 }
04322
04323 if (this->optimization->constraints->initialBasisStatus->isFree != NULL)
04324 {
04325 num_slack = this->optimization->constraints->initialBasisStatus->isFree->numberOfEl;
04326 for (i = 0; i < num_slack; i++)
04327 {
04328 j = this->optimization->constraints->initialBasisStatus->isFree->el[i];
04329 if (j >= 0 && j < numberOfConstraints)
04330 m_mdInitBasisStatusDense[j] = ENUM_BASIS_STATUS_isFree;
04331 else
04332 throw ErrorClass("Constraint index out of range");
04333 }
04334 }
04335
04336 if (this->optimization->constraints->initialBasisStatus->superbasic != NULL)
04337 {
04338 num_slack = this->optimization->constraints->initialBasisStatus->superbasic->numberOfEl;
04339 for (i = 0; i < num_slack; i++)
04340 {
04341 j = this->optimization->constraints->initialBasisStatus->superbasic->el[i];
04342 if (j >= 0 && j < numberOfConstraints)
04343 m_mdInitBasisStatusDense[j] = ENUM_BASIS_STATUS_superbasic;
04344 else
04345 throw ErrorClass("Constraint index out of range");
04346 }
04347 }
04348
04349 return m_mdInitBasisStatusDense;
04350 }
04351
04352 catch(const ErrorClass& eclass)
04353 {
04354 throw ErrorClass(eclass.errormsg);
04355 }
04356 return NULL;
04357 }
04358
04359
04365 std::vector<OtherConstraintOption*> OSOption::getOtherConstraintOptions( std::string solver_name)
04366 {
04367 std::vector<OtherConstraintOption*> optionsVector;
04368 if (this->optimization != NULL)
04369 {
04370 if (this->optimization->constraints != NULL)
04371 {
04372 int i;
04373 int num_options;
04374 num_options = this->getNumberOfOtherConstraintOptions();
04375 for(i = 0; i < num_options; i++)
04376 if (solver_name == this->optimization->constraints->other[ i]->solver)
04377 optionsVector.push_back( this->optimization->constraints->other[ i]);
04378 }
04379 else
04380 throw ErrorClass("<constraints> object must be defined before getting the data");
04381 }
04382 else
04383 throw ErrorClass("<optimization> object must be defined before getting the data");
04384 return optionsVector;
04385 }
04386
04391 OtherConstraintOption** OSOption::getAllOtherConstraintOptions()
04392 {
04393 OtherConstraintOption** optionsVector;
04394 if (this->optimization != NULL)
04395 {
04396 if (this->optimization->constraints != NULL)
04397 optionsVector = this->optimization->constraints->other;
04398 else
04399 throw ErrorClass("<constraints> object must be defined before getting the data");
04400 }
04401 else
04402 throw ErrorClass("<optimization> object must be defined before getting the data");
04403 return optionsVector;
04404 }
04405
04406
04412 std::vector<SolverOption*> OSOption::getSolverOptions( std::string solver_name)
04413 {
04414 std::vector<SolverOption*> optionsVector;
04415 if (this->optimization != NULL)
04416 {
04417 if (this->optimization->solverOptions != NULL)
04418 {
04419 int i;
04420 int num_options;
04421 num_options = this->getNumberOfSolverOptions();
04422 for(i = 0; i < num_options; i++)
04423 if (solver_name == this->optimization->solverOptions->solverOption[ i]->solver)
04424 optionsVector.push_back( this->optimization->solverOptions->solverOption[ i]);
04425 }
04426 else
04427 throw ErrorClass("<solverOptions> object must be defined before getting the data");
04428 }
04429 else
04430 throw ErrorClass("<optimization> object must be defined before getting the data");
04431 return optionsVector;
04432 }
04433
04434
04443 std::vector<SolverOption*> OSOption::getSolverOptions( std::string solver_name, bool getFreeOptions)
04444 {
04445 std::vector<SolverOption*> optionsVector;
04446 if (this->optimization != NULL)
04447 {
04448 if (this->optimization->solverOptions != NULL)
04449 {
04450 int i;
04451 int num_options;
04452 num_options = this->getNumberOfSolverOptions();
04453 for (i = 0; i < num_options; i++)
04454 {
04455 if (this->optimization->solverOptions->solverOption[i]->solver == solver_name ||
04456 (this->optimization->solverOptions->solverOption[i]->solver == "" && getFreeOptions))
04457 optionsVector.push_back( this->optimization->solverOptions->solverOption[i]);
04458 }
04459 }
04460 else
04461 throw ErrorClass("<solverOptions> object must be defined before getting the data");
04462 }
04463 else
04464 throw ErrorClass("<optimization> object must be defined before getting the data");
04465 return optionsVector;
04466 }
04471 SolverOption** OSOption::getAllSolverOptions()
04472 {
04473 SolverOption** optionsVector;
04474 if (this->optimization != NULL)
04475 {
04476 if (this->optimization->solverOptions != NULL)
04477 optionsVector = this->optimization->solverOptions->solverOption;
04478 else
04479 throw ErrorClass("<solverOptions> object must be defined before getting the data");
04480 }
04481 else
04482 throw ErrorClass("<optimization> object must be defined before getting the data");
04483 return optionsVector;
04484 }
04485
04486
04487
04494
04495
04496
04497
04498
04499
04503 bool OtherOptions::setOther(int numberOfOptions, OtherOption** other)
04504 {
04505 try
04506 {
04507 if (this->other != NULL)
04508 throw ErrorClass( "otherOptions array previously used.");
04509
04510 if (numberOfOptions < 0)
04511 throw ErrorClass( "length of otherOptions array cannot be negative.");
04512
04513 this->numberOfOtherOptions = numberOfOptions;
04514 if (numberOfOptions == 0)
04515 return true;
04516
04517 this->other = new OtherOption*[numberOfOptions];
04518
04519 int i;
04520 for (i = 0; i < numberOfOptions; i++)
04521 {
04522 this->other[i] = new OtherOption();
04523 *this->other[i] = *other[i];
04524 }
04525 return true;
04526 }
04527 catch(const ErrorClass& eclass)
04528 {
04529 cout << eclass.errormsg << endl;
04530 return false;
04531 }
04532 }
04533
04537 bool OtherOptions::addOther(std::string name, std::string value, std::string description)
04538 {
04539 try
04540 {
04541 int nopt;
04542 int i;
04543 if (name.empty() )
04544 throw ErrorClass( "the name of an option cannot be empty." );
04545
04546 if (this->other == NULL)
04547 nopt = 0;
04548 else
04549 nopt = this->numberOfOtherOptions;
04550
04551 OtherOption** temp = new OtherOption*[nopt+1];
04552 for (i = 0; i < nopt; i++)
04553 temp[i] = this->other[i];
04554
04555 delete[] this->other;
04556
04557
04558 temp[ nopt] = new OtherOption();
04559
04560 temp[ nopt]->name = name;
04561 temp[ nopt]->value = value;
04562 temp[ nopt]->description = description;
04563
04564 this->other = temp;
04565 this->numberOfOtherOptions = ++nopt;
04566
04567 return true;
04568 }
04569 catch(const ErrorClass& eclass)
04570 {
04571 cout << eclass.errormsg << endl;
04572 return false;
04573 }
04574 }
04575
04581 bool JobDependencies::setJobID(int numberOfJobIDs, std::string *jobID)
04582 {
04583 try
04584 {
04585 if (this->jobID != NULL)
04586 throw ErrorClass( "jobID array previously used.");
04587
04588 if (numberOfJobIDs < 0)
04589 throw ErrorClass( "length of jobID array cannot be negative.");
04590
04591 this->numberOfJobIDs = numberOfJobIDs;
04592 if (numberOfJobIDs == 0)
04593 return true;
04594
04595 this->jobID = new std::string[numberOfJobIDs];
04596 int i;
04597 for (i = 0; i < numberOfJobIDs; i++)
04598 this->jobID[i] = jobID[i];
04599
04600 return true;
04601 }
04602 catch(const ErrorClass& eclass)
04603 {
04604 cout << eclass.errormsg << endl;
04605 return false;
04606 }
04607 }
04608
04614 bool JobDependencies::addJobID(std::string jobID)
04615 {
04616 try
04617 {
04618 int nopt;
04619 if (jobID.empty() )
04620 throw ErrorClass( "the name of a jobID cannot be empty." );
04621
04622 if (this->jobID == NULL)
04623 nopt = 0;
04624 else
04625 nopt = this->numberOfJobIDs;
04626
04627 std::string* temp = new std::string[nopt+1];
04628 int i;
04629 for (i = 0; i < nopt; i++)
04630 temp[i] = this->jobID[i];
04631
04632 delete[] this->jobID;
04633
04634 temp[nopt] = jobID;
04635
04636 this->jobID = temp;
04637 this->numberOfJobIDs = ++nopt;
04638 return true;
04639 }
04640 catch(const ErrorClass& eclass)
04641 {
04642 cout << eclass.errormsg << endl;
04643 return false;
04644 }
04645 }
04646
04653 bool DirectoriesAndFiles::setPath(int numberOfPaths, std::string *path)
04654 {
04655 try
04656 {
04657 if (this->path != NULL)
04658 throw ErrorClass( "path array previously used.");
04659
04660 if (numberOfPaths < 0)
04661 throw ErrorClass( "length of path array cannot be negative.");
04662
04663 this->numberOfPaths = numberOfPaths;
04664 if (numberOfPaths == 0)
04665 return true;
04666
04667 this->path = new std::string[numberOfPaths];
04668 int i;
04669 for (i = 0; i < numberOfPaths; i++)
04670 this->path[i] = path[i];
04671
04672 return true;
04673 }
04674 catch(const ErrorClass& eclass)
04675 {
04676 cout << eclass.errormsg << endl;
04677 return false;
04678 }
04679 }
04680
04686 bool DirectoriesAndFiles::addPath(std::string path)
04687 {
04688 try
04689 {
04690 int nopt;
04691 if (path.empty() )
04692 throw ErrorClass( "the path cannot be empty." );
04693
04694 if (this->path == NULL)
04695 nopt = 0;
04696 else
04697 nopt = this->numberOfPaths;
04698
04699 std::string* temp = new std::string[nopt+1];
04700 int i;
04701 for (i = 0; i < nopt; i++)
04702 temp[i] = this->path[i];
04703
04704 delete[] this->path;
04705
04706 temp[nopt] = path;
04707
04708 this->path = temp;
04709 this->numberOfPaths = ++nopt;
04710 return true;
04711 }
04712 catch(const ErrorClass& eclass)
04713 {
04714 cout << eclass.errormsg << endl;
04715 return false;
04716 }
04717 }
04718
04725 bool PathPairs::setPathPair(int numberOfPathPairs, PathPair **pathPair)
04726 {
04727 try
04728 {
04729 if (this->pathPair != NULL)
04730 throw ErrorClass( "pathPair array previously used.");
04731
04732 if (numberOfPathPairs < 0)
04733 throw ErrorClass( "length of pathPair array cannot be negative.");
04734
04735 this->numberOfPathPairs = numberOfPathPairs;
04736 if (numberOfPathPairs == 0)
04737 return true;
04738
04739 this->pathPair = new PathPair*[numberOfPathPairs];
04740
04741 int i;
04742 for (i = 0; i < numberOfPathPairs; i++)
04743 {
04744 this->pathPair[i] = new PathPair();
04745 *this->pathPair[i] = *pathPair[i];
04746 }
04747 return true;
04748 }
04749 catch(const ErrorClass& eclass)
04750 {
04751 cout << eclass.errormsg << endl;
04752 return false;
04753 }
04754 }
04755
04756
04757 bool PathPairs::setPathPair(std::string *from, std::string *to, bool *makeCopy, int numberOfPathPairs)
04758 {
04759
04760
04761
04762 this->numberOfPathPairs = numberOfPathPairs;
04763 if (numberOfPathPairs == 0)
04764 return true;
04765
04766 this->pathPair = new PathPair*[numberOfPathPairs];
04767
04768 int i;
04769 for (i = 0; i < numberOfPathPairs; i++)
04770 {
04771 this->pathPair[i] = new PathPair();
04772 this->pathPair[i]->from = from[i];
04773 this->pathPair[i]->to = to[i];
04774 this->pathPair[i]->makeCopy = makeCopy[i];
04775 }
04776 return true;
04777 }
04778
04786 bool PathPairs::addPathPair(std::string fromPath, std::string toPath, bool makeCopy)
04787 {
04788 try
04789 {
04790 int nopt;
04791 int i;
04792 if (fromPath.empty() )
04793 throw ErrorClass( "the \"from\" path cannot be empty." );
04794 if (toPath.empty() )
04795 throw ErrorClass( "the \"to\" path cannot be empty." );
04796
04797 if (this->pathPair == NULL)
04798 nopt = 0;
04799 else
04800 nopt = this->numberOfPathPairs;
04801
04802 PathPair** temp = new PathPair*[nopt+1];
04803 for (i = 0; i < nopt; i++)
04804 temp[i] = this->pathPair[i];
04805
04806 delete[] this->pathPair;
04807
04808
04809 temp[ nopt] = new PathPair();
04810
04811 temp[ nopt]->from = fromPath;
04812 temp[ nopt]->to = toPath;
04813 temp[ nopt]->makeCopy = makeCopy;
04814
04815 this->pathPair = temp;
04816 this->numberOfPathPairs = ++nopt;
04817
04818 return true;
04819 }
04820 catch(const ErrorClass& eclass)
04821 {
04822 cout << eclass.errormsg << endl;
04823 return false;
04824 }
04825 }
04826
04833 bool Processes::setProcess(int numberOfProcesses, std::string *process)
04834 {
04835 try
04836 {
04837 if (this->process != NULL)
04838 throw ErrorClass( "process array previously used.");
04839
04840 if (numberOfProcesses < 0)
04841 throw ErrorClass( "length of process array cannot be negative.");
04842
04843 this->numberOfProcesses= numberOfProcesses;
04844 if (numberOfProcesses == 0)
04845 return true;
04846
04847 this->process = new std::string[numberOfProcesses];
04848 int i;
04849 for (i = 0; i < numberOfProcesses; i++)
04850 this->process[i] = process[i];
04851
04852 return true;
04853 }
04854 catch(const ErrorClass& eclass)
04855 {
04856 cout << eclass.errormsg << endl;
04857 return false;
04858 }
04859 }
04860
04866 bool Processes::addProcess(std::string process)
04867 {
04868 try
04869 {
04870 int nopt;
04871 if (process.empty() )
04872 throw ErrorClass( "the name of a process cannot be empty." );
04873
04874 if (this->process == NULL)
04875 nopt = 0;
04876 else
04877 nopt = this->numberOfProcesses;
04878
04879 std::string* temp = new std::string[nopt+1];
04880 int i;
04881 for (i = 0; i < nopt; i++)
04882 temp[i] = this->process[i];
04883
04884 delete[] this->process;
04885
04886 temp[nopt] = process;
04887
04888 this->process = temp;
04889 this->numberOfProcesses = ++nopt;
04890 return true;
04891 }
04892 catch(const ErrorClass& eclass)
04893 {
04894 cout << eclass.errormsg << endl;
04895 return false;
04896 }
04897 }
04898
04905 bool InitVariableValues::setVar(int numberOfVar, InitVarValue **var)
04906 {
04907 try
04908 {
04909 if (this->var != NULL)
04910 throw ErrorClass( "InitVarValue array previously used.");
04911
04912 if (numberOfVar < 0)
04913 throw ErrorClass( "length of var array cannot be negative.");
04914
04915 this->numberOfVar = numberOfVar;
04916 if (numberOfVar == 0)
04917 return true;
04918
04919 this->var = new InitVarValue*[numberOfVar];
04920
04921 int i;
04922 for (i = 0; i < numberOfVar; i++)
04923 {
04924 this->var[i] = new InitVarValue();
04925 *this->var[i] = *var[i];
04926 }
04927 return true;
04928 }
04929 catch(const ErrorClass& eclass)
04930 {
04931 cout << eclass.errormsg << endl;
04932 return false;
04933 }
04934 }
04935
04944 bool InitVariableValues::setVar(int numberOfVar, int *idx, double *value, std::string *name)
04945 {
04946 if (this->var != NULL)
04947 return false;
04948
04949 if (numberOfVar < 0)
04950 return false;
04951
04952 this->numberOfVar = numberOfVar;
04953 if (numberOfVar == 0)
04954 return true;
04955
04956 this->var = new InitVarValue*[numberOfVar];
04957
04958 int i;
04959 for (i = 0; i < numberOfVar; i++)
04960 {
04961 this->var[i] = new InitVarValue();
04962 this->var[i]->idx = idx[i];
04963 this->var[i]->name = name[i];
04964 this->var[i]->value = value[i];
04965 }
04966 return true;
04967 }
04968
04969
04976 bool InitVariableValues::addVar(int idx, double value)
04977 {
04978 try
04979 {
04980 int nopt;
04981 int i;
04982 if (idx < 0)
04983 throw ErrorClass( "the index of a variable cannot be negative." );
04984
04985 if (this->var == NULL)
04986 nopt = 0;
04987 else
04988 nopt = this->numberOfVar;
04989
04990 InitVarValue** temp = new InitVarValue*[nopt+1];
04991 for (i = 0; i < nopt; i++)
04992 temp[i] = this->var[i];
04993
04994 delete[] this->var;
04995
04996
04997 temp[ nopt] = new InitVarValue();
04998
04999 temp[ nopt]->idx = idx;
05000 temp[ nopt]->value = value;
05001
05002 this->var = temp;
05003 this->numberOfVar = ++nopt;
05004
05005 return true;
05006 }
05007 catch(const ErrorClass& eclass)
05008 {
05009 cout << eclass.errormsg << endl;
05010 return false;
05011 }
05012 }
05013
05020 bool InitVariableValuesString::setVar(int numberOfVar, InitVarValueString **var)
05021 {
05022 try
05023 {
05024 if (this->var != NULL)
05025 throw ErrorClass( "InitVarValueString array previously used.");
05026
05027 if (numberOfVar < 0)
05028 throw ErrorClass( "length of var array cannot be negative.");
05029
05030 this->numberOfVar = numberOfVar;
05031 if (numberOfVar == 0)
05032 return true;
05033
05034 this->var = new InitVarValueString*[numberOfVar];
05035
05036 int i;
05037 for (i = 0; i < numberOfVar; i++)
05038 {
05039 this->var[i] = new InitVarValueString();
05040 *this->var[i] = *var[i];
05041 }
05042 return true;
05043 }
05044 catch(const ErrorClass& eclass)
05045 {
05046 cout << eclass.errormsg << endl;
05047 return false;
05048 }
05049 }
05050
05051
05060 bool InitVariableValuesString::setVar(int numberOfVar, int *idx, std::string *value, std::string *name)
05061 {
05062 if (this->var != NULL)
05063 return false;
05064
05065 if (numberOfVar < 0)
05066 return false;
05067
05068 this->numberOfVar = numberOfVar;
05069 if (numberOfVar == 0)
05070 return true;
05071
05072 this->var = new InitVarValueString*[numberOfVar];
05073
05074 int i;
05075 for (i = 0; i < numberOfVar; i++)
05076 {
05077 this->var[i] = new InitVarValueString();
05078 this->var[i]->idx = idx[i];
05079 this->var[i]->name = name[i];
05080 this->var[i]->value = value[i];
05081 }
05082 return true;
05083 }
05084
05091 bool InitVariableValuesString::addVar(int idx, std::string value)
05092 {
05093 try
05094 {
05095 int nopt;
05096 int i;
05097 if (idx < 0)
05098 throw ErrorClass( "the index of a variable cannot be negative." );
05099
05100 if (this->var == NULL)
05101 nopt = 0;
05102 else
05103 nopt = this->numberOfVar;
05104
05105 InitVarValueString** temp = new InitVarValueString*[nopt+1];
05106 for (i = 0; i < nopt; i++)
05107 temp[i] = this->var[i];
05108
05109 delete[] this->var;
05110
05111
05112 temp[ nopt] = new InitVarValueString();
05113
05114 temp[ nopt]->idx = idx;
05115 temp[ nopt]->value = value;
05116
05117 this->var = temp;
05118 this->numberOfVar = ++nopt;
05119
05120 return true;
05121 }
05122 catch(const ErrorClass& eclass)
05123 {
05124 cout << eclass.errormsg << endl;
05125 return false;
05126 }
05127 }
05128
05135 bool InitialBasisStatus::setVar(int numberOfVar, InitBasStatus **var)
05136 {
05137 try
05138 {
05139 if (this->var != NULL)
05140 throw ErrorClass( "InitBasStatus array previously used.");
05141
05142 if (numberOfVar < 0)
05143 throw ErrorClass( "length of var array cannot be negative.");
05144
05145 this->numberOfVar = numberOfVar;
05146 if (numberOfVar == 0)
05147 return true;
05148
05149 this->var = new InitBasStatus*[numberOfVar];
05150
05151 int i;
05152 for (i = 0; i < numberOfVar; i++)
05153 {
05154 this->var[i] = new InitBasStatus();
05155 *this->var[i] = *var[i];
05156 }
05157 return true;
05158 }
05159 catch(const ErrorClass& eclass)
05160 {
05161 cout << eclass.errormsg << endl;
05162 return false;
05163 }
05164 }
05165
05172 bool InitialBasisStatus::addVar(int idx, std::string value)
05173 {
05174 try
05175 {
05176 int nopt;
05177 int i;
05178 if (idx < 0)
05179 throw ErrorClass( "the index of a variable cannot be negative." );
05180 if (value != "atLower" && value != "basic" && value != "unknown" &&
05181 value != "atUpper" && value != "superbasic" )
05182 throw ErrorClass( "Illegal basis status " + value );
05183
05184 if (this->var == NULL)
05185 nopt = 0;
05186 else
05187 nopt = this->numberOfVar;
05188
05189 InitBasStatus** temp = new InitBasStatus*[nopt+1];
05190 for (i = 0; i < nopt; i++)
05191 temp[i] = this->var[i];
05192
05193 delete[] this->var;
05194
05195
05196 temp[ nopt] = new InitBasStatus();
05197
05198 temp[ nopt]->idx = idx;
05199 temp[ nopt]->value = value;
05200
05201 this->var = temp;
05202 this->numberOfVar = ++nopt;
05203
05204 return true;
05205 }
05206 catch(const ErrorClass& eclass)
05207 {
05208 cout << eclass.errormsg << endl;
05209 return false;
05210 }
05211 }
05212
05219 bool IntegerVariableBranchingWeights::setVar(int numberOfVar, BranchingWeight **var)
05220 {
05221 try
05222 {
05223 if (this->var != NULL)
05224 return false;
05225
05226 if (numberOfVar < 0)
05227 return false;
05228
05229 this->numberOfVar = numberOfVar;
05230 if (numberOfVar == 0)
05231 return true;
05232
05233 this->var = new BranchingWeight*[numberOfVar];
05234
05235 int i;
05236 for (i = 0; i < numberOfVar; i++)
05237 {
05238 this->var[i] = new BranchingWeight();
05239 *this->var[i] = *var[i];
05240 }
05241 return true;
05242 }
05243 catch(const ErrorClass& eclass)
05244 {
05245 cout << eclass.errormsg << endl;
05246 return false;
05247 }
05248 }
05249
05250
05259 bool IntegerVariableBranchingWeights::setVar(int numberOfVar, int *idx, double *value, std::string *name)
05260 {
05261 if (this->var != NULL)
05262 return false;
05263
05264 if (numberOfVar < 0)
05265 return false;
05266
05267 this->numberOfVar = numberOfVar;
05268 if (numberOfVar == 0)
05269 return true;
05270
05271 this->var = new BranchingWeight*[numberOfVar];
05272
05273 int i;
05274 for (i = 0; i < numberOfVar; i++)
05275 {
05276 this->var[i] = new BranchingWeight();
05277 this->var[i]->idx = idx[i];
05278 this->var[i]->name = name[i];
05279 this->var[i]->value = value[i];
05280 }
05281 return true;
05282 }
05283
05284
05285
05286
05293 bool IntegerVariableBranchingWeights::addVar(int idx, double value)
05294 {
05295 try
05296 {
05297 int nopt;
05298 int i;
05299 if (idx < 0)
05300 throw ErrorClass( "the index of a variable cannot be negative." );
05301
05302 if (this->var == NULL)
05303 nopt = 0;
05304 else
05305 nopt = this->numberOfVar;
05306
05307 BranchingWeight** temp = new BranchingWeight*[nopt+1];
05308 for (i = 0; i < nopt; i++)
05309 temp[i] = this->var[i];
05310
05311 delete[] this->var;
05312
05313
05314 temp[ nopt] = new BranchingWeight();
05315
05316 temp[ nopt]->idx = idx;
05317 temp[ nopt]->value = value;
05318
05319 this->var = temp;
05320 this->numberOfVar = ++nopt;
05321
05322 return true;
05323 }
05324 catch(const ErrorClass& eclass)
05325 {
05326 cout << eclass.errormsg << endl;
05327 return false;
05328 }
05329 }
05330
05337 bool SOSWeights::setVar(int numberOfVar, BranchingWeight **var)
05338 {
05339 try
05340 {
05341 if (this->var != NULL)
05342 throw ErrorClass( "BranchingWeight array previously used.");
05343
05344 if (numberOfVar < 0)
05345 throw ErrorClass( "length of var array cannot be negative.");
05346
05347 this->numberOfVar = numberOfVar;
05348 if (numberOfVar == 0)
05349 return true;
05350
05351 this->var = new BranchingWeight*[numberOfVar];
05352
05353 int i;
05354 for (i = 0; i < numberOfVar; i++)
05355 {
05356 this->var[i] = new BranchingWeight();
05357 *this->var[i] = *var[i];
05358 }
05359 return true;
05360 }
05361 catch(const ErrorClass& eclass)
05362 {
05363 cout << eclass.errormsg << endl;
05364 return false;
05365 }
05366 }
05367
05374 bool SOSWeights::addVar(int idx, double value)
05375 {
05376 try
05377 {
05378 int nopt;
05379 int i;
05380 if (idx < 0)
05381 throw ErrorClass( "the index of a variable cannot be negative." );
05382
05383 if (this->var == NULL)
05384 nopt = 0;
05385 else
05386 nopt = this->numberOfVar;
05387
05388 BranchingWeight** temp = new BranchingWeight*[nopt+1];
05389 for (i = 0; i < nopt; i++)
05390 temp[i] = this->var[i];
05391
05392 delete[] this->var;
05393
05394
05395 temp[ nopt] = new BranchingWeight();
05396
05397 temp[ nopt]->idx = idx;
05398 temp[ nopt]->value = value;
05399
05400 this->var = temp;
05401 this->numberOfVar = ++nopt;
05402
05403 return true;
05404 }
05405 catch(const ErrorClass& eclass)
05406 {
05407 cout << eclass.errormsg << endl;
05408 return false;
05409 }
05410 }
05411
05418 bool SOSVariableBranchingWeights::setSOS(int numberOfSOS, SOSWeights **sos)
05419 {
05420 try
05421 {
05422 if (this->sos != NULL)
05423 throw ErrorClass( "SOS array previously used.");
05424
05425 if (numberOfSOS < 0)
05426 throw ErrorClass( "length of sos array cannot be negative.");
05427
05428 this->numberOfSOS = numberOfSOS;
05429 if (numberOfSOS == 0) return true;
05430
05431 this->sos = new SOSWeights*[numberOfSOS];
05432
05433 int i, j;
05434 for (i = 0; i < numberOfSOS; i++)
05435 {
05436 this->sos[i] = new SOSWeights();
05437 this->sos[i]->sosIdx = sos[i]->sosIdx;
05438 this->sos[i]->groupWeight = sos[i]->groupWeight;
05439
05440 if (sos[i]->numberOfVar < 0)
05441 throw ErrorClass( "the number of variables in the SOS cannot be negative.");
05442
05443 this->sos[i]->numberOfVar = sos[i]->numberOfVar;
05444
05445 if (sos[i]->numberOfVar > 0)
05446 {
05447 this->sos[i]->var = new BranchingWeight*[sos[i]->numberOfVar];
05448 for (j = 0; j < sos[i]->numberOfVar; j++)
05449 {
05450 this->sos[i]->var[j] = new BranchingWeight();
05451 *this->sos[i]->var[j] = *sos[i]->var[j];
05452 }
05453 }
05454 }
05455 return true;
05456 }
05457 catch(const ErrorClass& eclass)
05458 {
05459 cout << eclass.errormsg << endl;
05460 return false;
05461 }
05462 }
05463
05469 bool SOSVariableBranchingWeights::addSOS(int sosIdx, int nvar, double weight, int* idx, double* value, std::string* name)
05470 {
05471 try
05472 {
05473 int nopt;
05474 int i;
05475 if (sosIdx < 0)
05476 throw ErrorClass( "the index of the SOS cannot be negative." );
05477 if (nvar < 0)
05478 throw ErrorClass( "the number of variables in the SOS cannot be negative." );
05479
05480 if (this->sos == NULL)
05481 nopt = 0;
05482 else
05483 nopt = this->numberOfSOS;
05484
05485 SOSWeights** temp = new SOSWeights*[nopt+1];
05486 for (i = 0; i < nopt; i++)
05487 temp[i] = this->sos[i];
05488
05489 delete[] this->sos;
05490
05491
05492 temp[ nopt] = new SOSWeights();
05493
05494 temp[ nopt]->sosIdx = sosIdx;
05495 temp[ nopt]->groupWeight = weight;
05496 temp[ nopt]->numberOfVar = nvar;
05497 temp[ nopt]->var = new BranchingWeight*[nvar];
05498 for (i = 0; i < nvar; i++)
05499 {
05500 temp[nopt]->var[i] = new BranchingWeight();
05501 temp[nopt]->var[i]->idx = idx[i];
05502 temp[nopt]->var[i]->name = name[i];
05503 temp[nopt]->var[i]->value = value[i];
05504 }
05505
05506 this->sos = temp;
05507 this->numberOfSOS = ++nopt;
05508
05509 return true;
05510 }
05511 catch(const ErrorClass& eclass)
05512 {
05513 cout << eclass.errormsg << endl;
05514 return false;
05515 }
05516 }
05517
05524 bool OtherVariableOption::setVar(int numberOfVar, OtherVarOption **var)
05525 {
05526 try
05527 {
05528 if (this->var != NULL)
05529 throw ErrorClass( "OtherVarOption array previously used.");
05530
05531 if (numberOfVar < 0)
05532 throw ErrorClass( "length of <var> array cannot be negative.");
05533
05534 this->numberOfVar = numberOfVar;
05535 if (numberOfVar == 0) return true;
05536
05537 this->var = new OtherVarOption*[numberOfVar];
05538
05539 int i;
05540 for (i = 0; i < numberOfVar; i++)
05541 {
05542 this->var[i] = new OtherVarOption();
05543 *this->var[i] = *var[i];
05544 }
05545 return true;
05546 }
05547 catch(const ErrorClass& eclass)
05548 {
05549 cout << eclass.errormsg << endl;
05550 return false;
05551 }
05552 }
05553
05562 bool OtherVariableOption::addVar(int idx, std::string value, std::string lbValue, std::string ubValue)
05563 {
05564 try
05565 {
05566 int nopt;
05567 int i;
05568 if (idx < 0)
05569 throw ErrorClass( "the index of a variable cannot be negative." );
05570
05571 if (this->var == NULL)
05572 nopt = 0;
05573 else
05574 nopt = this->numberOfVar;
05575
05576 OtherVarOption** temp = new OtherVarOption*[nopt+1];
05577 for (i = 0; i < nopt; i++)
05578 temp[i] = this->var[i];
05579
05580 delete[] this->var;
05581
05582
05583 temp[ nopt] = new OtherVarOption();
05584
05585 temp[ nopt]->idx = idx;
05586 temp[ nopt]->value = value;
05587 temp[ nopt]->lbValue = lbValue;
05588 temp[ nopt]->ubValue = ubValue;
05589
05590 this->var = temp;
05591 this->numberOfVar = ++nopt;
05592
05593 return true;
05594 }
05595 catch(const ErrorClass& eclass)
05596 {
05597 cout << eclass.errormsg << endl;
05598 return false;
05599 }
05600 }
05601
05608 bool VariableOption::setOther(int numberOfOptions, OtherVariableOption **other)
05609 {
05610 try
05611 {
05612 if (this->other != NULL)
05613 throw ErrorClass( "otherVariableOptions array previously used.");
05614
05615 if (numberOfOptions < 0)
05616 throw ErrorClass( "length of <other> array cannot be negative.");
05617
05618 this->numberOfOtherVariableOptions = numberOfOptions;
05619 if (numberOfOptions == 0) return true;
05620
05621 this->other = new OtherVariableOption*[numberOfOptions];
05622
05623 int i, j;
05624 for (i = 0; i < numberOfOptions; i++)
05625 {
05626 this->other[i] = new OtherVariableOption();
05627 this->other[i]->name = other[i]->name;
05628 this->other[i]->value = other[i]->value;
05629 this->other[i]->solver = other[i]->solver;
05630 this->other[i]->category = other[i]->category;
05631 this->other[i]->type = other[i]->type;
05632 this->other[i]->description = other[i]->description;
05633
05634 if (other[i]->numberOfVar < 0)
05635 throw ErrorClass( "the number of variables in otherVariableOption cannot be negative.");
05636
05637 this->other[i]->numberOfVar = other[i]->numberOfVar;
05638
05639 if (other[i]->numberOfVar > 0)
05640 {
05641 this->other[i]->var = new OtherVarOption*[other[i]->numberOfVar];
05642 for (j = 0; j < other[i]->numberOfVar; j++)
05643 {
05644 this->other[i]->var[j] = new OtherVarOption();
05645 *this->other[i]->var[j] = *other[i]->var[j];
05646 }
05647 }
05648 this->other[i]->numberOfEnumerations = other[i]->numberOfEnumerations;
05649
05650 if (this->other[i]->numberOfEnumerations > 0)
05651 {
05652 this->other[i]->enumeration = new OtherOptionEnumeration*[this->other[i]->numberOfEnumerations];
05653 for (j = 0; j < this->other[i]->numberOfEnumerations; j++)
05654 {
05655 this->other[i]->enumeration[j] = new OtherOptionEnumeration();
05656 this->other[i]->enumeration[j]->setOtherOptionEnumeration(
05657 other[i]->enumeration[j]->value,
05658 other[i]->enumeration[j]->description,
05659 other[i]->enumeration[j]->el,
05660 other[i]->enumeration[j]->numberOfEl);
05661 }
05662 }
05663 }
05664 return true;
05665 }
05666 catch(const ErrorClass& eclass)
05667 {
05668 cout << eclass.errormsg << endl;
05669 return false;
05670 }
05671 }
05672
05678 bool VariableOption::addOther(OtherVariableOption *other)
05679 {
05680 try
05681 {
05682 int nopt, i, j;
05683 if (this->other == NULL)
05684 nopt = 0;
05685 else
05686 nopt = this->numberOfOtherVariableOptions;
05687
05688 OtherVariableOption** temp = new OtherVariableOption*[nopt+1];
05689 for (i = 0; i < nopt; i++)
05690 temp[i] = this->other[i];
05691
05692 delete[] this->other;
05693
05694
05695 temp[ nopt] = new OtherVariableOption();
05696 temp[ nopt]->name = other->name;
05697 temp[ nopt]->value = other->value;
05698 temp[ nopt]->solver = other->solver;
05699 temp[ nopt]->category = other->category;
05700 temp[ nopt]->type = other->type;
05701 temp[ nopt]->description = other->description;
05702
05703 if (other->numberOfVar < 0)
05704 throw ErrorClass( "the number of variables in otherVariableOption cannot be negative.");
05705
05706 temp[ nopt]->numberOfVar = other->numberOfVar;
05707
05708 if (other->numberOfVar > 0)
05709 {
05710 temp[ nopt]->var = new OtherVarOption*[other->numberOfVar];
05711 for (j = 0; j < other->numberOfVar; j++)
05712 {
05713 temp[ nopt]->var[j] = new OtherVarOption();
05714 *temp[ nopt]->var[j] = *other->var[j];
05715 }
05716 }
05717
05718 temp[ nopt]->numberOfEnumerations = other->numberOfEnumerations;
05719
05720 if (other->numberOfEnumerations > 0)
05721 {
05722 temp[ nopt]->enumeration = new OtherOptionEnumeration*[other->numberOfEnumerations];
05723 for (j = 0; j < other->numberOfEnumerations; j++)
05724 {
05725 temp[ nopt]->enumeration[j] = new OtherOptionEnumeration();
05726 temp[ nopt]->enumeration[j]->setOtherOptionEnumeration(
05727 other->enumeration[j]->value,
05728 other->enumeration[j]->description,
05729 other->enumeration[j]->el,
05730 other->enumeration[j]->numberOfEl);
05731 }
05732 }
05733
05734
05735 this->other = temp;
05736 this->numberOfOtherVariableOptions = ++nopt;
05737
05738 return true;
05739 }
05740 catch(const ErrorClass& eclass)
05741 {
05742 cout << eclass.errormsg << endl;
05743 return false;
05744 }
05745 }
05746
05753 bool InitObjectiveValues::setObj(int numberOfObj, InitObjValue **obj)
05754 {
05755 try
05756 {
05757 if (this->obj != NULL)
05758 throw ErrorClass( "InitObjValue array previously used.");
05759
05760 if (numberOfObj < 0)
05761 throw ErrorClass( "length of obj array cannot be negative.");
05762
05763 this->numberOfObj = numberOfObj;
05764 if (numberOfObj == 0)
05765 return true;
05766
05767 this->obj = new InitObjValue*[numberOfObj];
05768
05769 int i;
05770 for (i = 0; i < numberOfObj; i++)
05771 {
05772 this->obj[i] = new InitObjValue();
05773 *this->obj[i] = *obj[i];
05774 }
05775 return true;
05776 }
05777 catch(const ErrorClass& eclass)
05778 {
05779 cout << eclass.errormsg << endl;
05780 return false;
05781 }
05782 }
05783
05784 bool InitObjectiveValues::setObj(int numberOfObj, int *idx, double *value, std::string *name)
05785 {
05786 if (this->obj != NULL) return false;
05787
05788 if (numberOfObj < 0) return false;
05789
05790 this->numberOfObj = numberOfObj;
05791 if (numberOfObj == 0) return true;
05792
05793 this->obj = new InitObjValue*[numberOfObj];
05794
05795 int i;
05796 for (i = 0; i < numberOfObj; i++)
05797 {
05798 this->obj[i] = new InitObjValue();
05799 this->obj[i]->idx = idx[i];
05800 this->obj[i]->name = name[i];
05801 this->obj[i]->value = value[i];
05802 }
05803 return true;
05804 }
05805
05806
05813 bool InitObjectiveValues::addObj(int idx, double value)
05814 {
05815 try
05816 {
05817 int nopt;
05818 int i;
05819 if (idx >= 0)
05820 throw ErrorClass( "the index of an objective must be negative." );
05821
05822 if (this->obj == NULL)
05823 nopt = 0;
05824 else
05825 nopt = this->numberOfObj;
05826
05827 InitObjValue** temp = new InitObjValue*[nopt+1];
05828 for (i = 0; i < nopt; i++)
05829 temp[i] = this->obj[i];
05830
05831 delete[] this->obj;
05832
05833
05834 temp[ nopt] = new InitObjValue();
05835
05836 temp[ nopt]->idx = idx;
05837 temp[ nopt]->value = value;
05838
05839 this->obj = temp;
05840 this->numberOfObj = ++nopt;
05841
05842 return true;
05843 }
05844 catch(const ErrorClass& eclass)
05845 {
05846 cout << eclass.errormsg << endl;
05847 return false;
05848 }
05849 }
05850
05857 bool InitObjectiveBounds::setObj(int numberOfObj, InitObjBound **obj)
05858 {
05859 try
05860 {
05861 if (this->obj != NULL)
05862 throw ErrorClass( "InitObjBound array previously used.");
05863
05864 if (numberOfObj < 0)
05865 throw ErrorClass( "length of obj array cannot be negative.");
05866
05867 this->numberOfObj = numberOfObj;
05868 if (numberOfObj == 0)
05869 return true;
05870
05871 this->obj = new InitObjBound*[numberOfObj];
05872
05873 int i;
05874 for (i = 0; i < numberOfObj; i++)
05875 {
05876 this->obj[i] = new InitObjBound();
05877 *this->obj[i] = *obj[i];
05878 }
05879 return true;
05880 }
05881 catch(const ErrorClass& eclass)
05882 {
05883 cout << eclass.errormsg << endl;
05884 return false;
05885 }
05886 }
05887
05888 bool InitObjectiveBounds::setObj(int numberOfObj, int *idx, double *lbValue, double *ubValue, std::string *name)
05889 {
05890 if (this->obj != NULL)
05891 return false;
05892
05893 if (numberOfObj < 0)
05894 return false;
05895
05896 this->numberOfObj = numberOfObj;
05897 if (numberOfObj == 0)
05898 return true;
05899
05900 this->obj = new InitObjBound*[numberOfObj];
05901
05902 int i;
05903 for (i = 0; i < numberOfObj; i++)
05904 {
05905 this->obj[i] = new InitObjBound();
05906 this->obj[i]->idx = idx[i];
05907 this->obj[i]->name = name[i];
05908 this->obj[i]->lbValue = lbValue[i];
05909 this->obj[i]->ubValue = ubValue[i];
05910 }
05911 return true;
05912 }
05913
05914
05922 bool InitObjectiveBounds::addObj(int idx, double lbValue, double ubValue)
05923 {
05924 try
05925 {
05926 int nopt;
05927 int i;
05928 if (idx >= 0)
05929 throw ErrorClass( "the index of an objective must be negative." );
05930
05931 if (this->obj == NULL)
05932 nopt = 0;
05933 else
05934 nopt = this->numberOfObj;
05935
05936 InitObjBound** temp = new InitObjBound*[nopt+1];
05937 for (i = 0; i < nopt; i++)
05938 temp[i] = this->obj[i];
05939
05940 delete[] this->obj;
05941
05942
05943 temp[ nopt] = new InitObjBound();
05944
05945 temp[ nopt]->idx = idx;
05946 temp[ nopt]->lbValue = lbValue;
05947 temp[ nopt]->ubValue = ubValue;
05948
05949 this->obj = temp;
05950 this->numberOfObj = ++nopt;
05951
05952 return true;
05953 }
05954 catch(const ErrorClass& eclass)
05955 {
05956 cout << eclass.errormsg << endl;
05957 return false;
05958 }
05959 }
05960
05967 bool OtherObjectiveOption::setObj(int numberOfObj, OtherObjOption **obj)
05968 {
05969 try
05970 {
05971 if (this->obj != NULL)
05972 throw ErrorClass( "OtherObjOption array previously used.");
05973
05974 if (numberOfObj < 0)
05975 throw ErrorClass( "length of <obj> array cannot be negative.");
05976
05977 this->numberOfObj= numberOfObj;
05978 if (numberOfObj == 0)
05979 return true;
05980
05981 this->obj = new OtherObjOption*[numberOfObj];
05982
05983 int i;
05984 for (i = 0; i < numberOfObj; i++)
05985 {
05986 this->obj[i] = new OtherObjOption();
05987 *this->obj[i] = *obj[i];
05988 }
05989 return true;
05990 }
05991 catch(const ErrorClass& eclass)
05992 {
05993 cout << eclass.errormsg << endl;
05994 return false;
05995 }
05996 }
05997
06006 bool OtherObjectiveOption::addObj(int idx, std::string value, std::string lbValue, std::string ubValue)
06007 {
06008 try
06009 {
06010 int nopt;
06011 int i;
06012 if (idx >= 0)
06013 throw ErrorClass( "the index of an objective must be negative." );
06014
06015 if (this->obj == NULL)
06016 nopt = 0;
06017 else
06018 nopt = this->numberOfObj;
06019
06020 OtherObjOption** temp = new OtherObjOption*[nopt+1];
06021 for (i = 0; i < nopt; i++)
06022 temp[i] = this->obj[i];
06023
06024 delete[] this->obj;
06025
06026
06027 temp[ nopt] = new OtherObjOption();
06028
06029 temp[ nopt]->idx = idx;
06030 temp[ nopt]->value = value;
06031 temp[ nopt]->lbValue = lbValue;
06032 temp[ nopt]->ubValue = ubValue;
06033
06034 this->obj = temp;
06035 this->numberOfObj = ++nopt;
06036
06037 return true;
06038 }
06039 catch(const ErrorClass& eclass)
06040 {
06041 cout << eclass.errormsg << endl;
06042 return false;
06043 }
06044 }
06045
06052 bool ObjectiveOption::setOther(int numberOfOptions, OtherObjectiveOption **other)
06053 {
06054 try
06055 {
06056 if (this->other != NULL)
06057 throw ErrorClass( "otherObjectiveOptions array previously used.");
06058
06059 if (numberOfOptions < 0)
06060 throw ErrorClass( "length of <other> array cannot be negative.");
06061
06062 this->numberOfOtherObjectiveOptions = numberOfOptions;
06063 if (numberOfOptions == 0) return true;
06064
06065 this->other = new OtherObjectiveOption*[numberOfOptions];
06066
06067 int i, j;
06068 for (i = 0; i < numberOfOptions; i++)
06069 {
06070 this->other[i] = new OtherObjectiveOption();
06071 this->other[i]->name = other[i]->name;
06072 this->other[i]->value = other[i]->value;
06073 this->other[i]->solver = other[i]->solver;
06074 this->other[i]->category = other[i]->category;
06075 this->other[i]->type = other[i]->type;
06076 this->other[i]->description = other[i]->description;
06077
06078 if (other[i]->numberOfObj < 0)
06079 throw ErrorClass( "the number of objectives in otherObjectiveOption cannot be negative.");
06080
06081 this->other[i]->numberOfObj = other[i]->numberOfObj;
06082
06083 if (other[i]->numberOfObj > 0)
06084 {
06085 this->other[i]->obj = new OtherObjOption*[other[i]->numberOfObj];
06086 for (j = 0; j < other[i]->numberOfObj; j++)
06087 {
06088 this->other[i]->obj[j] = new OtherObjOption();
06089 *this->other[i]->obj[j] = *other[i]->obj[j];
06090 }
06091 }
06092 this->other[i]->numberOfEnumerations = other[i]->numberOfEnumerations;
06093
06094 if (this->other[i]->numberOfEnumerations > 0)
06095 {
06096 this->other[i]->enumeration = new OtherOptionEnumeration*[this->other[i]->numberOfEnumerations];
06097 for (j = 0; j < this->other[i]->numberOfEnumerations; j++)
06098 {
06099 this->other[i]->enumeration[j] = new OtherOptionEnumeration();
06100 this->other[i]->enumeration[j]->setOtherOptionEnumeration(
06101 other[i]->enumeration[j]->value,
06102 other[i]->enumeration[j]->description,
06103 other[i]->enumeration[j]->el,
06104 other[i]->enumeration[j]->numberOfEl);
06105 }
06106 }
06107 }
06108 return true;
06109 }
06110 catch(const ErrorClass& eclass)
06111 {
06112 cout << eclass.errormsg << endl;
06113 return false;
06114 }
06115 }
06116
06122 bool ObjectiveOption::addOther(OtherObjectiveOption *other)
06123 {
06124 try
06125 {
06126 int nopt, i, j;
06127 if (this->other == NULL)
06128 nopt = 0;
06129 else
06130 nopt = this->numberOfOtherObjectiveOptions;
06131
06132 OtherObjectiveOption** temp = new OtherObjectiveOption*[nopt+1];
06133 for (i = 0; i < nopt; i++)
06134 temp[i] = this->other[i];
06135
06136 delete[] this->other;
06137
06138
06139 temp[ nopt] = new OtherObjectiveOption();
06140 temp[ nopt]->name = other->name;
06141 temp[ nopt]->value = other->value;
06142 temp[ nopt]->solver = other->solver;
06143 temp[ nopt]->category = other->category;
06144 temp[ nopt]->type = other->type;
06145 temp[ nopt]->description = other->description;
06146
06147 if (other->numberOfObj < 0)
06148 throw ErrorClass( "the number of objectives in otherObjectiveOption cannot be negative.");
06149
06150 temp[ nopt]->numberOfObj = other->numberOfObj;
06151
06152 if (other->numberOfObj > 0)
06153 {
06154 temp[ nopt]->obj = new OtherObjOption*[other->numberOfObj];
06155 for (j = 0; j < other->numberOfObj; j++)
06156 {
06157 temp[ nopt]->obj[j] = new OtherObjOption();
06158 *temp[ nopt]->obj[j] = *other->obj[j];
06159 }
06160 }
06161
06162 if (other->numberOfEnumerations < 0)
06163 throw ErrorClass( "the number of enumerations in otherObjectiveOption cannot be negative.");
06164
06165 temp[ nopt]->numberOfEnumerations = other->numberOfEnumerations;
06166
06167 if (other->numberOfEnumerations > 0)
06168 {
06169 temp[ nopt]->enumeration = new OtherOptionEnumeration*[other->numberOfEnumerations];
06170 for (j = 0; j < other->numberOfEnumerations; j++)
06171 {
06172 temp[ nopt]->enumeration[j] = new OtherOptionEnumeration();
06173 temp[ nopt]->enumeration[j]->setOtherOptionEnumeration(
06174 other->enumeration[j]->value,
06175 other->enumeration[j]->description,
06176 other->enumeration[j]->el,
06177 other->enumeration[j]->numberOfEl);
06178 }
06179 }
06180
06181
06182 this->other = temp;
06183 this->numberOfOtherObjectiveOptions = ++nopt;
06184
06185 return true;
06186 }
06187 catch(const ErrorClass& eclass)
06188 {
06189 cout << eclass.errormsg << endl;
06190 return false;
06191 }
06192 }
06193
06200 bool InitConstraintValues::setCon(int numberOfCon, InitConValue **con)
06201 {
06202 try
06203 {
06204 if (this->con != NULL)
06205 throw ErrorClass( "InitConValue array previously used.");
06206
06207 if (numberOfCon < 0)
06208 throw ErrorClass( "length of con array cannot be negative.");
06209
06210 this->numberOfCon = numberOfCon;
06211 if (numberOfCon == 0)
06212 return true;
06213
06214 this->con = new InitConValue*[numberOfCon];
06215
06216 int i;
06217 for (i = 0; i < numberOfCon; i++)
06218 {
06219 this->con[i] = new InitConValue();
06220 *this->con[i] = *con[i];
06221 }
06222 return true;
06223 }
06224 catch(const ErrorClass& eclass)
06225 {
06226 cout << eclass.errormsg << endl;
06227 return false;
06228 }
06229 }
06230
06231 bool InitConstraintValues::setCon(int numberOfCon, int *idx, double *value, std::string *name)
06232 {
06233 if (this->con != NULL)
06234 return false;
06235
06236 if (numberOfCon < 0)
06237 return false;
06238
06239 this->numberOfCon = numberOfCon;
06240 if (numberOfCon == 0)
06241 return true;
06242
06243 this->con = new InitConValue*[numberOfCon];
06244
06245 int i;
06246 for (i = 0; i < numberOfCon; i++)
06247 {
06248 this->con[i] = new InitConValue();
06249 this->con[i]->idx = idx[i];
06250 this->con[i]->name = name[i];
06251 this->con[i]->value = value[i];
06252 }
06253 return true;
06254 }
06255
06256
06257
06264 bool InitConstraintValues::addCon(int idx, double value)
06265 {
06266 try
06267 {
06268 int nopt;
06269 int i;
06270 if (idx < 0)
06271 throw ErrorClass( "the index of a constraint cannot be negative." );
06272
06273 if (this->con == NULL)
06274 nopt = 0;
06275 else
06276 nopt = this->numberOfCon;
06277
06278 InitConValue** temp = new InitConValue*[nopt+1];
06279 for (i = 0; i < nopt; i++)
06280 temp[i] = this->con[i];
06281
06282 delete[] this->con;
06283
06284
06285 temp[ nopt] = new InitConValue();
06286
06287 temp[ nopt]->idx = idx;
06288 temp[ nopt]->value = value;
06289
06290 this->con = temp;
06291 this->numberOfCon = ++nopt;
06292
06293 return true;
06294 }
06295 catch(const ErrorClass& eclass)
06296 {
06297 cout << eclass.errormsg << endl;
06298 return false;
06299 }
06300 }
06301
06308 bool InitDualVariableValues::setCon(int numberOfCon, InitDualVarValue **con)
06309 {
06310 try
06311 {
06312 if (this->con != NULL)
06313 throw ErrorClass( "InitDualVarValue array previously used.");
06314
06315 if (numberOfCon < 0)
06316 throw ErrorClass( "length of con array cannot be negative.");
06317
06318 this->numberOfCon = numberOfCon;
06319 if (numberOfCon == 0)
06320 return true;
06321
06322 this->con = new InitDualVarValue*[numberOfCon];
06323
06324 int i;
06325 for (i = 0; i < numberOfCon; i++)
06326 {
06327 this->con[i] = new InitDualVarValue();
06328 *this->con[i] = *con[i];
06329 }
06330 return true;
06331 }
06332 catch(const ErrorClass& eclass)
06333 {
06334 cout << eclass.errormsg << endl;
06335 return false;
06336 }
06337 }
06338
06339 bool InitDualVariableValues::setCon(int numberOfCon, int *idx, double *lbValue, double *ubValue, std::string *name)
06340 {
06341 if (this->con != NULL)
06342 return false;
06343
06344 if (numberOfCon < 0)
06345 return false;
06346
06347 this->numberOfCon = numberOfCon;
06348 if (numberOfCon == 0)
06349 return true;
06350
06351 this->con = new InitDualVarValue*[numberOfCon];
06352
06353 int i;
06354 for (i = 0; i < numberOfCon; i++)
06355 {
06356 this->con[i] = new InitDualVarValue();
06357 this->con[i]->idx = idx[i];
06358 this->con[i]->name = name[i];
06359 this->con[i]->lbDualValue = lbValue[i];
06360 this->con[i]->ubDualValue = ubValue[i];
06361 }
06362 return true;
06363 }
06364
06365
06373 bool InitDualVariableValues::addCon(int idx, double lbDualValue, double ubDualValue)
06374 {
06375 try
06376 {
06377 int nopt;
06378 int i;
06379 if (idx < 0)
06380 throw ErrorClass( "the index of a constraint cannot be negative." );
06381
06382 if (this->con == NULL)
06383 nopt = 0;
06384 else
06385 nopt = this->numberOfCon;
06386
06387 InitDualVarValue** temp = new InitDualVarValue*[nopt+1];
06388 for (i = 0; i < nopt; i++)
06389 temp[i] = this->con[i];
06390
06391 delete[] this->con;
06392
06393
06394 temp[ nopt] = new InitDualVarValue();
06395
06396 temp[ nopt]->idx = idx;
06397 temp[ nopt]->lbDualValue = lbDualValue;
06398 temp[ nopt]->ubDualValue = ubDualValue;
06399
06400 this->con = temp;
06401 this->numberOfCon = ++nopt;
06402
06403 return true;
06404 }
06405 catch(const ErrorClass& eclass)
06406 {
06407 cout << eclass.errormsg << endl;
06408 return false;
06409 }
06410 }
06411
06418 bool OtherConstraintOption::setCon(int numberOfCon, OtherConOption **con)
06419 {
06420 try
06421 {
06422 if (this->con != NULL)
06423 throw ErrorClass( "OtherConOption array previously used.");
06424
06425 if (numberOfCon < 0)
06426 throw ErrorClass( "length of <con> array cannot be negative.");
06427
06428 this->numberOfCon = numberOfCon;
06429 if (numberOfCon == 0)
06430 return true;
06431
06432 this->con = new OtherConOption*[numberOfCon];
06433
06434 int i;
06435 for (i = 0; i < numberOfCon; i++)
06436 {
06437 this->con[i] = new OtherConOption();
06438 *this->con[i] = *con[i];
06439 }
06440 return true;
06441 }
06442 catch(const ErrorClass& eclass)
06443 {
06444 cout << eclass.errormsg << endl;
06445 return false;
06446 }
06447 }
06448
06457 bool OtherConstraintOption::addCon(int idx, std::string value, std::string lbValue, std::string ubValue)
06458 {
06459 try
06460 {
06461 int nopt;
06462 int i;
06463 if (idx < 0)
06464 throw ErrorClass( "the index of a variable cannot be negative." );
06465
06466 if (this->con == NULL)
06467 nopt = 0;
06468 else
06469 nopt = this->numberOfCon;
06470
06471 OtherConOption** temp = new OtherConOption*[nopt+1];
06472 for (i = 0; i < nopt; i++)
06473 temp[i] = this->con[i];
06474
06475 delete[] this->con;
06476
06477
06478 temp[ nopt] = new OtherConOption();
06479
06480 temp[ nopt]->idx = idx;
06481 temp[ nopt]->value = value;
06482 temp[ nopt]->lbValue = lbValue;
06483 temp[ nopt]->ubValue = ubValue;
06484
06485 this->con = temp;
06486 this->numberOfCon = ++nopt;
06487
06488 return true;
06489 }
06490 catch(const ErrorClass& eclass)
06491 {
06492 cout << eclass.errormsg << endl;
06493 return false;
06494 }
06495 }
06496
06503 bool ConstraintOption::setOther(int numberOfOptions, OtherConstraintOption **other)
06504 {
06505 try
06506 {
06507 if (this->other != NULL)
06508 throw ErrorClass( "otherConstraintOptions array previously used.");
06509
06510 if (numberOfOptions < 0)
06511 throw ErrorClass( "length of <other> array cannot be negative.");
06512
06513 this->numberOfOtherConstraintOptions = numberOfOptions;
06514 if (numberOfOptions == 0)
06515 return true;
06516
06517 this->other = new OtherConstraintOption*[numberOfOptions];
06518
06519 int i, j;
06520 for (i = 0; i < numberOfOptions; i++)
06521 {
06522 this->other[i] = new OtherConstraintOption();
06523 this->other[i]->name = other[i]->name;
06524 this->other[i]->value = other[i]->value;
06525 this->other[i]->solver = other[i]->solver;
06526 this->other[i]->category = other[i]->category;
06527 this->other[i]->type = other[i]->type;
06528 this->other[i]->description = other[i]->description;
06529
06530 if (other[i]->numberOfCon < 0)
06531 throw ErrorClass( "the number of constraints in otherConstraintOption cannot be negative.");
06532
06533 this->other[i]->numberOfCon = other[i]->numberOfCon;
06534
06535 if (other[i]->numberOfCon > 0)
06536 {
06537 this->other[i]->con = new OtherConOption*[other[i]->numberOfCon];
06538 for (j = 0; j < other[i]->numberOfCon; j++)
06539 {
06540 this->other[i]->con[j] = new OtherConOption();
06541 *this->other[i]->con[j] = *other[i]->con[j];
06542 }
06543 }
06544
06545 this->other[i]->numberOfEnumerations = other[i]->numberOfEnumerations;
06546
06547 if (this->other[i]->numberOfEnumerations > 0)
06548 {
06549 this->other[i]->enumeration = new OtherOptionEnumeration*[this->other[i]->numberOfEnumerations];
06550 for (j = 0; j < this->other[i]->numberOfEnumerations; j++)
06551 {
06552 this->other[i]->enumeration[j] = new OtherOptionEnumeration();
06553 this->other[i]->enumeration[j]->setOtherOptionEnumeration(
06554 other[i]->enumeration[j]->value,
06555 other[i]->enumeration[j]->description,
06556 other[i]->enumeration[j]->el,
06557 other[i]->enumeration[j]->numberOfEl);
06558 }
06559 }
06560
06561 }
06562 return true;
06563 }
06564 catch(const ErrorClass& eclass)
06565 {
06566 cout << eclass.errormsg << endl;
06567 return false;
06568 }
06569 }
06570
06576 bool ConstraintOption::addOther(OtherConstraintOption *other)
06577 {
06578 try
06579 {
06580 int nopt, i, j;
06581 if (this->other == NULL)
06582 nopt = 0;
06583 else
06584 nopt = this->numberOfOtherConstraintOptions;
06585
06586 OtherConstraintOption** temp = new OtherConstraintOption*[nopt+1];
06587 for (i = 0; i < nopt; i++)
06588 temp[i] = this->other[i];
06589
06590 delete[] this->other;
06591
06592
06593 temp[ nopt] = new OtherConstraintOption();
06594 temp[ nopt]->name = other->name;
06595 temp[ nopt]->value = other->value;
06596 temp[ nopt]->solver = other->solver;
06597 temp[ nopt]->category = other->category;
06598 temp[ nopt]->type = other->type;
06599 temp[ nopt]->description = other->description;
06600
06601 if (other->numberOfCon < 0)
06602 throw ErrorClass( "the number of constraints in otherConstraintOption cannot be negative.");
06603
06604 temp[ nopt]->numberOfCon = other->numberOfCon;
06605 temp[ nopt]->numberOfEnumerations = other->numberOfEnumerations;
06606
06607 if (other->numberOfCon > 0)
06608 {
06609 temp[ nopt]->con = new OtherConOption*[other->numberOfCon];
06610 for (j = 0; j < other->numberOfCon; j++)
06611 {
06612 temp[ nopt]->con[j] = new OtherConOption();
06613 *temp[ nopt]->con[j] = *other->con[j];
06614 }
06615 }
06616
06617 if (other->numberOfEnumerations < 0)
06618 throw ErrorClass( "the number of enumerations in otherObjectiveOption cannot be negative.");
06619
06620 if (other->numberOfEnumerations > 0)
06621 {
06622 temp[ nopt]->enumeration = new OtherOptionEnumeration*[other->numberOfEnumerations];
06623 for (j = 0; j < other->numberOfEnumerations; j++)
06624 {
06625 temp[ nopt]->enumeration[j] = new OtherOptionEnumeration();
06626 temp[ nopt]->enumeration[j]->setOtherOptionEnumeration(
06627 other->enumeration[j]->value,
06628 other->enumeration[j]->description,
06629 other->enumeration[j]->el,
06630 other->enumeration[j]->numberOfEl);
06631 }
06632 }
06633
06634 this->other = temp;
06635 this->numberOfOtherConstraintOptions = ++nopt;
06636
06637 return true;
06638 }
06639 catch(const ErrorClass& eclass)
06640 {
06641 cout << eclass.errormsg << endl;
06642 return false;
06643 }
06644 }
06645
06652 bool SolverOptions::setSolverOptions(int numberOfOptions, SolverOption **solverOption)
06653 {
06654 try
06655 {
06656 if (this->solverOption != NULL)
06657 throw ErrorClass( "solverOptions array previously used.");
06658
06659 if (numberOfOptions < 0)
06660 throw ErrorClass( "length of <solverOption> array cannot be negative.");
06661
06662 this->numberOfSolverOptions = numberOfOptions;
06663 if (numberOfOptions == 0)
06664 return true;
06665
06666 this->solverOption = new SolverOption*[numberOfOptions];
06667
06668 int i;
06669 for (i = 0; i < numberOfOptions; i++)
06670 {
06671 this->solverOption[i] = new SolverOption();
06672
06673 this->solverOption[i]->numberOfItems = solverOption[i]->numberOfItems;
06674 this->solverOption[i]->name = solverOption[i]->name;
06675 this->solverOption[i]->value = solverOption[i]->value;
06676 this->solverOption[i]->solver = solverOption[i]->solver;
06677 this->solverOption[i]->category = solverOption[i]->category;
06678 this->solverOption[i]->type = solverOption[i]->type;
06679 this->solverOption[i]->description = solverOption[i]->description;
06680
06681 if (solverOption[i]->numberOfItems > 0)
06682 {
06683 this->solverOption[i]->item = new std::string[solverOption[i]->numberOfItems];
06684 for (int j=0; j<solverOption[i]->numberOfItems; j++)
06685 this->solverOption[i]->item[j] = solverOption[i]->item[j];
06686 }
06687 }
06688 return true;
06689 }
06690 catch(const ErrorClass& eclass)
06691 {
06692 cout << eclass.errormsg << endl;
06693 return false;
06694 }
06695 }
06696
06707 bool SolverOptions::addSolverOption(std::string name, std::string value, std::string solver,
06708 std::string category, std::string type, std::string description)
06709 {
06710 try
06711 {
06712 int nopt;
06713 int i;
06714 if (name.empty() )
06715 throw ErrorClass( "the name of a solver option cannot be empty." );
06716
06717 if (this->solverOption == NULL)
06718 nopt = 0;
06719 else
06720 nopt = this->numberOfSolverOptions;
06721
06722 SolverOption** temp = new SolverOption*[nopt+1];
06723 for (i = 0; i < nopt; i++)
06724 temp[i] = this->solverOption[i];
06725
06726 delete[] this->solverOption;
06727
06728
06729 temp[ nopt] = new SolverOption();
06730
06731 temp[ nopt]->numberOfItems = 0;
06732 temp[ nopt]->name = name;
06733 temp[ nopt]->value = value;
06734 temp[ nopt]->solver = solver;
06735 temp[ nopt]->type = type;
06736 temp[ nopt]->category = category;
06737 temp[ nopt]->description = description;
06738
06739 this->solverOption = temp;
06740 this->numberOfSolverOptions = ++nopt;
06741
06742 return true;
06743 }
06744 catch(const ErrorClass& eclass)
06745 {
06746 cout << eclass.errormsg << endl;
06747 return false;
06748 }
06749 }
06750
06755 bool OSOption::setOptionHeader(std::string name, std::string source,
06756 std::string description, std::string fileCreator, std::string licence)
06757 {
06758 if (this->optionHeader == NULL)
06759 this->optionHeader = new GeneralFileHeader();
06760 return this->optionHeader->setHeader(name, source, description, fileCreator, licence);
06761 }
06762
06767 bool OSOption::setServiceURI( std::string serviceURI)
06768 {
06769 if (this->general == NULL)
06770 this->general = new GeneralOption();
06771 this->general->serviceURI = serviceURI;
06772 return true;
06773 }
06774
06775 bool OSOption::setServiceName( std::string serviceName)
06776 {
06777 if (this->general == NULL)
06778 this->general = new GeneralOption();
06779 this->general->serviceName = serviceName;
06780 return true;
06781 }
06782
06783 bool OSOption::setInstanceName( std::string instanceName)
06784 {
06785 if (this->general == NULL)
06786 this->general = new GeneralOption();
06787 this->general->instanceName = instanceName;
06788 return true;
06789 }
06790
06791 bool OSOption::setInstanceLocation( std::string instanceLocation)
06792 {
06793 if (this->general == NULL)
06794 this->general = new GeneralOption();
06795 if (this->general->instanceLocation == NULL)
06796 this->general->instanceLocation = new InstanceLocationOption();
06797 this->general->instanceLocation->value = instanceLocation;
06798 return true;
06799 }
06800
06801 bool OSOption::setInstanceLocation( std::string instanceLocation, std::string locationType)
06802 {
06803 if (verifyLocationType(locationType) == 0)
06804 return false;
06805
06806 if (this->general == NULL)
06807 this->general = new GeneralOption();
06808 if (this->general->instanceLocation == NULL)
06809 this->general->instanceLocation = new InstanceLocationOption();
06810 this->general->instanceLocation->value = instanceLocation;
06811 this->general->instanceLocation->locationType = locationType;
06812 return true;
06813 }
06814
06815 bool OSOption::setInstanceLocationType( std::string locationType)
06816 {
06817 try
06818 {
06819 if (this->general == NULL)
06820 this->general = new GeneralOption();
06821 if (this->general->instanceLocation == NULL)
06822 this->general->instanceLocation = new InstanceLocationOption();
06823
06824 if (verifyLocationType(locationType) == 0)
06825 return false;
06826
06827 this->general->instanceLocation->locationType = locationType;
06828 return true;
06829 }
06830 catch(const ErrorClass& eclass)
06831 {
06832 cout << eclass.errormsg << endl;
06833 return false;
06834 }
06835 }
06836
06837 bool OSOption::setJobID( std::string jobID)
06838 {
06839 if (this->general == NULL)
06840 this->general = new GeneralOption();
06841 this->general->jobID = jobID;
06842 return true;
06843 }
06844
06845 bool OSOption::setSolverToInvoke( std::string solverToInvoke)
06846 {
06847 if (this->general == NULL)
06848 this->general = new GeneralOption();
06849 this->general->solverToInvoke = solverToInvoke;
06850 return true;
06851 }
06852
06853 bool OSOption::setLicense( std::string license)
06854 {
06855 if (this->general == NULL)
06856 this->general = new GeneralOption();
06857 this->general->license = license;
06858 return true;
06859 }
06860
06861 bool OSOption::setUserName( std::string userName)
06862 {
06863 if (this->general == NULL)
06864 this->general = new GeneralOption();
06865 this->general->userName = userName;
06866 return true;
06867 }
06868
06869 bool OSOption::setPassword( std::string password)
06870 {
06871 if (this->general == NULL)
06872 this->general = new GeneralOption();
06873 this->general->password = password;
06874 return true;
06875 }
06876
06877 bool OSOption::setContact( std::string contact)
06878 {
06879 if (this->general == NULL)
06880 this->general = new GeneralOption();
06881 if (this->general->contact == NULL)
06882 this->general->contact = new ContactOption();
06883 this->general->contact->value = contact;
06884 return true;
06885 }
06886
06887 bool OSOption::setContact(std::string contact,std::string transportType)
06888 {
06889 if (verifyTransportType(transportType) == 0)
06890 return false;
06891
06892 if (this->general == NULL)
06893 this->general = new GeneralOption();
06894 if (this->general->contact == NULL)
06895 this->general->contact = new ContactOption();
06896 this->general->contact->value = contact;
06897 this->general->contact->transportType = transportType;
06898 return true;
06899 }
06900
06901 bool OSOption::setContactTransportType( std::string transportType)
06902 {
06903 try
06904 {
06905 if (this->general == NULL)
06906 this->general = new GeneralOption();
06907 if (this->general->contact == NULL)
06908 this->general->contact = new ContactOption();
06909
06910 if (verifyTransportType(transportType) == 0)
06911 throw ErrorClass( "transport type not recognized.");
06912
06913 this->general->contact->transportType = transportType;
06914 return true;
06915 }
06916 catch(const ErrorClass& eclass)
06917 {
06918 cout << eclass.errormsg << endl;
06919 return false;
06920 }
06921 }
06922
06923 bool OSOption::setOtherGeneralOptions(int numberOfOptions, OtherOption** other)
06924 {
06925 if (this->general == NULL)
06926 this->general = new GeneralOption();
06927 if (this->general->otherOptions == NULL)
06928 this->general->otherOptions = new OtherOptions();
06929 else
06930 {
06931 int i;
06932 for (i = 0; i < this->general->otherOptions->numberOfOtherOptions; i++)
06933 delete this->general->otherOptions->other[i];
06934 delete[] this->general->otherOptions->other;
06935 this->general->otherOptions->other = NULL;
06936 }
06937 return this->general->otherOptions->setOther(numberOfOptions, other);
06938 }
06939
06940 bool OSOption::setAnOtherGeneralOption(std::string name, std::string value, std::string description)
06941 {
06942 if (this->general == NULL)
06943 this->general = new GeneralOption();
06944 if (this->general->otherOptions == NULL)
06945 this->general->otherOptions = new OtherOptions();
06946 return this->general->otherOptions->addOther(name, value, description);
06947 }
06948
06949
06950
06955 bool OSOption::setMinDiskSpace(std::string unit, std::string description, double value)
06956 {
06957 if (verifyStorageUnit(unit) == 0)
06958 return false;
06959
06960 if (this->system == NULL)
06961 this->system = new SystemOption();
06962 if (this->system->minDiskSpace == NULL)
06963 this->system->minDiskSpace = new StorageCapacity();
06964 this->system->minDiskSpace->unit = unit;
06965 this->system->minDiskSpace->value = value;
06966 this->system->minDiskSpace->description = description;
06967 return true;
06968 }
06969
06970 bool OSOption::setMinDiskSpace(double value)
06971 {
06972 if (this->system == NULL)
06973 this->system = new SystemOption();
06974 if (this->system->minDiskSpace == NULL)
06975 this->system->minDiskSpace = new StorageCapacity();
06976 this->system->minDiskSpace->value = value;
06977 return true;
06978 }
06979
06980 bool OSOption::setMinDiskSpaceUnit(std::string unit)
06981 {
06982 try
06983 {
06984 if (this->system == NULL)
06985 this->system = new SystemOption();
06986 if (this->system->minDiskSpace == NULL)
06987 this->system->minDiskSpace = new StorageCapacity();
06988
06989 if (verifyStorageUnit(unit) == 0)
06990 throw ErrorClass( "disk space unit not recognized.");
06991
06992 this->system->minDiskSpace->unit = unit;
06993 return true;
06994 }
06995 catch(const ErrorClass& eclass)
06996 {
06997 cout << eclass.errormsg << endl;
06998 return false;
06999 }
07000 }
07001
07002 bool OSOption::setMinMemorySize(std::string unit, std::string description, double value)
07003 {
07004 if (verifyStorageUnit(unit) == 0)
07005 return false;
07006
07007 if (this->system == NULL)
07008 this->system = new SystemOption();
07009 if (this->system->minMemorySize == NULL)
07010 this->system->minMemorySize = new StorageCapacity();
07011 this->system->minMemorySize->unit = unit;
07012 this->system->minMemorySize->value = value;
07013 this->system->minMemorySize->description = description;
07014 return true;
07015 }
07016
07017 bool OSOption::setMinMemorySize(double value)
07018 {
07019 if (this->system == NULL)
07020 this->system = new SystemOption();
07021 if (this->system->minMemorySize == NULL)
07022 this->system->minMemorySize = new StorageCapacity();
07023 this->system->minMemorySize->value = value;
07024 return true;
07025 }
07026
07027 bool OSOption::setMinMemoryUnit(std::string unit)
07028 {
07029 try
07030 {
07031 if (this->system == NULL)
07032 this->system = new SystemOption();
07033 if (this->system->minMemorySize == NULL)
07034 this->system->minMemorySize = new StorageCapacity();
07035
07036 if (verifyStorageUnit(unit) == 0)
07037 throw ErrorClass( "memory size unit not recognized.");
07038
07039 this->system->minMemorySize->unit = unit;
07040 return true;
07041 }
07042 catch(const ErrorClass& eclass)
07043 {
07044 cout << eclass.errormsg << endl;
07045 return false;
07046 }
07047 }
07048
07049 bool OSOption::setMinCPUSpeed(double value)
07050 {
07051 if (this->system == NULL)
07052 this->system = new SystemOption();
07053 if (this->system->minCPUSpeed == NULL)
07054 this->system->minCPUSpeed = new CPUSpeed();
07055 this->system->minCPUSpeed->value = value;
07056 return true;
07057 }
07058
07059 bool OSOption::setMinCPUSpeed(std::string unit, std::string description, double value)
07060 {
07061 if (verifyCPUSpeedUnit(unit) == 0)
07062 return false;
07063
07064 if (this->system == NULL)
07065 this->system = new SystemOption();
07066 if (this->system->minCPUSpeed == NULL)
07067 this->system->minCPUSpeed = new CPUSpeed();
07068 this->system->minCPUSpeed->unit = unit;
07069 this->system->minCPUSpeed->value = value;
07070 this->system->minCPUSpeed->description = description;
07071 return true;
07072 }
07073
07074 bool OSOption::setMinCPUSpeedUnit(std::string unit)
07075 {
07076 try
07077 {
07078 if (this->system == NULL)
07079 this->system = new SystemOption();
07080 if (this->system->minCPUSpeed == NULL)
07081 this->system->minCPUSpeed = new CPUSpeed();
07082
07083 if (verifyCPUSpeedUnit(unit) == 0)
07084 throw ErrorClass( "CPU speed unit not recognized.");
07085
07086 this->system->minCPUSpeed->unit = unit;
07087 return true;
07088 }
07089 catch(const ErrorClass& eclass)
07090 {
07091 cout << eclass.errormsg << endl;
07092 return false;
07093 }
07094 }
07095
07096 bool OSOption::setMinCPUNumber(int number)
07097 {
07098 if (this->system == NULL)
07099 this->system = new SystemOption();
07100 if (this->system->minCPUNumber == NULL)
07101 this->system->minCPUNumber = new CPUNumber();
07102 this->system->minCPUNumber->value = number;
07103 return true;
07104 }
07105
07106 bool OSOption::setMinCPUNumber(int number, std::string description)
07107 {
07108 if (this->system == NULL)
07109 this->system = new SystemOption();
07110 if (this->system->minCPUNumber == NULL)
07111 this->system->minCPUNumber = new CPUNumber();
07112 this->system->minCPUNumber->value = number;
07113 this->system->minCPUNumber->description = description;
07114 return true;
07115 }
07116
07117 bool OSOption::setOtherSystemOptions(int numberOfOptions, OtherOption** other)
07118 {
07119 if (this->system == NULL)
07120 this->system = new SystemOption();
07121 if (this->system->otherOptions == NULL)
07122 this->system->otherOptions = new OtherOptions();
07123 else
07124 {
07125 int i;
07126 for (i = 0; i < this->system->otherOptions->numberOfOtherOptions; i++)
07127 delete this->system->otherOptions->other[i];
07128 delete[] this->system->otherOptions->other;
07129 this->system->otherOptions->other = NULL;
07130 this->system->otherOptions->numberOfOtherOptions = 0;
07131 }
07132 return this->system->otherOptions->setOther(numberOfOptions, other);
07133 }
07134
07135 bool OSOption::setAnOtherSystemOption(std::string name, std::string value, std::string description)
07136 {
07137 if (this->system == NULL)
07138 this->system = new SystemOption();
07139 if (this->system->otherOptions == NULL)
07140 this->system->otherOptions = new OtherOptions();
07141 return this->system->otherOptions->addOther(name, value, description);
07142 }
07143
07144
07149 bool OSOption::setServiceType( std::string serviceType)
07150 {
07151 try
07152 {
07153 if (this->service == NULL)
07154 this->service = new ServiceOption();
07155
07156 if (verifyServiceType(serviceType) == 0)
07157 throw ErrorClass( "service type not recognized.");
07158
07159 this->service->type = serviceType;
07160 return true;
07161 }
07162 catch(const ErrorClass& eclass)
07163 {
07164 cout << eclass.errormsg << endl;
07165 return false;
07166 }
07167 }
07168
07169 bool OSOption::setOtherServiceOptions(int numberOfOptions, OtherOption** other)
07170 {
07171 if (this->service == NULL)
07172 this->service = new ServiceOption();
07173 if (this->service->otherOptions == NULL)
07174 this->service->otherOptions = new OtherOptions();
07175 else
07176 {
07177 int i;
07178 for (i = 0; i < this->service->otherOptions->numberOfOtherOptions; i++)
07179 delete this->service->otherOptions->other[i];
07180 delete[] this->service->otherOptions->other;
07181 this->service->otherOptions->other = NULL;
07182 }
07183 return this->service->otherOptions->setOther(numberOfOptions, other);
07184 }
07185
07186 bool OSOption::setAnOtherServiceOption(std::string name, std::string value, std::string description)
07187 {
07188 if (this->service == NULL)
07189 this->service = new ServiceOption();
07190 if (this->service->otherOptions == NULL)
07191 this->service->otherOptions = new OtherOptions();
07192 return this->service->otherOptions->addOther(name, value, description);
07193 }
07194
07199 bool OSOption::setMaxTime(double value)
07200 {
07201 if (this->job == NULL)
07202 this->job = new JobOption();
07203 if (this->job->maxTime == NULL)
07204 this->job->maxTime = new TimeSpan();
07205 this->job->maxTime->value = value;
07206 return true;
07207 }
07208
07209 bool OSOption::setMaxTime(double value, std::string unit)
07210 {
07211 if (verifyTimeUnit(unit) == 0)
07212 return false;
07213
07214 if (this->job == NULL)
07215 this->job = new JobOption();
07216 if (this->job->maxTime == NULL)
07217 this->job->maxTime = new TimeSpan();
07218 this->job->maxTime->value = value;
07219 this->job->maxTime->unit = unit;
07220 return true;
07221 }
07222
07223 bool OSOption::setMaxTimeUnit(std::string unit)
07224 {
07225 try
07226 {
07227 if (this->job == NULL)
07228 this->job = new JobOption();
07229 if (this->job->maxTime == NULL)
07230 this->job->maxTime = new TimeSpan();
07231
07232 if (verifyTimeUnit(unit) == 0)
07233 throw ErrorClass( "time unit not recognized.");
07234
07235 this->job->maxTime->unit = unit;
07236 return true;
07237 }
07238 catch(const ErrorClass& eclass)
07239 {
07240 cout << eclass.errormsg << endl;
07241 return false;
07242 }
07243 }
07244
07245 bool OSOption::setRequestedStartTime(std::string time)
07246 {
07247 if (this->job == NULL)
07248 this->job = new JobOption();
07249 this->job->requestedStartTime = time;
07250 return true;
07251 }
07252
07253
07254 bool OSOption::setJobDependencies(int numberOfDependencies, std::string* jobDependencies)
07255 {
07256 if (this->job == NULL)
07257 this->job = new JobOption();
07258 if (this->job->dependencies == NULL)
07259 this->job->dependencies = new JobDependencies();
07260 else
07261 delete[] this->job->dependencies->jobID;
07262 this->job->dependencies->jobID = NULL;
07263 return this->job->dependencies->setJobID(numberOfDependencies, jobDependencies);
07264 }
07265
07266 bool OSOption::setAnotherJobDependency(std::string jobID)
07267 {
07268 if (this->job == NULL)
07269 this->job = new JobOption();
07270 if (this->job->dependencies == NULL)
07271 this->job->dependencies = new JobDependencies();
07272 return this->job->dependencies->addJobID(jobID);
07273 }
07274
07275
07276 bool OSOption::setRequiredDirectories(int numberOfPaths, std::string* paths)
07277 {
07278 if (this->job == NULL)
07279 this->job = new JobOption();
07280 if (this->job->requiredDirectories == NULL)
07281 this->job->requiredDirectories = new DirectoriesAndFiles();
07282 else
07283 delete[] this->job->requiredDirectories->path;
07284 this->job->requiredDirectories->path = NULL;
07285 return this->job->requiredDirectories->setPath(numberOfPaths, paths);
07286 }
07287
07288 bool OSOption::setAnotherRequiredDirectory(std::string path)
07289 {
07290 if (this->job == NULL)
07291 this->job = new JobOption();
07292 if (this->job->requiredDirectories == NULL)
07293 this->job->requiredDirectories = new DirectoriesAndFiles();
07294 return this->job->requiredDirectories->addPath(path);
07295 }
07296
07297
07298 bool OSOption::setRequiredFiles(int numberOfPaths, std::string* paths)
07299 {
07300 if (this->job == NULL)
07301 this->job = new JobOption();
07302 if (this->job->requiredFiles == NULL)
07303 this->job->requiredFiles = new DirectoriesAndFiles();
07304 else
07305 delete[] this->job->requiredFiles->path;
07306 this->job->requiredFiles->path = NULL;
07307 return this->job->requiredFiles->setPath(numberOfPaths, paths);
07308 }
07309
07310 bool OSOption::setAnotherRequiredFile(std::string path)
07311 {
07312 if (this->job == NULL)
07313 this->job = new JobOption();
07314 if (this->job->requiredFiles == NULL)
07315 this->job->requiredFiles = new DirectoriesAndFiles();
07316 return this->job->requiredFiles->addPath(path);
07317 }
07318
07319
07320 bool OSOption::setDirectoriesToMake(int numberOfPaths, std::string* paths)
07321 {
07322 if (this->job == NULL)
07323 this->job = new JobOption();
07324 if (this->job->directoriesToMake == NULL)
07325 this->job->directoriesToMake = new DirectoriesAndFiles();
07326 else
07327 delete[] this->job->directoriesToMake->path;
07328 this->job->directoriesToMake->path = NULL;
07329 return this->job->directoriesToMake->setPath(numberOfPaths, paths);
07330 }
07331
07332 bool OSOption::setAnotherDirectoryToMake(std::string path)
07333 {
07334 if (this->job == NULL)
07335 this->job = new JobOption();
07336 if (this->job->directoriesToMake == NULL)
07337 this->job->directoriesToMake = new DirectoriesAndFiles();
07338 return this->job->directoriesToMake->addPath(path);
07339 }
07340
07341
07342 bool OSOption::setFilesToMake(int numberOfPaths, std::string* paths)
07343 {
07344 if (this->job == NULL)
07345 this->job = new JobOption();
07346 if (this->job->filesToMake == NULL)
07347 this->job->filesToMake = new DirectoriesAndFiles();
07348 else
07349 delete[] this->job->filesToMake->path;
07350 this->job->filesToMake->path = NULL;
07351 return this->job->filesToMake->setPath(numberOfPaths, paths);
07352 }
07353
07354 bool OSOption::setAnotherFileToMake(std::string path)
07355 {
07356 if (this->job == NULL)
07357 this->job = new JobOption();
07358 if (this->job->filesToMake == NULL)
07359 this->job->filesToMake = new DirectoriesAndFiles();
07360 return this->job->filesToMake->addPath(path);
07361 }
07362
07363 bool OSOption::setPathPairs(int object, std::string *from, std::string *to, bool *makeCopy, int numberOfPathPairs)
07364 {
07365 if (numberOfPathPairs < 0) return false;
07366 if (this->job == NULL)
07367 this->job = new JobOption();
07368 switch (object)
07369 {
07370 case ENUM_PATHPAIR_input_dir:
07371 {
07372 if (this->job->inputDirectoriesToMove == NULL)
07373 this->job->inputDirectoriesToMove = new PathPairs();
07374 return this->job->inputDirectoriesToMove->setPathPair(from, to, makeCopy, numberOfPathPairs);
07375 }
07376 case ENUM_PATHPAIR_input_file:
07377 {
07378 if (this->job->inputFilesToMove == NULL)
07379 this->job->inputFilesToMove = new PathPairs();
07380 return this->job->inputFilesToMove->setPathPair(from, to, makeCopy, numberOfPathPairs);
07381 }
07382 case ENUM_PATHPAIR_output_file:
07383 {
07384 if (this->job->outputFilesToMove == NULL)
07385 this->job->outputFilesToMove = new PathPairs();
07386 return this->job->outputFilesToMove->setPathPair(from, to, makeCopy, numberOfPathPairs);
07387 }
07388 case ENUM_PATHPAIR_output_dir:
07389 {
07390 if (this->job->outputDirectoriesToMove == NULL)
07391 this->job->outputDirectoriesToMove = new PathPairs();
07392 return this->job->outputDirectoriesToMove->setPathPair(from, to, makeCopy, numberOfPathPairs);
07393 }
07394 default:
07395 throw ErrorClass("target object not implemented in setPathPairs");
07396 }
07397
07398 }
07399
07400
07401 bool OSOption::setInputDirectoriesToMove(int numberOfPathPairs, PathPair** pathPair)
07402 {
07403 if (this->job == NULL)
07404 this->job = new JobOption();
07405 if (this->job->inputDirectoriesToMove == NULL)
07406 this->job->inputDirectoriesToMove = new PathPairs();
07407 else
07408 delete[] this->job->inputDirectoriesToMove->pathPair;
07409 this->job->inputDirectoriesToMove->pathPair = NULL;
07410 return this->job->inputDirectoriesToMove->setPathPair(numberOfPathPairs, pathPair);
07411 }
07412
07413 bool OSOption::setAnotherInputDirectoryToMove(std::string fromPath, std::string toPath, bool makeCopy)
07414 {
07415 if (this->job == NULL)
07416 this->job = new JobOption();
07417 if (this->job->inputDirectoriesToMove == NULL)
07418 this->job->inputDirectoriesToMove = new PathPairs();
07419 return this->job->inputDirectoriesToMove->addPathPair(fromPath, toPath, makeCopy);
07420 }
07421
07422
07423 bool OSOption::setInputFilesToMove(int numberOfPathPairs, PathPair** pathPair)
07424 {
07425 if (this->job == NULL)
07426 this->job = new JobOption();
07427 if (this->job->inputFilesToMove == NULL)
07428 this->job->inputFilesToMove = new PathPairs();
07429 else
07430 delete[] this->job->inputFilesToMove->pathPair;
07431 this->job->inputFilesToMove->pathPair = NULL;
07432 return this->job->inputFilesToMove->setPathPair(numberOfPathPairs, pathPair);
07433 }
07434
07435 bool OSOption::setAnotherInputFileToMove(std::string fromPath, std::string toPath, bool makeCopy)
07436 {
07437 if (this->job == NULL)
07438 this->job = new JobOption();
07439 if (this->job->inputFilesToMove == NULL)
07440 this->job->inputFilesToMove = new PathPairs();
07441 return this->job->inputFilesToMove->addPathPair(fromPath, toPath, makeCopy);
07442 }
07443
07444
07445 bool OSOption::setOutputFilesToMove(int numberOfPathPairs, PathPair** pathPair)
07446 {
07447 if (this->job == NULL)
07448 this->job = new JobOption();
07449 if (this->job->outputFilesToMove == NULL)
07450 this->job->outputFilesToMove = new PathPairs();
07451 else
07452 delete[] this->job->outputFilesToMove->pathPair;
07453 this->job->outputFilesToMove->pathPair = NULL;
07454 return this->job->outputFilesToMove->setPathPair(numberOfPathPairs, pathPair);
07455 }
07456
07457 bool OSOption::setAnotherOutputFileToMove(std::string fromPath, std::string toPath, bool makeCopy)
07458 {
07459 if (this->job == NULL)
07460 this->job = new JobOption();
07461 if (this->job->outputFilesToMove == NULL)
07462 this->job->outputFilesToMove = new PathPairs();
07463 return this->job->outputFilesToMove->addPathPair(fromPath, toPath, makeCopy);
07464 }
07465
07466
07467 bool OSOption::setOutputDirectoriesToMove(int numberOfPathPairs, PathPair** pathPair)
07468 {
07469 if (this->job == NULL)
07470 this->job = new JobOption();
07471 if (this->job->outputDirectoriesToMove == NULL)
07472 this->job->outputDirectoriesToMove = new PathPairs();
07473 else
07474 delete[] this->job->outputDirectoriesToMove->pathPair;
07475 this->job->outputDirectoriesToMove->pathPair = NULL;
07476 return this->job->outputDirectoriesToMove->setPathPair(numberOfPathPairs, pathPair);
07477 }
07478
07479 bool OSOption::setAnotherOutputDirectoryToMove(std::string fromPath, std::string toPath, bool makeCopy)
07480 {
07481 if (this->job == NULL)
07482 this->job = new JobOption();
07483 if (this->job->outputDirectoriesToMove == NULL)
07484 this->job->outputDirectoriesToMove = new PathPairs();
07485 return this->job->outputDirectoriesToMove->addPathPair(fromPath, toPath, makeCopy);
07486 }
07487
07488
07489 bool OSOption::setFilesToDelete(int numberOfPaths, std::string* paths)
07490 {
07491 if (this->job == NULL)
07492 this->job = new JobOption();
07493 if (this->job->filesToDelete == NULL)
07494 this->job->filesToDelete = new DirectoriesAndFiles();
07495 else
07496 delete[] this->job->filesToDelete->path;
07497 this->job->filesToDelete->path = NULL;
07498 return this->job->filesToDelete->setPath(numberOfPaths, paths);
07499 }
07500
07501 bool OSOption::setAnotherFileToDelete(std::string path)
07502 {
07503 if (this->job == NULL)
07504 this->job = new JobOption();
07505 if (this->job->filesToDelete == NULL)
07506 this->job->filesToDelete = new DirectoriesAndFiles();
07507 return this->job->filesToDelete->addPath(path);
07508 }
07509
07510
07511 bool OSOption::setDirectoriesToDelete(int numberOfPaths, std::string* paths)
07512 {
07513 if (this->job == NULL)
07514 this->job = new JobOption();
07515 if (this->job->directoriesToDelete == NULL)
07516 this->job->directoriesToDelete = new DirectoriesAndFiles();
07517 else
07518 delete[] this->job->directoriesToDelete->path;
07519 this->job->directoriesToDelete->path = NULL;
07520 return this->job->directoriesToDelete->setPath(numberOfPaths, paths);
07521 }
07522
07523 bool OSOption::setAnotherDirectoryToDelete(std::string path)
07524 {
07525 if (this->job == NULL)
07526 this->job = new JobOption();
07527 if (this->job->directoriesToDelete == NULL)
07528 this->job->directoriesToDelete = new DirectoriesAndFiles();
07529 return this->job->directoriesToDelete->addPath(path);
07530 }
07531
07532
07533 bool OSOption::setProcessesToKill(int numberOfProcesses, std::string* processes)
07534 {
07535 if (this->job == NULL)
07536 this->job = new JobOption();
07537 if (this->job->processesToKill == NULL)
07538 this->job->processesToKill = new Processes();
07539 else
07540 delete[] this->job->processesToKill->process;
07541 this->job->processesToKill->process = NULL;
07542 return this->job->processesToKill->setProcess(numberOfProcesses, processes);
07543 }
07544
07545 bool OSOption::setAnotherProcessToKill(std::string process)
07546 {
07547 if (this->job == NULL)
07548 this->job = new JobOption();
07549 if (this->job->processesToKill == NULL)
07550 this->job->processesToKill = new Processes();
07551 return this->job->processesToKill->addProcess(process);
07552 }
07553
07554
07555 bool OSOption::setOtherJobOptions(int numberOfOptions, OtherOption** other)
07556 {
07557 if (this->job == NULL)
07558 this->job = new JobOption();
07559 if (this->job->otherOptions == NULL)
07560 this->job->otherOptions = new OtherOptions();
07561 else
07562 {
07563 int i;
07564 for (i = 0; i < this->job->otherOptions->numberOfOtherOptions; i++)
07565 delete this->job->otherOptions->other[i];
07566 delete[] this->job->otherOptions->other;
07567 this->job->otherOptions->other = NULL;
07568 }
07569 return this->job->otherOptions->setOther(numberOfOptions, other);
07570 }
07571
07572 bool OSOption::setAnOtherJobOption(std::string name, std::string value, std::string description)
07573 {
07574 if (this->job == NULL)
07575 this->job = new JobOption();
07576 if (this->job->otherOptions == NULL)
07577 this->job->otherOptions = new OtherOptions();
07578 return this->job->otherOptions->addOther(name, value, description);
07579 }
07580
07581
07582
07583 bool OSOption::setNumberOfVariables(int numberOfVariables)
07584 {
07585 if (this->optimization == NULL)
07586 this->optimization = new OptimizationOption();
07587 this->optimization->numberOfVariables = numberOfVariables;
07588 return true;
07589 }
07590
07591 bool OSOption::setNumberOfObjectives(int numberOfObjectives)
07592 {
07593 if (this->optimization == NULL)
07594 this->optimization = new OptimizationOption();
07595 this->optimization->numberOfObjectives = numberOfObjectives;
07596 return true;
07597 }
07598
07599 bool OSOption::setNumberOfConstraints(int numberOfConstraints)
07600 {
07601 if (this->optimization == NULL)
07602 this->optimization = new OptimizationOption();
07603 this->optimization->numberOfConstraints = numberOfConstraints;
07604 return true;
07605 }
07606
07607
07608 bool OSOption::setInitVarValues(int numberOfVar, int* idx, double* value, std::string* name)
07609 {
07610 if (this->optimization == NULL)
07611 this->optimization = new OptimizationOption();
07612 if (this->optimization->variables == NULL)
07613 this->optimization->variables = new VariableOption();
07614 if (this->optimization->variables->initialVariableValues != NULL)
07615 return false;
07616
07617 this->optimization->variables->initialVariableValues = new InitVariableValues();
07618
07619 return this->optimization->variables->initialVariableValues->setVar(numberOfVar, idx, value, name);
07620 }
07621
07622
07623 bool OSOption::setInitVarValuesSparse(int numberOfVar, InitVarValue** var)
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 this->optimization->variables->initialVariableValues = new InitVariableValues();
07631 else
07632 {
07633 int i;
07634 for (i = 0; i < this->optimization->variables->initialVariableValues->numberOfVar; i++)
07635 delete this->optimization->variables->initialVariableValues->var[i];
07636 delete[] this->optimization->variables->initialVariableValues->var;
07637 this->optimization->variables->initialVariableValues->var = NULL;
07638 }
07639 return this->optimization->variables->initialVariableValues->setVar(numberOfVar, var);
07640 }
07641
07642 bool OSOption::setInitVarValuesDense(int numberOfVar, double *value)
07643 {
07644 if (this->optimization == NULL)
07645 this->optimization = new OptimizationOption();
07646 if (this->optimization->variables == NULL)
07647 this->optimization->variables = new VariableOption();
07648 if (this->optimization->variables->initialVariableValues == NULL)
07649 this->optimization->variables->initialVariableValues = new InitVariableValues();
07650 else
07651 {
07652 delete[] this->optimization->variables->initialVariableValues->var;
07653 this->optimization->variables->initialVariableValues->var = NULL;
07654 }
07655
07656 int i;
07657 for (i = 0; i < numberOfVar; i++)
07658 {
07659
07660 if (!this->optimization->variables->initialVariableValues->addVar(i, value[i]))
07661 return false;
07662 }
07663 return true;
07664 }
07665
07666 bool OSOption::setAnotherInitVarValue(int idx, double value)
07667 {
07668 if (this->optimization == NULL)
07669 this->optimization = new OptimizationOption();
07670 if (this->optimization->variables == NULL)
07671 this->optimization->variables = new VariableOption();
07672 if (this->optimization->variables->initialVariableValues == NULL)
07673 this->optimization->variables->initialVariableValues = new InitVariableValues();
07674 return this->optimization->variables->initialVariableValues->addVar(idx, value);
07675 }
07676
07677 bool OSOption::setInitVarValuesString(int numberOfVar, int* idx, std::string* value, std::string* name)
07678 {
07679 if (this->optimization == NULL)
07680 this->optimization = new OptimizationOption();
07681 if (this->optimization->variables == NULL)
07682 this->optimization->variables = new VariableOption();
07683 if (this->optimization->variables->initialVariableValuesString != NULL)
07684 return false;
07685
07686 this->optimization->variables->initialVariableValuesString = new InitVariableValuesString();
07687
07688 return this->optimization->variables->initialVariableValuesString->setVar(numberOfVar, idx, value, name);
07689 }
07690
07691 bool OSOption::setInitVarValuesStringSparse(int numberOfVar, InitVarValueString** var)
07692 {
07693 if (this->optimization == NULL)
07694 this->optimization = new OptimizationOption();
07695 if (this->optimization->variables == NULL)
07696 this->optimization->variables = new VariableOption();
07697 if (this->optimization->variables->initialVariableValuesString == NULL)
07698 this->optimization->variables->initialVariableValuesString = new InitVariableValuesString();
07699 else
07700 {
07701 int i;
07702 for (i = 0; i < this->optimization->variables->initialVariableValuesString->numberOfVar; i++)
07703 delete this->optimization->variables->initialVariableValuesString->var[i];
07704 delete[] this->optimization->variables->initialVariableValuesString->var;
07705 this->optimization->variables->initialVariableValuesString->var = NULL;
07706 }
07707 return this->optimization->variables->initialVariableValuesString->setVar(numberOfVar, var);
07708 }
07709
07710 bool OSOption::setInitVarValuesStringDense(int numberOfVar, std::string *value)
07711 {
07712 if (this->optimization == NULL)
07713 this->optimization = new OptimizationOption();
07714 if (this->optimization->variables == NULL)
07715 this->optimization->variables = new VariableOption();
07716 if (this->optimization->variables->initialVariableValuesString == NULL)
07717 this->optimization->variables->initialVariableValuesString = new InitVariableValuesString();
07718 else
07719 {
07720 delete[] this->optimization->variables->initialVariableValuesString->var;
07721 this->optimization->variables->initialVariableValuesString->var = NULL;
07722 }
07723 int i;
07724 for (i = 0; i < numberOfVar; i++)
07725 {
07726 if (value[i] != "")
07727 if (!this->optimization->variables->initialVariableValuesString->addVar(i, value[i]))
07728 return false;
07729 }
07730 return true;
07731 }
07732
07733 bool OSOption::setAnotherInitVarValueString(int idx, std::string value)
07734 {
07735 if (this->optimization == NULL)
07736 this->optimization = new OptimizationOption();
07737 if (this->optimization->variables == NULL)
07738 this->optimization->variables = new VariableOption();
07739 if (this->optimization->variables->initialVariableValuesString == NULL)
07740 this->optimization->variables->initialVariableValuesString = new InitVariableValuesString();
07741 return this->optimization->variables->initialVariableValuesString->addVar(idx, value);
07742 }
07743
07744 bool OSOption::setInitBasisStatus(int object, int status, int *i, int ni)
07745 {
07746 if (optimization == NULL) return false;
07747
07748 switch (object)
07749 {
07750 case ENUM_PROBLEM_COMPONENT_variables:
07751 {
07752 std::cout << "setInitBasisStatus: at line 7094" << std::endl;
07753 if (optimization->variables == NULL)
07754 optimization->variables = new VariableOption();
07755 std::cout << "setInitBasisStatus: at line 7097" << std::endl;
07756 std::cout << "optimization->variables->initialBasisStatus == NULL?" << std::endl;
07757 std::cout << (optimization->variables->initialBasisStatus == NULL) << std::endl;
07758 if (optimization->variables->initialBasisStatus == NULL)
07759 optimization->variables->initialBasisStatus = new BasisStatus();
07760 std::cout << "setInitBasisStatus: at line 7102" << std::endl;
07761
07762 for (int j=0; j<ni; j++)
07763 {
07764 std::cout << "component " << j;
07765 std::cout << ": " << i[j] << std::endl;
07766 if (i[j] < 0) return false;
07767 }
07768 std::cout << "setInitBasisStatus: at line 7105" << std::endl;
07769 std::cout << "parameter 1: " << status << std::endl;
07770 std::cout << "parameter 2: " << i << std::endl;
07771 std::cout << "parameter 3: " << ni << std::endl;
07772 return optimization->variables->initialBasisStatus->setIntVector(status, i, ni);
07773 }
07774 case ENUM_PROBLEM_COMPONENT_objectives:
07775 {
07776 if (optimization->objectives == NULL)
07777 optimization->objectives = new ObjectiveOption();
07778 if (optimization->objectives->initialBasisStatus == NULL)
07779 optimization->objectives->initialBasisStatus = new BasisStatus();
07780 for (int j=0; j<ni; j++) if (i[j] >= 0) return false;
07781 return optimization->objectives->initialBasisStatus->setIntVector(status, i, ni);
07782 }
07783 case ENUM_PROBLEM_COMPONENT_constraints:
07784 {
07785 if (optimization->constraints == NULL)
07786 optimization->constraints = new ConstraintOption();
07787 if (optimization->constraints->initialBasisStatus == NULL)
07788 optimization->constraints->initialBasisStatus = new BasisStatus();
07789 for (int j=0; j<ni; j++) if (i[j] < 0) return false;
07790 return optimization->constraints->initialBasisStatus->setIntVector(status, i, ni);
07791 }
07792 default:
07793 throw ErrorClass("target object not implemented in setInitBasisStatus");
07794 }
07795 }
07796
07797 bool OSOption::setAnotherInitBasisStatus(int object, int idx, int status)
07798 {
07799 if (optimization == NULL) return false;
07800
07801 switch (object)
07802 {
07803 case ENUM_PROBLEM_COMPONENT_variables:
07804 {
07805 if (optimization->variables == NULL)
07806 optimization->variables = new VariableOption();
07807 if (optimization->variables->initialBasisStatus == NULL)
07808 optimization->variables->initialBasisStatus = new BasisStatus();
07809 if (idx < 0) return false;
07810 return optimization->variables->initialBasisStatus->addIdx(status, idx);
07811 }
07812 case ENUM_PROBLEM_COMPONENT_objectives:
07813 {
07814 if (optimization->objectives == NULL)
07815 optimization->objectives = new ObjectiveOption();
07816 if (optimization->objectives->initialBasisStatus == NULL)
07817 optimization->objectives->initialBasisStatus = new BasisStatus();
07818 if (idx >= 0) return false;
07819 return optimization->objectives->initialBasisStatus->addIdx(status, idx);
07820 }
07821 case ENUM_PROBLEM_COMPONENT_constraints:
07822 {
07823 if (optimization->constraints == NULL)
07824 optimization->constraints = new ConstraintOption();
07825 if (optimization->constraints->initialBasisStatus == NULL)
07826 optimization->constraints->initialBasisStatus = new BasisStatus();
07827 if (idx < 0) return false;
07828 return optimization->constraints->initialBasisStatus->addIdx(status, idx);
07829 }
07830 default:
07831 throw ErrorClass("target object not implemented in setAnotherInitBasisStatus");
07832 }
07833 }
07834
07835 bool OSOption::setIntegerVariableBranchingWeights(int numberOfVar, int* idx, double* value, std::string* name)
07836 {
07837 if (this->optimization == NULL)
07838 this->optimization = new OptimizationOption();
07839 if (this->optimization->variables == NULL)
07840 this->optimization->variables = new VariableOption();
07841 if (this->optimization->variables->integerVariableBranchingWeights != NULL)
07842 return false;
07843
07844 this->optimization->variables->integerVariableBranchingWeights = new IntegerVariableBranchingWeights();
07845
07846 return this->optimization->variables->integerVariableBranchingWeights->setVar(numberOfVar, idx, value, name);
07847 }
07848
07849 bool OSOption::setIntegerVariableBranchingWeightsSparse(int numberOfVar, BranchingWeight** var)
07850 {
07851 if (this->optimization == NULL)
07852 this->optimization = new OptimizationOption();
07853 if (this->optimization->variables == NULL)
07854 this->optimization->variables = new VariableOption();
07855 if (this->optimization->variables->integerVariableBranchingWeights == NULL)
07856 this->optimization->variables->integerVariableBranchingWeights = new IntegerVariableBranchingWeights();
07857 else
07858 {
07859 int i;
07860 for (i = 0; i < this->optimization->variables->integerVariableBranchingWeights->numberOfVar; i++)
07861 delete this->optimization->variables->integerVariableBranchingWeights->var[i];
07862 delete[] this->optimization->variables->integerVariableBranchingWeights->var;
07863 this->optimization->variables->integerVariableBranchingWeights->var = NULL;
07864 }
07865 return this->optimization->variables->integerVariableBranchingWeights->setVar(numberOfVar, var);
07866 }
07867
07868 bool OSOption::setIntegerVariableBranchingWeightsDense(int numberOfVar, double *value)
07869 {
07870 if (this->optimization == NULL)
07871 this->optimization = new OptimizationOption();
07872 if (this->optimization->variables == NULL)
07873 this->optimization->variables = new VariableOption();
07874 if (this->optimization->variables->integerVariableBranchingWeights == NULL)
07875 this->optimization->variables->integerVariableBranchingWeights = new IntegerVariableBranchingWeights();
07876 else
07877 {
07878 delete[] this->optimization->variables->integerVariableBranchingWeights->var;
07879 this->optimization->variables->integerVariableBranchingWeights->var = NULL;
07880 }
07881 int i;
07882 for (i = 0; i < numberOfVar; i++)
07883 {
07884
07885 if (!this->optimization->variables->integerVariableBranchingWeights->addVar(i, value[i]))
07886 return false;
07887 }
07888 return true;
07889 }
07890
07891 bool OSOption::setAnotherIntegerVariableBranchingWeight(int idx, double value)
07892 {
07893 if (this->optimization == NULL)
07894 this->optimization = new OptimizationOption();
07895 if (this->optimization->variables == NULL)
07896 this->optimization->variables = new VariableOption();
07897 if (this->optimization->variables->integerVariableBranchingWeights == NULL)
07898 this->optimization->variables->integerVariableBranchingWeights = new IntegerVariableBranchingWeights();
07899 return this->optimization->variables->integerVariableBranchingWeights->addVar(idx, value);
07900 }
07901
07902
07903 bool OSOption::setSOSVariableBranchingWeights(int numberOfSOS, SOSWeights** sos)
07904 {
07905 if (this->optimization == NULL)
07906 this->optimization = new OptimizationOption();
07907 if (this->optimization->variables == NULL)
07908 this->optimization->variables = new VariableOption();
07909 if (this->optimization->variables->sosVariableBranchingWeights == NULL)
07910 this->optimization->variables->sosVariableBranchingWeights = new SOSVariableBranchingWeights();
07911 else
07912 {
07913 int i;
07914 for (i = 0; i < this->optimization->variables->sosVariableBranchingWeights->numberOfSOS; i++)
07915 delete this->optimization->variables->sosVariableBranchingWeights->sos[i];
07916 delete[] this->optimization->variables->sosVariableBranchingWeights->sos;
07917 this->optimization->variables->sosVariableBranchingWeights->sos = NULL;
07918 }
07919 return this->optimization->variables->sosVariableBranchingWeights->setSOS(numberOfSOS, sos);
07920 }
07921
07922 bool OSOption::setAnotherSOSVariableBranchingWeight(int sosIdx, int nvar, double weight, int* idx, double* value, std::string* name)
07923 {
07924 if (this->optimization == NULL)
07925 this->optimization = new OptimizationOption();
07926 if (this->optimization->variables == NULL)
07927 this->optimization->variables = new VariableOption();
07928 if (this->optimization->variables->sosVariableBranchingWeights == NULL)
07929 this->optimization->variables->sosVariableBranchingWeights = new SOSVariableBranchingWeights();
07930 return this->optimization->variables->sosVariableBranchingWeights->addSOS(sosIdx, nvar, weight, idx, value, name);
07931 }
07932
07933 bool OSOption::setNumberOfOtherVariableOptions(int numberOfOther)
07934 {
07935 if (optimization == NULL) return false;
07936 if (optimization->variables == NULL)
07937 optimization->variables = new VariableOption();
07938 if(optimization->variables->numberOfOtherVariableOptions < 0) return false;
07939
07940 optimization->variables->numberOfOtherVariableOptions = numberOfOther;
07941
07942 if (numberOfOther > 0)
07943 {
07944 optimization->variables->other = new OtherVariableOption*[numberOfOther];
07945
07946 for (int j=0; j < numberOfOther; j++)
07947 optimization->variables->other[j] = new OtherVariableOption();
07948 }
07949
07950 return true;
07951 }
07952
07953 bool OSOption::setOtherVariableOptionAttributes(int iOther, int numberOfVar,
07954 int numberOfEnumerations, std::string name,
07955 std::string value, std::string solver,
07956 std::string category, std::string type,
07957 std::string description)
07958 {
07959 if (optimization == NULL) return false;
07960 if (optimization->variables == NULL) return false;
07961 if (optimization->variables->other == NULL) return false;
07962
07963 if (iOther < 0 || iOther >= optimization->variables->numberOfOtherVariableOptions) return false;
07964
07965
07966 optimization->variables->other[iOther]->numberOfVar = numberOfVar;
07967 optimization->variables->other[iOther]->numberOfEnumerations = numberOfEnumerations;
07968 optimization->variables->other[iOther]->name = name;
07969 optimization->variables->other[iOther]->value = value;
07970 optimization->variables->other[iOther]->solver = solver;
07971 optimization->variables->other[iOther]->category = category;
07972 optimization->variables->other[iOther]->type = type;
07973 optimization->variables->other[iOther]->description = description;
07974
07975 if (numberOfVar > 0)
07976 {
07977 optimization->variables->other[iOther]->var = new OtherVarOption*[numberOfVar];
07978 for (int j=0; j<numberOfVar; j++)
07979 optimization->variables->other[iOther]->var[j] = new OtherVarOption();
07980 }
07981
07982 if (numberOfEnumerations > 0)
07983 {
07984 optimization->variables->other[iOther]->enumeration = new OtherOptionEnumeration*[numberOfEnumerations];
07985 for (int j=0; j<numberOfEnumerations; j++)
07986 optimization->variables->other[iOther]->enumeration[j] = new OtherOptionEnumeration();
07987 }
07988 return true;
07989 }
07990
07991 bool OSOption::setOtherOptionEnumeration(int object, int otherOptionNumber, int enumerationNumber,
07992 int numberOfEl, std::string value, std::string description, int* idxArray)
07993 {
07994 if (optimization == NULL) return false;
07995 if (numberOfEl < 0) return false;
07996
07997 switch (object)
07998 {
07999 case ENUM_PROBLEM_COMPONENT_variables:
08000 {
08001 if (optimization->variables == NULL) return false;
08002 if (optimization->variables->other == NULL) return false;
08003 if (otherOptionNumber < 0 || otherOptionNumber >= optimization->variables->numberOfOtherVariableOptions) return false;
08004 if (optimization->variables->other[otherOptionNumber] == NULL) return false;
08005 for (int j=0; j<numberOfEl; j++) if (idxArray[j] < 0) return false;
08006
08007 if (optimization->variables->other[otherOptionNumber]->enumeration == NULL) return false;
08008 if (enumerationNumber < 0 || enumerationNumber >= optimization->variables->other[otherOptionNumber]->numberOfEnumerations) return false;
08009 if (optimization->variables->other[otherOptionNumber]->enumeration[enumerationNumber] == NULL) return false;
08010
08011 return optimization->variables->other[otherOptionNumber]->enumeration[enumerationNumber]->setOtherOptionEnumeration(value, description, idxArray, numberOfEl);
08012 }
08013
08014 case ENUM_PROBLEM_COMPONENT_objectives:
08015 {
08016 if (optimization->objectives == NULL) return false;
08017 if (optimization->objectives->other == NULL) return false;
08018 if (otherOptionNumber < 0 || otherOptionNumber >= optimization->objectives->numberOfOtherObjectiveOptions) return false;
08019 if (optimization->objectives->other[otherOptionNumber] == NULL) return false;
08020 for (int j=0; j<numberOfEl; j++) if (idxArray[j] >= 0) return false;
08021
08022 if (optimization->objectives->other[otherOptionNumber]->enumeration == NULL) return false;
08023 if (enumerationNumber < 0 || enumerationNumber >= optimization->objectives->other[otherOptionNumber]->numberOfEnumerations) return false;
08024 if (optimization->objectives->other[otherOptionNumber]->enumeration[enumerationNumber] == NULL) return false;
08025
08026 return optimization->objectives->other[otherOptionNumber]->enumeration[enumerationNumber]->setOtherOptionEnumeration(value, description, idxArray, numberOfEl);
08027 }
08028
08029 case ENUM_PROBLEM_COMPONENT_constraints:
08030 {
08031 if (optimization->constraints == NULL) return false;
08032 if (optimization->constraints->other == NULL) return false;
08033 if (otherOptionNumber < 0 || otherOptionNumber >= optimization->constraints->numberOfOtherConstraintOptions) return false;
08034 if (optimization->constraints->other[otherOptionNumber] == NULL) return false;
08035 for (int j=0; j<numberOfEl; j++) if (idxArray[j] < 0) return false;
08036
08037 if (optimization->constraints->other[otherOptionNumber]->enumeration == NULL) return false;
08038 if (enumerationNumber < 0 || enumerationNumber >= optimization->constraints->other[otherOptionNumber]->numberOfEnumerations) return false;
08039 if (optimization->constraints->other[otherOptionNumber]->enumeration[enumerationNumber] == NULL) return false;
08040
08041 return optimization->constraints->other[otherOptionNumber]->enumeration[enumerationNumber]->setOtherOptionEnumeration(value, description, idxArray, numberOfEl);
08042 }
08043 default:
08044 throw ErrorClass("target object not implemented in setOtherOptionEnumeration");
08045 }
08046
08047 }
08048
08049 bool OSOption::setOtherVariableOptionVar(int otherOptionNumber, int varNumber,
08050 int idx, std::string name, std::string value, std::string lbValue, std::string ubValue)
08051 {
08052 if (optimization == NULL) return false;
08053
08054 if (optimization->variables == NULL) return false;
08055 if (optimization->variables->other == NULL) return false;
08056 if (otherOptionNumber < 0 || otherOptionNumber >= optimization->variables->numberOfOtherVariableOptions) return false;
08057 if (optimization->variables->other[otherOptionNumber] == NULL) return false;
08058 if (idx < 0) return false;
08059
08060 if (optimization->variables->other[otherOptionNumber]->var == NULL) return false;
08061 if (varNumber < 0 || varNumber >= optimization->variables->other[otherOptionNumber]->numberOfVar) return false;
08062 if (optimization->variables->other[otherOptionNumber]->var[varNumber] == NULL) return false;
08063
08064 optimization->variables->other[otherOptionNumber]->var[varNumber]->idx = idx;
08065 optimization->variables->other[otherOptionNumber]->var[varNumber]->name = name;
08066 optimization->variables->other[otherOptionNumber]->var[varNumber]->value = value;
08067 optimization->variables->other[otherOptionNumber]->var[varNumber]->lbValue = lbValue;
08068 optimization->variables->other[otherOptionNumber]->var[varNumber]->ubValue = ubValue;
08069 return true;
08070 }
08071
08072
08073 bool OSOption::setOtherVariableOptions(int numberOfOptions, OtherVariableOption** other)
08074 {
08075 if (this->optimization == NULL)
08076 this->optimization = new OptimizationOption();
08077 if (this->optimization->variables == NULL)
08078 this->optimization->variables = new VariableOption();
08079 else
08080 {
08081 int i;
08082 for (i = 0; i < this->optimization->variables->numberOfOtherVariableOptions; i++)
08083 delete this->optimization->variables->other[i];
08084 delete[] this->optimization->variables->other;
08085 this->optimization->variables->other = NULL;
08086 }
08087 return this->optimization->variables->setOther(numberOfOptions, other);
08088 }
08089
08090 bool OSOption::setAnOtherVariableOption(OtherVariableOption* optionValue)
08091 {
08092 if (this->optimization == NULL)
08093 this->optimization = new OptimizationOption();
08094 if (this->optimization->variables == NULL)
08095 this->optimization->variables = new VariableOption();
08096 return this->optimization->variables->addOther(optionValue);
08097 }
08098
08099 bool OSOption::setInitObjValues(int numberOfObj, int* idx, double* value, std::string* name)
08100 {
08101 if (this->optimization == NULL)
08102 this->optimization = new OptimizationOption();
08103 if (this->optimization->objectives == NULL)
08104 this->optimization->objectives = new ObjectiveOption();
08105 if (this->optimization->objectives->initialObjectiveValues != NULL)
08106 return false;
08107
08108 this->optimization->objectives->initialObjectiveValues = new InitObjectiveValues();
08109
08110 return this->optimization->objectives->initialObjectiveValues->setObj(numberOfObj, idx, value, name);
08111 }
08112
08113 bool OSOption::setInitObjValuesSparse(int numberOfObj, InitObjValue** obj)
08114 {
08115 if (this->optimization == NULL)
08116 this->optimization = new OptimizationOption();
08117 if (this->optimization->objectives == NULL)
08118 this->optimization->objectives = new ObjectiveOption();
08119 if (this->optimization->objectives->initialObjectiveValues == NULL)
08120 this->optimization->objectives->initialObjectiveValues = new InitObjectiveValues();
08121 else
08122 {
08123 int i;
08124 for (i = 0; i < this->optimization->objectives->initialObjectiveValues->numberOfObj; i++)
08125 delete this->optimization->objectives->initialObjectiveValues->obj[i];
08126 delete[] this->optimization->objectives->initialObjectiveValues->obj;
08127 this->optimization->objectives->initialObjectiveValues->obj = NULL;
08128 }
08129 return this->optimization->objectives->initialObjectiveValues->setObj(numberOfObj, obj);
08130 }
08131
08132 bool OSOption::setInitObjValuesDense(int numberOfObj, double *value)
08133 {
08134 if (this->optimization == NULL)
08135 this->optimization = new OptimizationOption();
08136 if (this->optimization->objectives == NULL)
08137 this->optimization->objectives = new ObjectiveOption();
08138 if (this->optimization->objectives->initialObjectiveValues == NULL)
08139 this->optimization->objectives->initialObjectiveValues = new InitObjectiveValues();
08140 else
08141 {
08142 delete[] this->optimization->objectives->initialObjectiveValues->obj;
08143 this->optimization->objectives->initialObjectiveValues->obj = NULL;
08144 }
08145 int i;
08146 for (i = 0; i < numberOfObj; i++)
08147 {
08148
08149 if (!this->optimization->objectives->initialObjectiveValues->addObj(-1-i, value[i]))
08150 return false;
08151 }
08152 return true;
08153 }
08154
08155 bool OSOption::setAnotherInitObjValue(int idx, double value)
08156 {
08157 if (this->optimization == NULL)
08158 this->optimization = new OptimizationOption();
08159 if (this->optimization->objectives == NULL)
08160 this->optimization->objectives = new ObjectiveOption();
08161 if (this->optimization->objectives->initialObjectiveValues == NULL)
08162 this->optimization->objectives->initialObjectiveValues = new InitObjectiveValues();
08163 return this->optimization->objectives->initialObjectiveValues->addObj(idx, value);
08164 }
08165
08166 bool OSOption::setInitObjBounds(int numberOfObj, int* idx, double* lbValue, double* ubValue, std::string* name)
08167 {
08168 if (this->optimization == NULL)
08169 this->optimization = new OptimizationOption();
08170 if (this->optimization->objectives == NULL)
08171 this->optimization->objectives = new ObjectiveOption();
08172 if (this->optimization->objectives->initialObjectiveBounds != NULL)
08173 return false;
08174
08175 this->optimization->objectives->initialObjectiveBounds = new InitObjectiveBounds();
08176
08177 return this->optimization->objectives->initialObjectiveBounds->setObj(numberOfObj, idx, lbValue, ubValue, name);
08178 }
08179
08180 bool OSOption::setInitObjBoundsSparse(int numberOfObj, InitObjBound** obj)
08181 {
08182 if (this->optimization == NULL)
08183 this->optimization = new OptimizationOption();
08184 if (this->optimization->objectives == NULL)
08185 this->optimization->objectives = new ObjectiveOption();
08186 if (this->optimization->objectives->initialObjectiveBounds == NULL)
08187 this->optimization->objectives->initialObjectiveBounds = new InitObjectiveBounds();
08188 else
08189 {
08190 int i;
08191 for (i = 0; i < this->optimization->objectives->initialObjectiveBounds->numberOfObj; i++)
08192 delete this->optimization->objectives->initialObjectiveBounds->obj[i];
08193 delete[] this->optimization->objectives->initialObjectiveBounds->obj;
08194 this->optimization->objectives->initialObjectiveBounds->obj = NULL;
08195 }
08196 return this->optimization->objectives->initialObjectiveBounds->setObj(numberOfObj, obj);
08197 }
08198
08199 bool OSOption::setInitObjBoundsDense(int numberOfObj, double* lb, double* ub)
08200 {
08201 if (this->optimization == NULL)
08202 this->optimization = new OptimizationOption();
08203 if (this->optimization->objectives == NULL)
08204 this->optimization->objectives = new ObjectiveOption();
08205 if (this->optimization->objectives->initialObjectiveBounds == NULL)
08206 this->optimization->objectives->initialObjectiveBounds = new InitObjectiveBounds();
08207 else
08208 {
08209 delete[] this->optimization->objectives->initialObjectiveBounds->obj;
08210 this->optimization->objectives->initialObjectiveBounds->obj = NULL;
08211 }
08212 int i;
08213 for (i = 0; i < numberOfObj; i++)
08214 {
08215 if (!this->optimization->objectives->initialObjectiveBounds->addObj(-1-i, lb[i], ub[i]))
08216 return false;
08217 }
08218 return true;
08219 }
08220
08221 bool OSOption::setAnotherInitObjBound(int idx, double lb, double ub)
08222 {
08223 if (this->optimization == NULL)
08224 this->optimization = new OptimizationOption();
08225 if (this->optimization->objectives == NULL)
08226 this->optimization->objectives = new ObjectiveOption();
08227 if (this->optimization->objectives->initialObjectiveBounds == NULL)
08228 this->optimization->objectives->initialObjectiveBounds = new InitObjectiveBounds();
08229 return this->optimization->objectives->initialObjectiveBounds->addObj(idx, lb, ub);
08230 }
08231
08232 bool OSOption::setOtherObjectiveOptionObj(int otherOptionNumber, int objNumber,
08233 int idx, std::string name, std::string value, std::string lbValue, std::string ubValue)
08234 {
08235 if (optimization == NULL) return false;
08236
08237 if (optimization->objectives == NULL) return false;
08238 if (optimization->objectives->other == NULL) return false;
08239 if (otherOptionNumber < 0 || otherOptionNumber >= optimization->objectives->numberOfOtherObjectiveOptions) return false;
08240 if (optimization->objectives->other[otherOptionNumber] == NULL) return false;
08241 if (idx >= 0) return false;
08242
08243 if (optimization->objectives->other[otherOptionNumber]->obj == NULL) return false;
08244 if (objNumber < 0 || objNumber >= optimization->objectives->other[otherOptionNumber]->numberOfObj) return false;
08245 if (optimization->objectives->other[otherOptionNumber]->obj[objNumber] == NULL) return false;
08246
08247 optimization->objectives->other[otherOptionNumber]->obj[objNumber]->idx = idx;
08248 optimization->objectives->other[otherOptionNumber]->obj[objNumber]->name = name;
08249 optimization->objectives->other[otherOptionNumber]->obj[objNumber]->value = value;
08250 optimization->objectives->other[otherOptionNumber]->obj[objNumber]->lbValue = lbValue;
08251 optimization->objectives->other[otherOptionNumber]->obj[objNumber]->ubValue = ubValue;
08252 return true;
08253 }
08254
08255 bool OSOption::setNumberOfOtherObjectiveOptions(int numberOfOther)
08256 {
08257 if (optimization == NULL) return false;
08258 if (optimization->objectives == NULL)
08259 optimization->objectives = new ObjectiveOption();
08260 if (optimization->objectives->numberOfOtherObjectiveOptions < 0) return false;
08261
08262 optimization->objectives->numberOfOtherObjectiveOptions = numberOfOther;
08263
08264 if (numberOfOther > 0)
08265 {
08266 optimization->objectives->other = new OtherObjectiveOption*[numberOfOther];
08267
08268 for (int j=0; j < numberOfOther; j++)
08269 optimization->objectives->other[j] = new OtherObjectiveOption();
08270 }
08271 return true;
08272
08273 }
08274
08275 bool OSOption::setOtherObjectiveOptionAttributes(int iOther, int numberOfObj,
08276 int numberOfEnumerations, std::string name,
08277 std::string value, std::string solver,
08278 std::string category, std::string type,
08279 std::string description)
08280 {
08281 if (optimization == NULL) return false;
08282 if (optimization->objectives == NULL) return false;
08283 if (optimization->objectives->other == NULL) return false;
08284
08285 if (iOther < 0 || iOther >= optimization->objectives->numberOfOtherObjectiveOptions) return false;
08286
08287 optimization->objectives->other[iOther]->numberOfObj = numberOfObj;
08288 optimization->objectives->other[iOther]->numberOfEnumerations = numberOfEnumerations;
08289 optimization->objectives->other[iOther]->name = name;
08290 optimization->objectives->other[iOther]->value = value;
08291 optimization->objectives->other[iOther]->solver = solver;
08292 optimization->objectives->other[iOther]->category = category;
08293 optimization->objectives->other[iOther]->type = type;
08294 optimization->objectives->other[iOther]->description = description;
08295
08296 if (numberOfObj > 0)
08297 {
08298 optimization->objectives->other[iOther]->obj = new OtherObjOption*[numberOfObj];
08299 for (int j=0; j<numberOfObj; j++)
08300 optimization->objectives->other[iOther]->obj[j] = new OtherObjOption();
08301 }
08302
08303 if (numberOfEnumerations > 0)
08304 {
08305 optimization->objectives->other[iOther]->enumeration = new OtherOptionEnumeration*[numberOfEnumerations];
08306 for (int j=0; j<numberOfEnumerations; j++)
08307 optimization->objectives->other[iOther]->enumeration[j] = new OtherOptionEnumeration();
08308 }
08309 return true;
08310 }
08311
08312 bool OSOption::setOtherObjectiveOptions(int numberOfOptions, OtherObjectiveOption** other)
08313 {
08314 if (this->optimization == NULL)
08315 this->optimization = new OptimizationOption();
08316 if (this->optimization->objectives == NULL)
08317 this->optimization->objectives = new ObjectiveOption();
08318 else
08319 {
08320 int i;
08321 for (i = 0; i < this->optimization->objectives->numberOfOtherObjectiveOptions; i++)
08322 delete this->optimization->objectives->other[i];
08323 delete[] this->optimization->objectives->other;
08324 this->optimization->objectives->other = NULL;
08325 }
08326 return this->optimization->objectives->setOther(numberOfOptions, other);
08327 }
08328
08329 bool OSOption::setAnOtherObjectiveOption(OtherObjectiveOption* optionValue)
08330 {
08331 if (this->optimization == NULL)
08332 this->optimization = new OptimizationOption();
08333 if (this->optimization->objectives == NULL)
08334 this->optimization->objectives = new ObjectiveOption();
08335 return this->optimization->objectives->addOther(optionValue);
08336 }
08337
08338
08339 bool OSOption::setInitConValues(int numberOfCon, int* idx, double* value, std::string* name)
08340 {
08341 if (this->optimization == NULL)
08342 this->optimization = new OptimizationOption();
08343 if (this->optimization->constraints == NULL)
08344 this->optimization->constraints = new ConstraintOption();
08345 if (this->optimization->constraints->initialConstraintValues != NULL)
08346 return false;
08347
08348 this->optimization->constraints->initialConstraintValues = new InitConstraintValues();
08349
08350 return this->optimization->constraints->initialConstraintValues->setCon(numberOfCon, idx, value, name);
08351 }
08352
08353
08354 bool OSOption::setInitConValuesSparse(int numberOfCon, InitConValue** con)
08355 {
08356 if (this->optimization == NULL)
08357 this->optimization = new OptimizationOption();
08358 if (this->optimization->constraints == NULL)
08359 this->optimization->constraints = new ConstraintOption();
08360 if (this->optimization->constraints->initialConstraintValues == NULL)
08361 this->optimization->constraints->initialConstraintValues = new InitConstraintValues();
08362 else
08363 {
08364 int i;
08365 for (i = 0; i < this->optimization->constraints->initialConstraintValues->numberOfCon; i++)
08366 delete this->optimization->constraints->initialConstraintValues->con[i];
08367 delete[] this->optimization->constraints->initialConstraintValues->con;
08368 this->optimization->constraints->initialConstraintValues->con = NULL;
08369 }
08370 return this->optimization->constraints->initialConstraintValues->setCon(numberOfCon, con);
08371 }
08372
08373 bool OSOption::setInitConValuesDense(int numberOfCon, double *value)
08374 {
08375 if (this->optimization == NULL)
08376 this->optimization = new OptimizationOption();
08377 if (this->optimization->constraints == NULL)
08378 this->optimization->constraints = new ConstraintOption();
08379 if (this->optimization->constraints->initialConstraintValues == NULL)
08380 this->optimization->constraints->initialConstraintValues = new InitConstraintValues();
08381 else
08382 {
08383 delete[] this->optimization->constraints->initialConstraintValues->con;
08384 this->optimization->constraints->initialConstraintValues->con = NULL;
08385 }
08386 int i;
08387 for (i = 0; i < numberOfCon; i++)
08388 {
08389
08390 if (!this->optimization->constraints->initialConstraintValues->addCon(i, value[i]))
08391 return false;
08392 }
08393 return true;
08394 }
08395
08396 bool OSOption::setAnotherInitConValue(int idx, double value)
08397 {
08398 if (this->optimization == NULL)
08399 this->optimization = new OptimizationOption();
08400 if (this->optimization->constraints == NULL)
08401 this->optimization->constraints = new ConstraintOption();
08402 if (this->optimization->constraints->initialConstraintValues == NULL)
08403 this->optimization->constraints->initialConstraintValues = new InitConstraintValues();
08404 return this->optimization->constraints->initialConstraintValues->addCon(idx, value);
08405 }
08406
08407 bool OSOption::setInitDualValues(int numberOfCon, int* idx, double* lbValue, double* ubValue, std::string* name)
08408 {
08409 if (this->optimization == NULL)
08410 this->optimization = new OptimizationOption();
08411 if (this->optimization->constraints == NULL)
08412 this->optimization->constraints = new ConstraintOption();
08413 if (this->optimization->constraints->initialDualValues != NULL)
08414 return false;
08415
08416 this->optimization->constraints->initialDualValues = new InitDualVariableValues();
08417
08418 return this->optimization->constraints->initialDualValues->setCon(numberOfCon, idx, lbValue, ubValue, name);
08419 }
08420
08421
08422 bool OSOption::setInitDualVarValuesSparse(int numberOfCon, InitDualVarValue** con)
08423 {
08424 if (this->optimization == NULL)
08425 this->optimization = new OptimizationOption();
08426 if (this->optimization->constraints == NULL)
08427 this->optimization->constraints = new ConstraintOption();
08428 if (this->optimization->constraints->initialDualValues == NULL)
08429 this->optimization->constraints->initialDualValues = new InitDualVariableValues();
08430 else
08431 {
08432 int i;
08433 for (i = 0; i < this->optimization->constraints->initialDualValues->numberOfCon; i++)
08434 delete this->optimization->constraints->initialDualValues->con[i];
08435 delete[] this->optimization->constraints->initialDualValues->con;
08436 this->optimization->constraints->initialDualValues->con = NULL;
08437 }
08438 return this->optimization->constraints->initialDualValues->setCon(numberOfCon, con);
08439 }
08440
08441 bool OSOption::setInitDualVarValuesDense(int numberOfCon, double* lb, double* ub)
08442 {
08443 if (this->optimization == NULL)
08444 this->optimization = new OptimizationOption();
08445 if (this->optimization->constraints == NULL)
08446 this->optimization->constraints = new ConstraintOption();
08447 if (this->optimization->constraints->initialDualValues == NULL)
08448 this->optimization->constraints->initialDualValues = new InitDualVariableValues();
08449 else
08450 {
08451 delete[] this->optimization->constraints->initialDualValues->con;
08452 this->optimization->constraints->initialDualValues->con = NULL;
08453 }
08454 int i;
08455 for (i = 0; i < numberOfCon; i++)
08456 {
08457 if ((lb[i] != 0.0) || (ub[i] != 0.0))
08458 if (!this->optimization->constraints->initialDualValues->addCon(i, lb[i], ub[i]))
08459 return false;
08460 }
08461 return true;
08462 }
08463
08464 bool OSOption::setAnotherInitDualVarValue(int idx, double lbValue, double ubValue)
08465 {
08466 if (this->optimization == NULL)
08467 this->optimization = new OptimizationOption();
08468 if (this->optimization->constraints == NULL)
08469 this->optimization->constraints = new ConstraintOption();
08470 if (this->optimization->constraints->initialDualValues == NULL)
08471 this->optimization->constraints->initialDualValues = new InitDualVariableValues();
08472 return this->optimization->constraints->initialDualValues->addCon(idx, lbValue, ubValue);
08473 }
08474
08475 bool OSOption::setNumberOfOtherConstraintOptions(int numberOfOther)
08476 {
08477 if (optimization == NULL) return false;
08478 if (optimization->constraints == NULL)
08479 optimization->constraints = new ConstraintOption();
08480 if (optimization->constraints->numberOfOtherConstraintOptions < 0) return false;
08481
08482 optimization->constraints->numberOfOtherConstraintOptions = numberOfOther;
08483
08484 if (numberOfOther > 0)
08485 {
08486 optimization->constraints->other = new OtherConstraintOption*[numberOfOther];
08487
08488 for (int j=0; j < numberOfOther; j++)
08489 optimization->constraints->other[j] = new OtherConstraintOption();
08490 }
08491
08492 return true;
08493 }
08494
08495 bool OSOption::setOtherConstraintOptionAttributes(int iOther, int numberOfCon,
08496 int numberOfEnumerations, std::string name,
08497 std::string value, std::string solver,
08498 std::string category, std::string type,
08499 std::string description)
08500 {
08501 if (optimization == NULL) return false;
08502 if (optimization->constraints == NULL) return false;
08503 if (optimization->constraints->other == NULL) return false;
08504 if (iOther < 0 || iOther >= optimization->constraints->numberOfOtherConstraintOptions) return false;
08505
08506 optimization->constraints->other[iOther]->numberOfCon = numberOfCon;
08507 optimization->constraints->other[iOther]->numberOfEnumerations = numberOfEnumerations;
08508 optimization->constraints->other[iOther]->name = name;
08509 optimization->constraints->other[iOther]->value = value;
08510 optimization->constraints->other[iOther]->solver = solver;
08511 optimization->constraints->other[iOther]->category = category;
08512 optimization->constraints->other[iOther]->type = type;
08513 optimization->constraints->other[iOther]->description = description;
08514
08515 if (numberOfCon > 0)
08516 {
08517 optimization->constraints->other[iOther]->con = new OtherConOption*[numberOfCon];
08518 for (int j=0; j<numberOfCon; j++)
08519 optimization->constraints->other[iOther]->con[j] = new OtherConOption();
08520 }
08521
08522 if (numberOfEnumerations > 0)
08523 {
08524 optimization->constraints->other[iOther]->enumeration = new OtherOptionEnumeration*[numberOfEnumerations];
08525 for (int j=0; j<numberOfEnumerations; j++)
08526 optimization->constraints->other[iOther]->enumeration[j] = new OtherOptionEnumeration();
08527 }
08528 return true;
08529 }
08530
08531
08532 bool OSOption::setOtherConstraintOptionCon(int otherOptionNumber, int conNumber,
08533 int idx, std::string name, std::string value, std::string lbValue, std::string ubValue)
08534 {
08535 if (optimization == NULL) return false;
08536
08537 if (optimization->constraints == NULL) return false;
08538 if (optimization->constraints->other == NULL) return false;
08539 if (otherOptionNumber < 0 || otherOptionNumber >= optimization->constraints->numberOfOtherConstraintOptions) return false;
08540 if (optimization->constraints->other[otherOptionNumber] == NULL) return false;
08541 if (idx < 0) return false;
08542
08543 if (optimization->constraints->other[otherOptionNumber]->con == NULL) return false;
08544 if (conNumber < 0 || conNumber >= optimization->constraints->other[otherOptionNumber]->numberOfCon) return false;
08545 if (optimization->constraints->other[otherOptionNumber]->con[conNumber] == NULL) return false;
08546
08547 optimization->constraints->other[otherOptionNumber]->con[conNumber]->idx = idx;
08548 optimization->constraints->other[otherOptionNumber]->con[conNumber]->name = name;
08549 optimization->constraints->other[otherOptionNumber]->con[conNumber]->value = value;
08550 optimization->constraints->other[otherOptionNumber]->con[conNumber]->lbValue = lbValue;
08551 optimization->constraints->other[otherOptionNumber]->con[conNumber]->ubValue = ubValue;
08552 return true;
08553 }
08554
08555
08556
08557 bool OSOption::setOtherConstraintOptions(int numberOfOptions, OtherConstraintOption** other)
08558 {
08559 if (this->optimization == NULL)
08560 this->optimization = new OptimizationOption();
08561 if (this->optimization->constraints == NULL)
08562 this->optimization->constraints = new ConstraintOption();
08563 else
08564 {
08565 int i;
08566 for (i = 0; i < this->optimization->constraints->numberOfOtherConstraintOptions; i++)
08567 delete this->optimization->constraints->other[i];
08568 delete[] this->optimization->constraints->other;
08569 this->optimization->constraints->other = NULL;
08570 }
08571 return this->optimization->constraints->setOther(numberOfOptions, other);
08572 }
08573
08574 bool OSOption::setAnOtherConstraintOption(OtherConstraintOption* optionValue)
08575 {
08576 if (this->optimization == NULL)
08577 this->optimization = new OptimizationOption();
08578 if (this->optimization->constraints == NULL)
08579 this->optimization->constraints = new ConstraintOption();
08580 return this->optimization->constraints->addOther(optionValue);
08581 }
08582
08583
08584 bool OSOption::setNumberOfSolverOptions(int numberOfOptions)
08585 {
08586 if (optimization == NULL) return false;
08587 if (optimization->solverOptions != NULL) return false;
08588
08589 optimization->solverOptions = new SolverOptions();
08590 optimization->solverOptions->numberOfSolverOptions = numberOfOptions;
08591 optimization->solverOptions->solverOption = new SolverOption*[numberOfOptions];
08592
08593 for (int j=0; j < numberOfOptions; j++)
08594 optimization->solverOptions->solverOption[j] = new SolverOption();
08595 return true;
08596 }
08597
08598 bool OSOption::setSolverOptionContent(int iOption, int numberOfItems,
08599 std::string name,
08600 std::string value, std::string solver,
08601 std::string category, std::string type,
08602 std::string description, std::string *itemList)
08603 {
08604 if (optimization == NULL) return false;
08605 if (optimization->solverOptions == NULL) return false;
08606 if (optimization->solverOptions->solverOption == NULL) return false;
08607
08608 if (iOption < 0 || iOption >= optimization->solverOptions->numberOfSolverOptions) return false;
08609
08610 optimization->solverOptions->solverOption[iOption]->numberOfItems = numberOfItems;
08611 optimization->solverOptions->solverOption[iOption]->name = name;
08612 optimization->solverOptions->solverOption[iOption]->value = value;
08613 optimization->solverOptions->solverOption[iOption]->solver = solver;
08614 optimization->solverOptions->solverOption[iOption]->category = category;
08615 optimization->solverOptions->solverOption[iOption]->type = type;
08616 optimization->solverOptions->solverOption[iOption]->description = description;
08617
08618 if (numberOfItems > 0)
08619 {
08620 optimization->solverOptions->solverOption[iOption]->item = new std::string[numberOfItems];
08621 for (int j=0; j<numberOfItems; j++)
08622 optimization->solverOptions->solverOption[iOption]->item[j] = itemList[j];
08623 }
08624
08625 return true;
08626 }
08627
08628 bool OSOption::setSolverOptions(int numberOfSolverOptions, SolverOption** solverOption)
08629 {
08630 if (this->optimization == NULL)
08631 this->optimization = new OptimizationOption();
08632 if (this->optimization->solverOptions == NULL)
08633 this->optimization->solverOptions = new SolverOptions();
08634 else
08635 {
08636 int i;
08637 for (i = 0; i < this->optimization->solverOptions->numberOfSolverOptions; i++)
08638 delete this->optimization->solverOptions->solverOption[i];
08639 delete[] this->optimization->solverOptions->solverOption;
08640 this->optimization->solverOptions->solverOption = NULL;
08641 }
08642 return this->optimization->solverOptions->setSolverOptions(numberOfSolverOptions, solverOption);
08643 }
08644
08645 bool OSOption::setAnotherSolverOption(std::string name, std::string value, std::string solver,
08646 std::string category, std::string type, std::string description)
08647 {
08648 if (this->optimization == NULL)
08649 this->optimization = new OptimizationOption();
08650 if (this->optimization->solverOptions == NULL)
08651 this->optimization->solverOptions = new SolverOptions();
08652 return this->optimization->solverOptions->addSolverOption(name, value, solver, category, type, description);
08653 }
08654
08655
08656 bool OSOption::setOptionStr(std::string optionName, std::string optionValue)
08657 {
08658 if (optionName == "serviceURI")
08659 return this->setServiceURI(optionValue);
08660
08661 if (optionName == "serviceName")
08662 return this->setServiceName(optionValue);
08663
08664 if (optionName == "instanceName")
08665 return this->setInstanceName(optionValue);
08666
08667 if (optionName == "instanceLocation")
08668 return this->setInstanceLocation(optionValue);
08669
08670 if (optionName == "locationType")
08671 return this->setInstanceLocationType(optionValue);
08672
08673 if (optionName == "jobID")
08674 return this->setJobID(optionValue);
08675
08676 if (optionName == "solverName")
08677 return this->setSolverToInvoke(optionValue);
08678
08679 if (optionName == "solverToInvoke")
08680 return this->setSolverToInvoke(optionValue);
08681
08682 if (optionName == "license")
08683 return this->setLicense(optionValue);
08684
08685 if (optionName == "userName")
08686 return this->setUserName(optionValue);
08687
08688 if (optionName == "password")
08689 return this->setPassword(optionValue);
08690
08691 if (optionName == "contact")
08692 return this->setContact(optionValue);
08693
08694 if (optionName == "transportType")
08695 return this->setContactTransportType(optionValue);
08696
08697 if (optionName == "minDiskSpaceUnit")
08698 return this->setMinDiskSpaceUnit(optionValue);
08699
08700 if (optionName == "minMemoryUnit")
08701 return this->setMinMemoryUnit(optionValue);
08702
08703 if (optionName == "minCPUSpeedUnit")
08704 return this->setMinCPUSpeedUnit(optionValue);
08705
08706 if (optionName == "serviceType")
08707 return this->setServiceType(optionValue);
08708
08709 if (optionName == "maxTimeUnit")
08710 return this->setMaxTimeUnit(optionValue);
08711
08712 if (optionName == "requestedStartTime")
08713 return this->setRequestedStartTime(optionValue);
08714
08715 return false;
08716 }
08717
08718
08719 bool OSOption::setOptionInt(std::string optionName, int optionValue)
08720 {
08721 if (optionName == "minCPUNumber")
08722 return this->setMinCPUNumber(optionValue);
08723
08724 return false;
08725 }
08726
08727
08728 bool OSOption::setOptionDbl(std::string optionName, double value)
08729 {
08730 if (optionName == "minDiskSpaceValue")
08731 return this->setMinDiskSpace(value);
08732
08733 if (optionName == "minMemoryValue")
08734 return this->setMinMemorySize(value);
08735
08736 if (optionName == "minCPUSpeedValue")
08737 return this->setMinCPUSpeed(value);
08738
08739 if (optionName == "maxTime")
08740 return this->setMaxTime(value);
08741
08742 return false;
08743 }
08744
08745
08746
08747
08748
08749 bool OSOption::IsEqual(OSOption *that)
08750 {
08751 #ifdef DEBUG_OSOPTION
08752 cout << "Start comparing in OSOption" << endl;
08753 #endif
08754 if (this == NULL)
08755 {
08756 if (that == NULL)
08757 return true;
08758 else
08759 {
08760 #ifdef DEBUG_OSOPTION
08761 cout << "First object is NULL, second is not" << endl;
08762 #endif
08763 return false;
08764 }
08765 }
08766 else
08767 {
08768 if (that == NULL)
08769 {
08770 #ifdef DEBUG_OSOPTION
08771 cout << "Second object is NULL, first is not" << endl;
08772 #endif
08773 return false;
08774 }
08775 else
08776 {
08777 if (!this->optionHeader->IsEqual(that->optionHeader))
08778 return false;
08779 if (!this->general->IsEqual(that->general))
08780 return false;
08781 if (!this->system->IsEqual(that->system))
08782
08783 return false;
08784 if (!this->service->IsEqual(that->service))
08785 return false;
08786 if (!this->job->IsEqual(that->job))
08787 return false;
08788 if (!this->optimization->IsEqual(that->optimization))
08789 return false;
08790 return true;
08791 }
08792 }
08793 }
08794
08795
08796 bool GeneralOption::IsEqual(GeneralOption *that)
08797 {
08798 #ifdef DEBUG_OSOPTION
08799 cout << "Start comparing in GeneralOption" << endl;
08800 #endif
08801 if (this == NULL)
08802 {
08803 if (that == NULL)
08804 return true;
08805 else
08806 {
08807 #ifdef DEBUG_OSOPTION
08808 cout << "First object is NULL, second is not" << endl;
08809 #endif
08810 return false;
08811 }
08812 }
08813 else
08814 {
08815 if (that == NULL)
08816 {
08817 #ifdef DEBUG_OSOPTION
08818 cout << "Second object is NULL, first is not" << endl;
08819 #endif
08820 return false;
08821 }
08822 else
08823 {
08824 bool same;
08825 same = (this->serviceURI == that->serviceURI);
08826 same = ((this->serviceName == that->serviceName ) && same);
08827 same = ((this->instanceName == that->instanceName ) && same);
08828 same = ((this->jobID == that->jobID ) && same);
08829 same = ((this->solverToInvoke == that->solverToInvoke) && same);
08830 same = ((this->license == that->license ) && same);
08831 same = ((this->userName == that->userName ) && same);
08832 same = ((this->password == that->password ) && same);
08833 if (!same)
08834 {
08835 #ifdef DEBUG_OSOPTION
08836 cout << "serviceURI: " << this->serviceURI << " vs. " << that->serviceURI << endl;
08837 cout << "serviceName: " << this->serviceName << " vs. " << that->serviceName << endl;
08838 cout << "instanceName: " << this->instanceName << " vs. " << that->instanceName << endl;
08839 cout << "jobID: " << this->jobID << " vs. " << that->jobID << endl;
08840 cout << "solverToInvoke:" << this->solverToInvoke << " vs. " << that->solverToInvoke << endl;
08841 cout << "license: " << this->license << " vs. " << that->license << endl;
08842 cout << "userName: " << this->userName << " vs. " << that->userName << endl;
08843 cout << "password: " << this->password << " vs. " << that->password << endl;
08844 #endif
08845 return false;
08846 }
08847 if (!this->instanceLocation->IsEqual(that->instanceLocation))
08848 return false;
08849 if (!this->contact->IsEqual(that->contact))
08850 return false;
08851 if (!this->otherOptions->IsEqual(that->otherOptions))
08852 return false;
08853 return true;
08854 }
08855 }
08856 }
08857
08858
08859 bool SystemOption::IsEqual(SystemOption *that)
08860 {
08861 #ifdef DEBUG_OSOPTION
08862 cout << "Start comparing in SystemOption" << endl;
08863 #endif
08864 if (this == NULL)
08865 {
08866 if (that == NULL)
08867 return true;
08868 else
08869 {
08870 #ifdef DEBUG_OSOPTION
08871 cout << "First object is NULL, second is not" << endl;
08872 #endif
08873 return false;
08874 }
08875 }
08876 else
08877 {
08878 if (that == NULL)
08879 {
08880 #ifdef DEBUG_OSOPTION
08881 cout << "Second object is NULL, first is not" << endl;
08882 #endif
08883 return false;
08884 }
08885 else
08886 {
08887 if (!this->minDiskSpace->IsEqual(that->minDiskSpace))
08888 return false;
08889 if (!this->minMemorySize->IsEqual(that->minMemorySize))
08890 return false;
08891 if (!this->minCPUSpeed->IsEqual(that->minCPUSpeed))
08892 return false;
08893 if (!this->minCPUNumber->IsEqual(that->minCPUNumber))
08894 return false;
08895 if (!this->otherOptions->IsEqual(that->otherOptions))
08896 return false;
08897 return true;
08898 }
08899 }
08900 }
08901
08902
08903 bool ServiceOption::IsEqual(ServiceOption *that)
08904 {
08905 #ifdef DEBUG_OSOPTION
08906 cout << "Start comparing in ServiceOption" << endl;
08907 #endif
08908 if (this == NULL)
08909 {
08910 if (that == NULL)
08911 return true;
08912 else
08913 {
08914 #ifdef DEBUG_OSOPTION
08915 cout << "First object is NULL, second is not" << endl;
08916 #endif
08917 return false;
08918 }
08919 }
08920 else
08921 {
08922 if (that == NULL)
08923 {
08924 #ifdef DEBUG_OSOPTION
08925 cout << "Second object is NULL, first is not" << endl;
08926 #endif
08927 return false;
08928 }
08929 else
08930 {
08931 if (this->type != that->type)
08932 {
08933 #ifdef DEBUG_OSOPTION
08934 cout << "service type: " << this->type << " vs. " << that->type << endl;
08935 #endif
08936 return false;
08937 }
08938
08939 if (!this->otherOptions->IsEqual(that->otherOptions))
08940 return false;
08941 return true;
08942 }
08943 }
08944 }
08945
08946
08947 bool JobOption::IsEqual(JobOption *that)
08948 {
08949 #ifdef DEBUG_OSOPTION
08950 cout << "Start comparing in JobOption" << endl;
08951 #endif
08952 if (this == NULL)
08953 {
08954 if (that == NULL)
08955 return true;
08956 else
08957 {
08958 #ifdef DEBUG_OSOPTION
08959 cout << "First object is NULL, second is not" << endl;
08960 #endif
08961 return false;
08962 }
08963 }
08964 else
08965 {
08966 if (that == NULL)
08967 {
08968 #ifdef DEBUG_OSOPTION
08969 cout << "Second object is NULL, first is not" << endl;
08970 #endif
08971 return false;
08972 }
08973 else
08974 {
08975 if (this->requestedStartTime != that->requestedStartTime)
08976 {
08977 #ifdef DEBUG_OSOPTION
08978 cout << "requestedStartTime: " << this->requestedStartTime << " vs. " << that->requestedStartTime << endl;
08979 #endif
08980 return false;
08981 }
08982
08983 if (!this->maxTime->IsEqual(that->maxTime))
08984 return false;
08985 if (!this->dependencies->IsEqual(that->dependencies))
08986 return false;
08987 if (!this->requiredDirectories->IsEqual(that->requiredDirectories))
08988 return false;
08989 if (!this->requiredFiles->IsEqual(that->requiredFiles))
08990 return false;
08991 if (!this->directoriesToMake->IsEqual(that->directoriesToMake))
08992 return false;
08993 if (!this->filesToMake->IsEqual(that->filesToMake))
08994 return false;
08995 if (!this->inputDirectoriesToMove->IsEqual(that->inputDirectoriesToMove))
08996 return false;
08997 if (!this->inputFilesToMove->IsEqual(that->inputFilesToMove))
08998 return false;
08999 if (!this->outputFilesToMove->IsEqual(that->outputFilesToMove))
09000 return false;
09001 if (!this->outputDirectoriesToMove->IsEqual(that->outputDirectoriesToMove))
09002 return false;
09003 if (!this->filesToDelete->IsEqual(that->filesToDelete))
09004 return false;
09005 if (!this->directoriesToDelete->IsEqual(that->directoriesToDelete))
09006 return false;
09007 if (!this->processesToKill->IsEqual(that->processesToKill))
09008 return false;
09009 if (!this->otherOptions->IsEqual(that->otherOptions))
09010 return false;
09011 return true;
09012 }
09013 }
09014 }
09015
09016 bool OptimizationOption::IsEqual(OptimizationOption *that)
09017 {
09018 #ifdef DEBUG_OSOPTION
09019 cout << "Start comparing in OptimizationOption" << endl;
09020 #endif
09021 if (this == NULL)
09022 {
09023 if (that == NULL)
09024 return true;
09025 else
09026 {
09027 #ifdef DEBUG_OSOPTION
09028 cout << "First object is NULL, second is not" << endl;
09029 #endif
09030 return false;
09031 }
09032 }
09033 else
09034 {
09035 if (that == NULL)
09036 {
09037 #ifdef DEBUG_OSOPTION
09038 cout << "Second object is NULL, first is not" << endl;
09039 #endif
09040 return false;
09041 }
09042 else
09043 {
09044 if ((this->numberOfVariables != that->numberOfVariables) &&
09045 (this->numberOfVariables * that->numberOfVariables) != 0)
09046 {
09047 #ifdef DEBUG_OSOPTION
09048 cout << "numberOfVariables: "
09049 << this->numberOfVariables << " vs. " << that->numberOfVariables << endl;
09050 #endif
09051 return false;
09052 }
09053 if ((this->numberOfObjectives != that->numberOfObjectives) &&
09054 (this->numberOfObjectives * that->numberOfObjectives) != 0)
09055 {
09056 #ifdef DEBUG_OSOPTION
09057 cout << "numberOfObjectives: "
09058 << this->numberOfObjectives << " vs. " << that->numberOfObjectives << endl;
09059 #endif
09060 return false;
09061 }
09062 if ((this->numberOfConstraints != that->numberOfConstraints) &&
09063 (this->numberOfConstraints * that->numberOfConstraints) != 0)
09064 {
09065 #ifdef DEBUG_OSOPTION
09066 cout << "numberOfConstraints: "
09067 << this->numberOfConstraints << " vs. " << that->numberOfConstraints << endl;
09068 #endif
09069 return false;
09070 }
09071
09072 if (!this->variables->IsEqual(that->variables))
09073 return false;
09074 if (!this->objectives->IsEqual(that->objectives))
09075 return false;
09076 if (!this->constraints->IsEqual(that->constraints))
09077 return false;
09078 if (!this->solverOptions->IsEqual(that->solverOptions))
09079 return false;
09080 return true;
09081 }
09082 }
09083 }
09084
09085 bool InstanceLocationOption::IsEqual(InstanceLocationOption *that)
09086 {
09087 #ifdef DEBUG_OSOPTION
09088 cout << "Start comparing in InstanceLocationOption" << endl;
09089 #endif
09090 if (this == NULL)
09091 {
09092 if (that == NULL)
09093 return true;
09094 else
09095 {
09096 #ifdef DEBUG_OSOPTION
09097 cout << "First object is NULL, second is not" << endl;
09098 #endif
09099 return false;
09100 }
09101 }
09102 else
09103 {
09104 if (that == NULL)
09105 {
09106 #ifdef DEBUG_OSOPTION
09107 cout << "Second object is NULL, first is not" << endl;
09108 #endif
09109 return false;
09110 }
09111 else
09112 {
09113 if ((this->locationType != that->locationType) || (this->value != that->value))
09114 {
09115 #ifdef DEBUG_OSOPTION
09116 cout << "location type: " << this->locationType << " vs. " << that->locationType << endl;
09117 cout << "value: " << this->value << " vs. " << that->value << endl;
09118 #endif
09119 return false;
09120 }
09121 return true;
09122 }
09123 }
09124 }
09125
09126 bool ContactOption::IsEqual(ContactOption *that)
09127 {
09128 #ifdef DEBUG_OSOPTION
09129 cout << "Start comparing in ContactOption" << endl;
09130 #endif
09131 if (this == NULL)
09132 {
09133 if (that == NULL)
09134 return true;
09135 else
09136 {
09137 #ifdef DEBUG_OSOPTION
09138 cout << "First object is NULL, second is not" << endl;
09139 #endif
09140 return false;
09141 }
09142 }
09143 else
09144 {
09145 if (that == NULL)
09146 {
09147 #ifdef DEBUG_OSOPTION
09148 cout << "Second object is NULL, first is not" << endl;
09149 #endif
09150 return false;
09151 }
09152 else
09153 {
09154 if ((this->transportType != that->transportType) || (this->value != that->value))
09155 {
09156 #ifdef DEBUG_OSOPTION
09157 cout << "transport type: " << this->transportType << " vs. " << that->transportType << endl;
09158 cout << "value: " << this->value << " vs. " << that->value << endl;
09159 #endif
09160 return false;
09161 }
09162 return true;
09163 }
09164 }
09165 }
09166
09167 bool OtherOptions::IsEqual(OtherOptions *that)
09168 {
09169 #ifdef DEBUG_OSOPTION
09170 cout << "Start comparing in OtherOptions" << endl;
09171 #endif
09172 if (this == NULL)
09173 {
09174 if (that == NULL)
09175 return true;
09176 else
09177 {
09178 #ifdef DEBUG_OSOPTION
09179 cout << "First object is NULL, second is not" << endl;
09180 #endif
09181 return false;
09182 }
09183 }
09184 else
09185 {
09186 if (that == NULL)
09187 {
09188 #ifdef DEBUG_OSOPTION
09189 cout << "Second object is NULL, first is not" << endl;
09190 #endif
09191 return false;
09192 }
09193 else
09194 {
09195 if (this->numberOfOtherOptions != that->numberOfOtherOptions)
09196 {
09197 #ifdef DEBUG_OSOPTION
09198 cout << "numberOfOtherOptions: " << this->numberOfOtherOptions << " vs. " << that->numberOfOtherOptions << endl;
09199 #endif
09200 return false;
09201 }
09202 int i;
09203 for (i = 0; i < this->numberOfOtherOptions; i++)
09204 if (!this->other[i]->IsEqual(that->other[i]))
09205 return false;
09206 return true;
09207 }
09208 }
09209 }
09210
09211
09212 bool OtherOption::IsEqual(OtherOption *that)
09213 {
09214 #ifdef DEBUG_OSOPTION
09215 cout << "Start comparing in OtherOption" << endl;
09216 #endif
09217 if (this == NULL)
09218 {
09219 if (that == NULL)
09220 return true;
09221 else
09222 {
09223 #ifdef DEBUG_OSOPTION
09224 cout << "First object is NULL, second is not" << endl;
09225 #endif
09226 return false;
09227 }
09228 }
09229 else
09230 {
09231 if (that == NULL)
09232 {
09233 #ifdef DEBUG_OSOPTION
09234 cout << "Second object is NULL, first is not" << endl;
09235 #endif
09236 return false;
09237 }
09238 else
09239 {
09240 if ((this->name != that->name) ||
09241 (this->value != that->value) ||
09242 (this->description != that->description) )
09243 {
09244 #ifdef DEBUG_OSOPTION
09245 cout << "name: " << this->name << " vs. " << that->name << endl;
09246 cout << "value: " << this->value << " vs. " << that->value << endl;
09247 cout << "description: " << this->description << " vs. " << that->description << endl;
09248 #endif
09249 return false;
09250 }
09251 return true;
09252 }
09253 }
09254 }
09255
09256 bool MinDiskSpace::IsEqual(MinDiskSpace *that)
09257 {
09258 #ifdef DEBUG_OSOPTION
09259 cout << "Start comparing in MinDiskSpace" << endl;
09260 #endif
09261 if (this == NULL)
09262 {
09263 if (that == NULL)
09264 return true;
09265 else
09266 {
09267 #ifdef DEBUG_OSOPTION
09268 cout << "First object is NULL, second is not" << endl;
09269 #endif
09270 return false;
09271 }
09272 }
09273 else
09274 {
09275 if (that == NULL)
09276 {
09277 #ifdef DEBUG_OSOPTION
09278 cout << "Second object is NULL, first is not" << endl;
09279 #endif
09280 return false;
09281 }
09282 else
09283 {
09284 if ((this->unit != that->unit) ||
09285 !isEqual(this->value, that->value) ||
09286 (this->description != that->description) )
09287 {
09288 #ifdef DEBUG_OSOPTION
09289 cout << "unit: " << this->unit << " vs. " << that->unit << endl;
09290 cout << "value: " << this->value << " vs. " << that->value << endl;
09291 cout << "description: " << this->description << " vs. " << that->description << endl;
09292 #endif
09293 return false;
09294 }
09295 return true;
09296 }
09297 }
09298 }
09299
09300 bool MinMemorySize::IsEqual(MinMemorySize *that)
09301 {
09302 #ifdef DEBUG_OSOPTION
09303 cout << "Start comparing in MinMemorySize" << endl;
09304 #endif
09305 if (this == NULL)
09306 {
09307 if (that == NULL)
09308 return true;
09309 else
09310 {
09311 #ifdef DEBUG_OSOPTION
09312 cout << "First object is NULL, second is not" << endl;
09313 #endif
09314 return false;
09315 }
09316 }
09317 else
09318 {
09319 if (that == NULL)
09320 {
09321 #ifdef DEBUG_OSOPTION
09322 cout << "Second object is NULL, first is not" << endl;
09323 #endif
09324 return false;
09325 }
09326 else
09327 {
09328 if ((this->unit != that->unit) ||
09329 !isEqual(this->value, that->value) ||
09330 (this->description != that->description) )
09331 {
09332 #ifdef DEBUG_OSOPTION
09333 cout << "unit: " << this->unit << " vs. " << that->unit << endl;
09334 cout << "value: " << this->value << " vs. " << that->value << endl;
09335 #endif
09336 return false;
09337 }
09338 return true;
09339 }
09340 }
09341 }
09342
09343 bool MinCPUSpeed::IsEqual(MinCPUSpeed *that)
09344 {
09345 #ifdef DEBUG_OSOPTION
09346 cout << "Start comparing in MinCPUSpeed" << endl;
09347 #endif
09348 if (this == NULL)
09349 {
09350 if (that == NULL)
09351 return true;
09352 else
09353 {
09354 #ifdef DEBUG_OSOPTION
09355 cout << "First object is NULL, second is not" << endl;
09356 #endif
09357 return false;
09358 }
09359 }
09360 else
09361 {
09362 if (that == NULL)
09363 {
09364 #ifdef DEBUG_OSOPTION
09365 cout << "Second object is NULL, first is not" << endl;
09366 #endif
09367 return false;
09368 }
09369 else
09370 {
09371 if ((this->unit != that->unit) ||
09372 !isEqual(this->value, that->value) ||
09373 (this->description != that->description) )
09374 {
09375 #ifdef DEBUG_OSOPTION
09376 cout << "unit: " << this->unit << " vs. " << that->unit << endl;
09377 cout << "value: " << this->value << " vs. " << that->value << endl;
09378 #endif
09379 return false;
09380 }
09381 return true;
09382 }
09383 }
09384 }
09385
09386 bool MinCPUNumber::IsEqual(MinCPUNumber *that)
09387 {
09388 #ifdef DEBUG_OSOPTION
09389 cout << "Start comparing in MinCPUNumber" << endl;
09390 #endif
09391 if (this == NULL)
09392 {
09393 if (that == NULL)
09394 return true;
09395 else
09396 {
09397 #ifdef DEBUG_OSOPTION
09398 cout << "First object is NULL, second is not" << endl;
09399 #endif
09400 return false;
09401 }
09402 }
09403 else
09404 {
09405 if (that == NULL)
09406 {
09407 #ifdef DEBUG_OSOPTION
09408 cout << "Second object is NULL, first is not" << endl;
09409 #endif
09410 return false;
09411 }
09412 else
09413 {
09414 if ((this->description != that->description) ||
09415 (this->value != that->value) )
09416 {
09417 #ifdef DEBUG_OSOPTION
09418 cout << "description: " << this->description << " vs. " << that->description << endl;
09419 cout << "value: " << this->value << " vs. " << that->value << endl;
09420 #endif
09421 return false;
09422 }
09423 return true;
09424 }
09425 }
09426 }
09427
09428 bool JobDependencies::IsEqual(JobDependencies *that)
09429 {
09430 #ifdef DEBUG_OSOPTION
09431 cout << "Start comparing in JobDependencies" << endl;
09432 #endif
09433 if (this == NULL)
09434 {
09435 if (that == NULL)
09436 return true;
09437 else
09438 {
09439 #ifdef DEBUG_OSOPTION
09440 cout << "First object is NULL, second is not" << endl;
09441 #endif
09442 return false;
09443 }
09444 }
09445 else
09446 {
09447 if (that == NULL)
09448 {
09449 #ifdef DEBUG_OSOPTION
09450 cout << "Second object is NULL, first is not" << endl;
09451 #endif
09452 return false;
09453 }
09454 else
09455 {
09456 if (this->numberOfJobIDs != that->numberOfJobIDs)
09457 {
09458 #ifdef DEBUG_OSOPTION
09459 cout << "numberOfJobIDs: " << this->numberOfJobIDs << " vs. " << that->numberOfJobIDs << endl;
09460 #endif
09461 return false;
09462 }
09463 int i;
09464 for (i = 0; i < numberOfJobIDs; i++)
09465 if (this->jobID[i] != that->jobID[i])
09466 {
09467 #ifdef DEBUG_OSOPTION
09468 cout << "jobID[" << i << "]: " << this->jobID[i] << " vs. " << that->jobID[i] << endl;
09469 #endif
09470 return false;
09471 }
09472 return true;
09473 }
09474 }
09475 }
09476
09477 bool DirectoriesAndFiles::IsEqual(DirectoriesAndFiles *that)
09478 {
09479 #ifdef DEBUG_OSOPTION
09480 cout << "Start comparing in DirectoriesAndFiles" << endl;
09481 #endif
09482 if (this == NULL)
09483 {
09484 if (that == NULL)
09485 return true;
09486 else
09487 {
09488 #ifdef DEBUG_OSOPTION
09489 cout << "First object is NULL, second is not" << endl;
09490 #endif
09491 return false;
09492 }
09493 }
09494 else
09495 {
09496 if (that == NULL)
09497 {
09498 #ifdef DEBUG_OSOPTION
09499 cout << "Second object is NULL, first is not" << endl;
09500 #endif
09501 return false;
09502 }
09503 else
09504 {
09505 if (this->numberOfPaths != that->numberOfPaths)
09506 {
09507 #ifdef DEBUG_OSOPTION
09508 cout << "numberOfPaths: " << this->numberOfPaths << " vs. " << that->numberOfPaths << endl;
09509 #endif
09510 return false;
09511 }
09512 int i;
09513 for (i = 0; i < numberOfPaths; i++)
09514 if (this->path[i] != that->path[i])
09515 {
09516 #ifdef DEBUG_OSOPTION
09517 cout << "path[" << i << "]: \'" << this->path[i] << "\' vs. \'" << that->path[i] << "\'" << endl;
09518 #endif
09519 return false;
09520 }
09521 return true;
09522 }
09523 }
09524 }
09525
09526 bool PathPairs::IsEqual(PathPairs *that)
09527 {
09528 #ifdef DEBUG_OSOPTION
09529 cout << "Start comparing in PathPairs" << endl;
09530 #endif
09531 if (this == NULL)
09532 {
09533 if (that == NULL)
09534 return true;
09535 else
09536 {
09537 #ifdef DEBUG_OSOPTION
09538 cout << "First object is NULL, second is not" << endl;
09539 #endif
09540 return false;
09541 }
09542 }
09543 else
09544 {
09545 if (that == NULL)
09546 {
09547 #ifdef DEBUG_OSOPTION
09548 cout << "Second object is NULL, first is not" << endl;
09549 #endif
09550 return false;
09551 }
09552 else
09553 {
09554 if (this->numberOfPathPairs != that->numberOfPathPairs)
09555 {
09556 #ifdef DEBUG_OSOPTION
09557 cout << "numberOfPathPairs: " << this->numberOfPathPairs << " vs. " << that->numberOfPathPairs << endl;
09558 #endif
09559 return false;
09560 }
09561 int i;
09562 for (i = 0; i < numberOfPathPairs; i++)
09563 if (!this->pathPair[i]->IsEqual(that->pathPair[i]))
09564 return false;
09565 return true;
09566 }
09567 }
09568 }
09569
09570
09571 bool PathPair::IsEqual(PathPair *that)
09572 {
09573 #ifdef DEBUG_OSOPTION
09574 cout << "Start comparing in PathPair" << endl;
09575 #endif
09576 if (this == NULL)
09577 {
09578 if (that == NULL)
09579 return true;
09580 else
09581 {
09582 #ifdef DEBUG_OSOPTION
09583 cout << "First object is NULL, second is not" << endl;
09584 #endif
09585 return false;
09586 }
09587 }
09588 else
09589 {
09590 if (that == NULL)
09591 {
09592 #ifdef DEBUG_OSOPTION
09593 cout << "Second object is NULL, first is not" << endl;
09594 #endif
09595 return false;
09596 }
09597 else
09598 {
09599 if ((this->from != that->from) || (this->to != that->to) ||
09600 (this->makeCopy != that->makeCopy))
09601 {
09602 #ifdef DEBUG_OSOPTION
09603 cout << "from: " << this->from << " vs. " << that->from << endl;
09604 cout << "to: " << this->to << " vs. " << that->to << endl;
09605 cout << "makeCopy: " << this->makeCopy << " vs. " << that->makeCopy << endl;
09606 #endif
09607 return false;
09608 }
09609 return true;
09610 }
09611 }
09612 }
09613
09614 bool Processes::IsEqual(Processes *that)
09615 {
09616 #ifdef DEBUG_OSOPTION
09617 cout << "Start comparing in Processes" << endl;
09618 #endif
09619 if (this == NULL)
09620 {
09621 if (that == NULL)
09622 return true;
09623 else
09624 {
09625 #ifdef DEBUG_OSOPTION
09626 cout << "First object is NULL, second is not" << endl;
09627 #endif
09628 return false;
09629 }
09630 }
09631 else
09632 {
09633 if (that == NULL)
09634 {
09635 #ifdef DEBUG_OSOPTION
09636 cout << "Second object is NULL, first is not" << endl;
09637 #endif
09638 return false;
09639 }
09640 else
09641 {
09642 if (this->numberOfProcesses != that->numberOfProcesses)
09643 {
09644 #ifdef DEBUG_OSOPTION
09645 cout << "numberOfProcesses: " << this->numberOfProcesses << " vs. " << that->numberOfProcesses << endl;
09646 #endif
09647 return false;
09648 }
09649 int i;
09650 for (i = 0; i < numberOfProcesses; i++)
09651 if (this->process[i] != that->process[i])
09652 {
09653 #ifdef DEBUG_OSOPTION
09654 cout << "process[" << i << "]: " << this->process[i] << " vs. " << that->process[i] << endl;
09655 #endif
09656 return false;
09657 }
09658 return true;
09659 }
09660 }
09661 }
09662
09663
09664 bool VariableOption::IsEqual(VariableOption *that)
09665 {
09666 #ifdef DEBUG_OSOPTION
09667 cout << "Start comparing in VariableOption" << endl;
09668 #endif
09669 if (this == NULL)
09670 {
09671 if (that == NULL)
09672 return true;
09673 else
09674 {
09675 #ifdef DEBUG_OSOPTION
09676 cout << "First object is NULL, second is not" << endl;
09677 #endif
09678 return false;
09679 }
09680 }
09681 else
09682 {
09683 if (that == NULL)
09684 {
09685 #ifdef DEBUG_OSOPTION
09686 cout << "Second object is NULL, first is not" << endl;
09687 #endif
09688 return false;
09689 }
09690 else
09691 {
09692 if (!this->initialVariableValues->IsEqual(that->initialVariableValues))
09693 return false;
09694 if (!this->initialVariableValuesString->IsEqual(that->initialVariableValuesString))
09695 return false;
09696 if (!this->initialBasisStatus->IsEqual(that->initialBasisStatus))
09697 return false;
09698 if (!this->integerVariableBranchingWeights->IsEqual(that->integerVariableBranchingWeights))
09699 return false;
09700 if (!this->sosVariableBranchingWeights->IsEqual(that->sosVariableBranchingWeights))
09701 return false;
09702
09703 if (this->numberOfOtherVariableOptions != that->numberOfOtherVariableOptions)
09704 {
09705 #ifdef DEBUG_OSOPTION
09706 cout << "numberOfOtherVariableOptions: " << this->numberOfOtherVariableOptions << " vs. " << that->numberOfOtherVariableOptions << endl;
09707 #endif
09708 return false;
09709 }
09710
09711 int i;
09712 for (i = 0; i < numberOfOtherVariableOptions; i++)
09713 if (!this->other[i]->IsEqual(that->other[i]))
09714 {
09715 #ifdef DEBUG_OSOPTION
09716 cout << "other[" << i << "]: " << this->other[i] << " vs. " << that->other[i] << endl;
09717 #endif
09718 return false;
09719 }
09720
09721 return true;
09722 }
09723 }
09724 }
09725
09726 bool InitVariableValues::IsEqual(InitVariableValues *that)
09727 {
09728 #ifdef DEBUG_OSOPTION
09729 cout << "Start comparing in InitVariableValues" << endl;
09730 #endif
09731 if (this == NULL)
09732 {
09733 if (that == NULL)
09734 return true;
09735 else
09736 {
09737 #ifdef DEBUG_OSOPTION
09738 cout << "First object is NULL, second is not" << endl;
09739 #endif
09740 return false;
09741 }
09742 }
09743 else
09744 {
09745 if (that == NULL)
09746 {
09747 #ifdef DEBUG_OSOPTION
09748 cout << "Second object is NULL, first is not" << endl;
09749 #endif
09750 return false;
09751 }
09752 else
09753 {
09754 if (this->numberOfVar != that->numberOfVar)
09755 {
09756 #ifdef DEBUG_OSOPTION
09757 cout << "numberOfVar: " << this->numberOfVar << " vs. " << that->numberOfVar << endl;
09758 #endif
09759 return false;
09760 }
09761 int i;
09762 for (i = 0; i < numberOfVar; i++)
09763 if (!this->var[i]->IsEqual(that->var[i]))
09764 return false;
09765 return true;
09766 }
09767 }
09768 }
09769
09770 bool InitVarValue::IsEqual(InitVarValue *that)
09771 {
09772 #ifdef DEBUG_OSOPTION
09773 cout << "Start comparing in InitVarValue" << endl;
09774 #endif
09775 if (this == NULL)
09776 {
09777 if (that == NULL)
09778 return true;
09779 else
09780 {
09781 #ifdef DEBUG_OSOPTION
09782 cout << "First object is NULL, second is not" << endl;
09783 #endif
09784 return false;
09785 }
09786 }
09787 else
09788 {
09789 if (that == NULL)
09790 {
09791 #ifdef DEBUG_OSOPTION
09792 cout << "Second object is NULL, first is not" << endl;
09793 #endif
09794 return false;
09795 }
09796 else
09797 {
09798 if ((this->idx != that->idx) || this->name != that->name || !isEqual(this->value, that->value))
09799
09800 {
09801 #ifdef DEBUG_OSOPTION
09802 cout << "idx: " << this->idx << " vs. " << that->idx << endl;
09803 cout << "value: " << this->value << " vs. " << that->value << endl;
09804 #endif
09805 return false;
09806 }
09807 return true;
09808 }
09809 }
09810 }
09811
09812
09813 bool InitVariableValuesString::IsEqual(InitVariableValuesString *that)
09814 {
09815 #ifdef DEBUG_OSOPTION
09816 cout << "Start comparing in InitVariableValuesString" << endl;
09817 #endif
09818 if (this == NULL)
09819 {
09820 if (that == NULL)
09821 return true;
09822 else
09823 {
09824 #ifdef DEBUG_OSOPTION
09825 cout << "First object is NULL, second is not" << endl;
09826 #endif
09827 return false;
09828 }
09829 }
09830 else
09831 {
09832 if (that == NULL)
09833 {
09834 #ifdef DEBUG_OSOPTION
09835 cout << "Second object is NULL, first is not" << endl;
09836 #endif
09837 return false;
09838 }
09839 else
09840 {
09841 if (this->numberOfVar != that->numberOfVar)
09842 {
09843 #ifdef DEBUG_OSOPTION
09844 cout << "numberOfVar: " << this->numberOfVar << " vs. " << that->numberOfVar << endl;
09845 #endif
09846 return false;
09847 }
09848 int i;
09849 for (i = 0; i < numberOfVar; i++)
09850 if (!this->var[i]->IsEqual(that->var[i]))
09851 return false;
09852 return true;
09853 }
09854 }
09855 }
09856
09857 bool InitVarValueString::IsEqual(InitVarValueString *that)
09858 {
09859 #ifdef DEBUG_OSOPTION
09860 cout << "Start comparing in InitVarValueString" << endl;
09861 #endif
09862 if (this == NULL)
09863 {
09864 if (that == NULL)
09865 return true;
09866 else
09867 {
09868 #ifdef DEBUG_OSOPTION
09869 cout << "First object is NULL, second is not" << endl;
09870 #endif
09871 return false;
09872 }
09873 }
09874 else
09875 {
09876 if (that == NULL)
09877 {
09878 #ifdef DEBUG_OSOPTION
09879 cout << "Second object is NULL, first is not" << endl;
09880 #endif
09881 return false;
09882 }
09883 else
09884 {
09885 if ((this->idx != that->idx) || this->name != that->name || (this->value != that->value))
09886 {
09887 #ifdef DEBUG_OSOPTION
09888 cout << "idx: " << this->idx << " vs. " << that->idx << endl;
09889 cout << "value: " << this->value << " vs. " << that->value << endl;
09890 #endif
09891 return false;
09892 }
09893 return true;
09894 }
09895 }
09896 }
09897
09898 bool InitialBasisStatus::IsEqual(InitialBasisStatus *that)
09899 {
09900 #ifdef DEBUG_OSOPTION
09901 cout << "Start comparing in InitialBasisStatus" << endl;
09902 #endif
09903 if (this == NULL)
09904 {
09905 if (that == NULL)
09906 return true;
09907 else
09908 {
09909 #ifdef DEBUG_OSOPTION
09910 cout << "First object is NULL, second is not" << endl;
09911 #endif
09912 return false;
09913 }
09914 }
09915 else
09916 {
09917 if (that == NULL)
09918 {
09919 #ifdef DEBUG_OSOPTION
09920 cout << "Second object is NULL, first is not" << endl;
09921 #endif
09922 return false;
09923 }
09924 else
09925 {
09926 if (this->numberOfVar != that->numberOfVar)
09927 {
09928 #ifdef DEBUG_OSOPTION
09929 cout << "numberOfVar: " << this->numberOfVar << " vs. " << that->numberOfVar << endl;
09930 #endif
09931 return false;
09932 }
09933 int i;
09934 for (i = 0; i < numberOfVar; i++)
09935 if (!this->var[i]->IsEqual(that->var[i]))
09936 return false;
09937 return true;
09938 }
09939 }
09940 }
09941
09942 bool InitBasStatus::IsEqual(InitBasStatus *that)
09943 {
09944 #ifdef DEBUG_OSOPTION
09945 cout << "Start comparing in InitBasStatus" << endl;
09946 #endif
09947 if (this == NULL)
09948 {
09949 if (that == NULL)
09950 return true;
09951 else
09952 {
09953 #ifdef DEBUG_OSOPTION
09954 cout << "First object is NULL, second is not" << endl;
09955 #endif
09956 return false;
09957 }
09958 }
09959 else
09960 {
09961 if (that == NULL)
09962 {
09963 #ifdef DEBUG_OSOPTION
09964 cout << "Second object is NULL, first is not" << endl;
09965 #endif
09966 return false;
09967 }
09968 else
09969 {
09970 if ((this->idx != that->idx) || (this->value != that->value))
09971 if ((this->value != "unknown" && that->value != "") ||
09972 (that->value != "unknown" && this->value != "") )
09973 {
09974 #ifdef DEBUG_OSOPTION
09975 cout << "idx: " << this->idx << " vs. " << that->idx << endl;
09976 cout << "value: " << this->value << " vs. " << that->value << endl;
09977 #endif
09978 return false;
09979 }
09980 return true;
09981 }
09982 }
09983 }
09984
09985
09986 bool IntegerVariableBranchingWeights::IsEqual(IntegerVariableBranchingWeights *that)
09987 {
09988 #ifdef DEBUG_OSOPTION
09989 cout << "Start comparing in IntegerVariableBranchingWeights" << endl;
09990 #endif
09991 if (this == NULL)
09992 {
09993 if (that == NULL)
09994 return true;
09995 else
09996 {
09997 #ifdef DEBUG_OSOPTION
09998 cout << "First object is NULL, second is not" << endl;
09999 #endif
10000 return false;
10001 }
10002 }
10003 else
10004 {
10005 if (that == NULL)
10006 {
10007 #ifdef DEBUG_OSOPTION
10008 cout << "Second object is NULL, first is not" << endl;
10009 #endif
10010 return false;
10011 }
10012 else
10013 {
10014 if (this->numberOfVar != that->numberOfVar)
10015 {
10016 #ifdef DEBUG_OSOPTION
10017 cout << "numberOfVar: " << this->numberOfVar << " vs. " << that->numberOfVar << endl;
10018 #endif
10019 return false;
10020 }
10021 int i;
10022 for (i = 0; i < numberOfVar; i++)
10023 if (!this->var[i]->IsEqual(that->var[i]))
10024 return false;
10025 return true;
10026 }
10027 }
10028 }
10029
10030 bool SOSVariableBranchingWeights::IsEqual(SOSVariableBranchingWeights *that)
10031 {
10032 #ifdef DEBUG_OSOPTION
10033 cout << "Start comparing in SOSVariableBranchingWeights" << endl;
10034 #endif
10035 if (this == NULL)
10036 {
10037 if (that == NULL)
10038 return true;
10039 else
10040 {
10041 #ifdef DEBUG_OSOPTION
10042 cout << "First object is NULL, second is not" << endl;
10043 #endif
10044 return false;
10045 }
10046 }
10047 else
10048 {
10049 if (that == NULL)
10050 {
10051 #ifdef DEBUG_OSOPTION
10052 cout << "Second object is NULL, first is not" << endl;
10053 #endif
10054 return false;
10055 }
10056 else
10057 {
10058 if (this->numberOfSOS != that->numberOfSOS)
10059 {
10060 #ifdef DEBUG_OSOPTION
10061 cout << "numberOfSOS: " << this->numberOfSOS << " vs. " << that->numberOfSOS << endl;
10062 #endif
10063 return false;
10064 }
10065 int i;
10066 for (i = 0; i < numberOfSOS; i++)
10067 {
10068 if (!this->sos[i]->IsEqual(that->sos[i]))
10069 return false;
10070 }
10071 return true;
10072 }
10073 }
10074 }
10075
10076
10077 bool SOSWeights::IsEqual(SOSWeights *that)
10078 {
10079 #ifdef DEBUG_OSOPTION
10080 cout << "Start comparing in SOSWeights" << endl;
10081 #endif
10082 if (this == NULL)
10083 {
10084 if (that == NULL)
10085 return true;
10086 else
10087 {
10088 #ifdef DEBUG_OSOPTION
10089 cout << "First object is NULL, second is not" << endl;
10090 #endif
10091 return false;
10092 }
10093 }
10094 else
10095 {
10096 if (that == NULL)
10097 {
10098 #ifdef DEBUG_OSOPTION
10099 cout << "Second object is NULL, first is not" << endl;
10100 #endif
10101 return false;
10102 }
10103 else
10104 {
10105 if ((this->sosIdx != that->sosIdx) ||
10106 !isEqual(this->groupWeight, that->groupWeight))
10107 {
10108 #ifdef DEBUG_OSOPTION
10109 cout << "sosIdx: " << this->sosIdx << " vs. " << that->sosIdx << endl;
10110 cout << "groupWeight: " << this->groupWeight << " vs. " << that->groupWeight << endl;
10111 #endif
10112 return false;
10113 }
10114
10115 if (this->numberOfVar != that->numberOfVar)
10116 {
10117 #ifdef DEBUG_OSOPTION
10118 cout << "numberOfVar: " << this->numberOfVar << " vs. " << that->numberOfVar << endl;
10119 #endif
10120 return false;
10121 }
10122 int i;
10123 for (i = 0; i < numberOfVar; i++)
10124 {
10125
10126 if (!this->var[i]->IsEqual(that->var[i]))
10127 return false;
10128 }
10129 return true;
10130 }
10131 }
10132 }
10133
10134
10135 bool BranchingWeight::IsEqual(BranchingWeight *that)
10136 {
10137 #ifdef DEBUG_OSOPTION
10138 cout << "Start comparing in BranchingWeight" << endl;
10139 #endif
10140 if (this == NULL)
10141 {
10142 if (that == NULL)
10143 return true;
10144 else
10145 {
10146 #ifdef DEBUG_OSOPTION
10147 cout << "First object is NULL, second is not" << endl;
10148 #endif
10149 return false;
10150 }
10151 }
10152 else
10153 {
10154 if (that == NULL)
10155 {
10156 #ifdef DEBUG_OSOPTION
10157 cout << "Second object is NULL, first is not" << endl;
10158 #endif
10159 return false;
10160 }
10161 else
10162 {
10163 if ((this->idx != that->idx) || this->name != that->name || !isEqual(this->value, that->value))
10164 {
10165 #ifdef DEBUG_OSOPTION
10166 cout << "idx: " << this->idx << " vs. " << that->idx << endl;
10167 cout << "value: " << this->value << " vs. " << that->value << endl;
10168 cout << "name: -" << this->name << "- vs. -" << that->name << "-" << endl;
10169 #endif
10170 return false;
10171 }
10172 return true;
10173 }
10174 }
10175 }
10176
10177 bool OtherVariableOption::IsEqual(OtherVariableOption *that)
10178 {
10179 #ifdef DEBUG_OSOPTION
10180 cout << "Start comparing in OtherVariableOption" << endl;
10181 #endif
10182 if (this == NULL)
10183 {
10184 if (that == NULL)
10185 return true;
10186 else
10187 {
10188 #ifdef DEBUG_OSOPTION
10189 cout << "First object is NULL, second is not" << endl;
10190 #endif
10191 return false;
10192 }
10193 }
10194 else
10195 {
10196 if (that == NULL)
10197 {
10198 #ifdef DEBUG_OSOPTION
10199 cout << "Second object is NULL, first is not" << endl;
10200 #endif
10201 return false;
10202 }
10203 else
10204 {
10205 if ((this->name != that->name) ||
10206 (this->value != that->value) ||
10207 (this->solver != that->solver) ||
10208 (this->category != that->category) ||
10209 (this->type != that->type) ||
10210 (this->description != that->description))
10211 {
10212 #ifdef DEBUG_OSOPTION
10213 cout << "name: " << this->name << " vs. " << that->name << endl;
10214 cout << "value: " << this->value << " vs. " << that->value << endl;
10215 cout << "solver: " << this->solver << " vs. " << that->solver << endl;
10216 cout << "category: " << this->category << " vs. " << that->category << endl;
10217 cout << "type: " << this->type << " vs. " << that->type << endl;
10218 cout << "description: " << this->description << " vs. " << that->description << endl;
10219 #endif
10220 return false;
10221 }
10222
10223 if (this->numberOfVar != that->numberOfVar)
10224 {
10225 #ifdef DEBUG_OSOPTION
10226 cout << "numberOfVar: " << this->numberOfVar << " vs. " << that->numberOfVar << endl;
10227 #endif
10228 return false;
10229 }
10230 int i;
10231 for (i = 0; i < numberOfVar; i++)
10232 if (!this->var[i]->IsEqual(that->var[i]))
10233 return false;
10234
10235 if (this->numberOfEnumerations != that->numberOfEnumerations)
10236 {
10237 #ifdef DEBUG_OSOPTION
10238 cout << "numberOfEnumerations: " << this->numberOfEnumerations << " vs. " << that->numberOfEnumerations << endl;
10239 #endif
10240 return false;
10241 }
10242 for (i = 0; i < numberOfEnumerations; i++)
10243 if (!this->enumeration[i]->IsEqual(that->enumeration[i]))
10244 return false;
10245 return true;
10246 }
10247 }
10248 }
10249
10250 bool OtherVarOption::IsEqual(OtherVarOption *that)
10251 {
10252 #ifdef DEBUG_OSOPTION
10253 cout << "Start comparing in OtherVarOption" << endl;
10254 #endif
10255 if (this == NULL)
10256 {
10257 if (that == NULL)
10258 return true;
10259 else
10260 {
10261 #ifdef DEBUG_OSOPTION
10262 cout << "First object is NULL, second is not" << endl;
10263 #endif
10264 return false;
10265 }
10266 }
10267 else
10268 {
10269 if (that == NULL)
10270 {
10271 #ifdef DEBUG_OSOPTION
10272 cout << "Second object is NULL, first is not" << endl;
10273 #endif
10274 return false;
10275 }
10276 else
10277 {
10278 if ((this->idx != that->idx) || this->name != that->name || (this->value != that->value) ||
10279 (this->lbValue != that->lbValue) || (this->ubValue != that->ubValue))
10280 {
10281 #ifdef DEBUG_OSOPTION
10282 cout << "idx: " << this->idx << " vs. " << that->idx << endl;
10283 cout << "value: " << this->value << " vs. " << that->value << endl;
10284 cout << "lbValue: " << this->lbValue << " vs. " << that->lbValue << endl;
10285 cout << "ubValue: " << this->ubValue << " vs. " << that->ubValue << endl;
10286 #endif
10287 return false;
10288 }
10289 return true;
10290 }
10291 }
10292 }
10293
10294 bool ObjectiveOption::IsEqual(ObjectiveOption *that)
10295 {
10296 #ifdef DEBUG_OSOPTION
10297 cout << "Start comparing in ObjectiveOption" << endl;
10298 #endif
10299 if (this == NULL)
10300 {
10301 if (that == NULL)
10302 return true;
10303 else
10304 {
10305 #ifdef DEBUG_OSOPTION
10306 cout << "First object is NULL, second is not" << endl;
10307 #endif
10308 return false;
10309 }
10310 }
10311 else
10312 {
10313 if (that == NULL)
10314 {
10315 #ifdef DEBUG_OSOPTION
10316 cout << "Second object is NULL, first is not" << endl;
10317 #endif
10318 return false;
10319 }
10320 else
10321 {
10322 if (!this->initialObjectiveValues->IsEqual(that->initialObjectiveValues))
10323 return false;
10324 if (!this->initialObjectiveBounds->IsEqual(that->initialObjectiveBounds))
10325 return false;
10326 if (!this->initialBasisStatus->IsEqual(that->initialBasisStatus))
10327 return false;
10328
10329 if (this->numberOfOtherObjectiveOptions != that->numberOfOtherObjectiveOptions)
10330 {
10331 #ifdef DEBUG_OSOPTION
10332 cout << "numberOfOtherObjectiveOptions: " << this->numberOfOtherObjectiveOptions << " vs. " << that->numberOfOtherObjectiveOptions << endl;
10333 #endif
10334 return false;
10335 }
10336 int i;
10337 for (i = 0; i < numberOfOtherObjectiveOptions; i++)
10338 if (!this->other[i]->IsEqual(that->other[i]))
10339 return false;
10340
10341 return true;
10342 }
10343 }
10344 }
10345
10346 bool InitObjectiveValues::IsEqual(InitObjectiveValues *that)
10347 {
10348 #ifdef DEBUG_OSOPTION
10349 cout << "Start comparing in InitObjectiveValues" << endl;
10350 #endif
10351 if (this == NULL)
10352 {
10353 if (that == NULL)
10354 return true;
10355 else
10356 {
10357 #ifdef DEBUG_OSOPTION
10358 cout << "First object is NULL, second is not" << endl;
10359 #endif
10360 return false;
10361 }
10362 }
10363 else
10364 {
10365 if (that == NULL)
10366 {
10367 #ifdef DEBUG_OSOPTION
10368 cout << "Second object is NULL, first is not" << endl;
10369 #endif
10370 return false;
10371 }
10372 else
10373 {
10374 if (this->numberOfObj != that->numberOfObj)
10375 {
10376 #ifdef DEBUG_OSOPTION
10377 cout << "numberOfObj: " << this->numberOfObj << " vs. " << that->numberOfObj << endl;
10378 #endif
10379 return false;
10380 }
10381 int i;
10382 for (i = 0; i < numberOfObj; i++)
10383 if (!this->obj[i]->IsEqual(that->obj[i]))
10384 return false;
10385 return true;
10386 }
10387 }
10388 }
10389
10390 bool InitObjValue::IsEqual(InitObjValue *that)
10391 {
10392 #ifdef DEBUG_OSOPTION
10393 cout << "Start comparing in InitObjValue" << endl;
10394 #endif
10395 if (this == NULL)
10396 {
10397 if (that == NULL)
10398 return true;
10399 else
10400 {
10401 #ifdef DEBUG_OSOPTION
10402 cout << "First object is NULL, second is not" << endl;
10403 #endif
10404 return false;
10405 }
10406 }
10407 else
10408 {
10409 if (that == NULL)
10410 {
10411 #ifdef DEBUG_OSOPTION
10412 cout << "Second object is NULL, first is not" << endl;
10413 #endif
10414 return false;
10415 }
10416 else
10417 {
10418 if ((this->idx != that->idx) || this->name != that->name || !isEqual(this->value, that->value))
10419 {
10420 #ifdef DEBUG_OSOPTION
10421 cout << "idx: " << this->idx << " vs. " << that->idx << endl;
10422 cout << "value: " << this->value << " vs. " << that->value << endl;
10423 #endif
10424 return false;
10425 }
10426 return true;
10427 }
10428 }
10429 }
10430
10431 bool InitObjectiveBounds::IsEqual(InitObjectiveBounds *that)
10432 {
10433 #ifdef DEBUG_OSOPTION
10434 cout << "Start comparing in InitObjectiveBounds" << endl;
10435 #endif
10436 if (this == NULL)
10437 {
10438 if (that == NULL)
10439 return true;
10440 else
10441 {
10442 #ifdef DEBUG_OSOPTION
10443 cout << "First object is NULL, second is not" << endl;
10444 #endif
10445 return false;
10446 }
10447 }
10448 else
10449 {
10450 if (that == NULL)
10451 {
10452 #ifdef DEBUG_OSOPTION
10453 cout << "Second object is NULL, first is not" << endl;
10454 #endif
10455 return false;
10456 }
10457 else
10458 {
10459 if (this->numberOfObj != that->numberOfObj)
10460 {
10461 #ifdef DEBUG_OSOPTION
10462 cout << "numberOfObj: " << this->numberOfObj << " vs. " << that->numberOfObj << endl;
10463 #endif
10464 return false;
10465 }
10466 int i;
10467 for (i = 0; i < numberOfObj; i++)
10468 if (!this->obj[i]->IsEqual(that->obj[i]))
10469 return false;
10470 return true;
10471 }
10472 }
10473 }
10474
10475 bool InitObjBound::IsEqual(InitObjBound *that)
10476 {
10477 #ifdef DEBUG_OSOPTION
10478 cout << "Start comparing in InitObjBound" << endl;
10479 #endif
10480 if (this == NULL)
10481 {
10482 if (that == NULL)
10483 return true;
10484 else
10485 {
10486 #ifdef DEBUG_OSOPTION
10487 cout << "First object is NULL, second is not" << endl;
10488 #endif
10489 return false;
10490 }
10491 }
10492 else
10493 {
10494 if (that == NULL)
10495 {
10496 #ifdef DEBUG_OSOPTION
10497 cout << "Second object is NULL, first is not" << endl;
10498 #endif
10499 return false;
10500 }
10501 else
10502 {
10503 if ((this->idx != that->idx) ||
10504 this->name != that->name ||
10505 !isEqual(this->lbValue, that->lbValue) ||
10506 !isEqual(this->ubValue, that->ubValue) )
10507 {
10508 #ifdef DEBUG_OSOPTION
10509 cout << "idx: " << this->idx << " vs. " << that->idx << endl;
10510 cout << "lbValue: " << this->lbValue << " vs. " << that->lbValue << endl;
10511 cout << "ubValue: " << this->ubValue << " vs. " << that->ubValue << endl;
10512 #endif
10513 return false;
10514 }
10515 return true;
10516 }
10517 }
10518 }
10519
10520 bool OtherObjectiveOption::IsEqual(OtherObjectiveOption *that)
10521 {
10522 #ifdef DEBUG_OSOPTION
10523 cout << "Start comparing in OtherObjectiveOption" << endl;
10524 #endif
10525 if (this == NULL)
10526 {
10527 if (that == NULL)
10528 return true;
10529 else
10530 {
10531 #ifdef DEBUG_OSOPTION
10532 cout << "First object is NULL, second is not" << endl;
10533 #endif
10534 return false;
10535 }
10536 }
10537 else
10538 {
10539 if (that == NULL)
10540 {
10541 #ifdef DEBUG_OSOPTION
10542 cout << "Second object is NULL, first is not" << endl;
10543 #endif
10544 return false;
10545 }
10546 else
10547 {
10548 if ((this->name != that->name) ||
10549 (this->value != that->value) ||
10550 (this->solver != that->solver) ||
10551 (this->category != that->category) ||
10552 (this->type != that->type) ||
10553 (this->description != that->description))
10554 {
10555 #ifdef DEBUG_OSOPTION
10556 cout << "name: " << this->name << " vs. " << that->name << endl;
10557 cout << "value: " << this->value << " vs. " << that->value << endl;
10558 cout << "solver: " << this->solver << " vs. " << that->solver << endl;
10559 cout << "category: " << this->category << " vs. " << that->category << endl;
10560 cout << "type: " << this->type << " vs. " << that->type << endl;
10561 cout << "description: " << this->description << " vs. " << that->description << endl;
10562 #endif
10563 return false;
10564 }
10565
10566 if (this->numberOfObj != that->numberOfObj)
10567 {
10568 #ifdef DEBUG_OSOPTION
10569 cout << "numberOfObj: " << this->numberOfObj << " vs. " << that->numberOfObj << endl;
10570 #endif
10571 return false;
10572 }
10573 int i;
10574 for (i = 0; i < numberOfObj; i++)
10575 if (!this->obj[i]->IsEqual(that->obj[i]))
10576 return false;
10577 return true;
10578 }
10579 }
10580 }
10581
10582 bool OtherObjOption::IsEqual(OtherObjOption *that)
10583 {
10584 #ifdef DEBUG_OSOPTION
10585 cout << "Start comparing in OtherObjOption" << endl;
10586 #endif
10587 if (this == NULL)
10588 {
10589 if (that == NULL)
10590 return true;
10591 else
10592 {
10593 #ifdef DEBUG_OSOPTION
10594 cout << "First object is NULL, second is not" << endl;
10595 #endif
10596 return false;
10597 }
10598 }
10599 else
10600 {
10601 if (that == NULL)
10602 {
10603 #ifdef DEBUG_OSOPTION
10604 cout << "Second object is NULL, first is not" << endl;
10605 #endif
10606 return false;
10607 }
10608 else
10609 {
10610 if ((this->idx != that->idx) || this->name != that->name || (this->value != that->value) ||
10611 (this->lbValue != that->lbValue) || (this->ubValue != that->ubValue))
10612 {
10613 #ifdef DEBUG_OSOPTION
10614 cout << "idx: " << this->idx << " vs. " << that->idx << endl;
10615 cout << "value: " << this->value << " vs. " << that->value << endl;
10616 cout << "lbValue: " << this->lbValue << " vs. " << that->lbValue << endl;
10617 cout << "ubValue: " << this->ubValue << " vs. " << that->ubValue << endl;
10618 #endif
10619 return false;
10620 }
10621 return true;
10622 }
10623 }
10624 }
10625
10626 bool ConstraintOption::IsEqual(ConstraintOption *that)
10627 {
10628 #ifdef DEBUG_OSOPTION
10629 cout << "Start comparing in ConstraintOption" << endl;
10630 #endif
10631 if (this == NULL)
10632 {
10633 if (that == NULL)
10634 return true;
10635 else
10636 {
10637 #ifdef DEBUG_OSOPTION
10638 cout << "First object is NULL, second is not" << endl;
10639 #endif
10640 return false;
10641 }
10642 }
10643 else
10644 {
10645 if (that == NULL)
10646 {
10647 #ifdef DEBUG_OSOPTION
10648 cout << "Second object is NULL, first is not" << endl;
10649 #endif
10650 return false;
10651 }
10652 else
10653 {
10654 if (!this->initialConstraintValues->IsEqual(that->initialConstraintValues))
10655 return false;
10656 if (!this->initialDualValues->IsEqual(that->initialDualValues))
10657 return false;
10658 if (!this->initialBasisStatus->IsEqual(that->initialBasisStatus))
10659 return false;
10660
10661 if (this->numberOfOtherConstraintOptions != that->numberOfOtherConstraintOptions)
10662 {
10663 #ifdef DEBUG_OSOPTION
10664 cout << "numberOfOtherConstraintOptions: " << this->numberOfOtherConstraintOptions << " vs. " << that->numberOfOtherConstraintOptions << endl;
10665 #endif
10666 return false;
10667 }
10668 int i;
10669 for (i = 0; i < numberOfOtherConstraintOptions; i++)
10670 if (!this->other[i]->IsEqual(that->other[i]))
10671 return false;
10672
10673 return true;
10674 }
10675 }
10676 }
10677
10678 bool InitConstraintValues::IsEqual(InitConstraintValues *that)
10679 {
10680 #ifdef DEBUG_OSOPTION
10681 cout << "Start comparing in InitConstraintValues" << endl;
10682 #endif
10683 if (this == NULL)
10684 {
10685 if (that == NULL)
10686 return true;
10687 else
10688 {
10689 #ifdef DEBUG_OSOPTION
10690 cout << "First object is NULL, second is not" << endl;
10691 #endif
10692 return false;
10693 }
10694 }
10695 else
10696 {
10697 if (that == NULL)
10698 {
10699 #ifdef DEBUG_OSOPTION
10700 cout << "Second object is NULL, first is not" << endl;
10701 #endif
10702 return false;
10703 }
10704 else
10705 {
10706 if (this->numberOfCon != that->numberOfCon)
10707 {
10708 #ifdef DEBUG_OSOPTION
10709 cout << "numberOfCon: " << this->numberOfCon << " vs. " << that->numberOfCon << endl;
10710 #endif
10711 return false;
10712 }
10713 int i;
10714 for (i = 0; i < numberOfCon; i++)
10715 if (!this->con[i]->IsEqual(that->con[i]))
10716 return false;
10717 return true;
10718 }
10719 }
10720 }
10721
10722 bool InitConValue::IsEqual(InitConValue *that)
10723 {
10724 #ifdef DEBUG_OSOPTION
10725 cout << "Start comparing in InitConValue" << endl;
10726 #endif
10727 if (this == NULL)
10728 {
10729 if (that == NULL)
10730 return true;
10731 else
10732 {
10733 #ifdef DEBUG_OSOPTION
10734 cout << "First object is NULL, second is not" << endl;
10735 #endif
10736 return false;
10737 }
10738 }
10739 else
10740 {
10741 if (that == NULL)
10742 {
10743 #ifdef DEBUG_OSOPTION
10744 cout << "Second object is NULL, first is not" << endl;
10745 #endif
10746 return false;
10747 }
10748 else
10749 {
10750 if ((this->idx != that->idx) || this->name != that->name || !isEqual(this->value, that->value))
10751 {
10752 #ifdef DEBUG_OSOPTION
10753 cout << "idx: " << this->idx << " vs. " << that->idx << endl;
10754 cout << "value: " << this->value << " vs. " << that->value << endl;
10755 #endif
10756 return false;
10757 }
10758 return true;
10759 }
10760 }
10761 }
10762
10763 bool InitDualVariableValues::IsEqual(InitDualVariableValues *that)
10764 {
10765 #ifdef DEBUG_OSOPTION
10766 cout << "Start comparing in InitDualVariableValues" << endl;
10767 #endif
10768 if (this == NULL)
10769 {
10770 if (that == NULL)
10771 return true;
10772 else
10773 {
10774 #ifdef DEBUG_OSOPTION
10775 cout << "First object is NULL, second is not" << endl;
10776 #endif
10777 return false;
10778 }
10779 }
10780 else
10781 {
10782 if (that == NULL)
10783 {
10784 #ifdef DEBUG_OSOPTION
10785 cout << "Second object is NULL, first is not" << endl;
10786 #endif
10787 return false;
10788 }
10789 else
10790 {
10791 if (this->numberOfCon != that->numberOfCon)
10792 {
10793 #ifdef DEBUG_OSOPTION
10794 cout << "numberOfCon: " << this->numberOfCon << " vs. " << that->numberOfCon << endl;
10795 #endif
10796 return false;
10797 }
10798 int i;
10799 for (i = 0; i < numberOfCon; i++)
10800 if (!this->con[i]->IsEqual(that->con[i]))
10801 return false;
10802 return true;
10803 }
10804 }
10805 }
10806
10807 bool InitDualVarValue::IsEqual(InitDualVarValue *that)
10808 {
10809 #ifdef DEBUG_OSOPTION
10810 cout << "Start comparing in InitDualVarValue" << endl;
10811 #endif
10812 if (this == NULL)
10813 {
10814 if (that == NULL)
10815 return true;
10816 else
10817 {
10818 #ifdef DEBUG_OSOPTION
10819 cout << "First object is NULL, second is not" << endl;
10820 #endif
10821 return false;
10822 }
10823 }
10824 else
10825 {
10826 if (that == NULL)
10827 {
10828 #ifdef DEBUG_OSOPTION
10829 cout << "Second object is NULL, first is not" << endl;
10830 #endif
10831 return false;
10832 }
10833 else
10834 {
10835 if ((this->idx != that->idx) || this->name != that->name ||
10836 !isEqual(this->lbDualValue, that->lbDualValue) ||
10837 !isEqual(this->ubDualValue, that->ubDualValue))
10838 {
10839 #ifdef DEBUG_OSOPTION
10840 cout << "idx: " << this->idx << " vs. " << that->idx << endl;
10841 cout << "lbDualValue: " << this->lbDualValue << " vs. " << that->lbDualValue << endl;
10842 cout << "ubDualValue: " << this->ubDualValue << " vs. " << that->ubDualValue << endl;
10843 #endif
10844 return false;
10845 }
10846 return true;
10847 }
10848 }
10849 }
10850
10851 bool OtherConstraintOption::IsEqual(OtherConstraintOption *that)
10852 {
10853 #ifdef DEBUG_OSOPTION
10854 cout << "Start comparing in OtherConstraintOption" << endl;
10855 #endif
10856 if (this == NULL)
10857 {
10858 if (that == NULL)
10859 return true;
10860 else
10861 {
10862 #ifdef DEBUG_OSOPTION
10863 cout << "First object is NULL, second is not" << endl;
10864 #endif
10865 return false;
10866 }
10867 }
10868 else
10869 {
10870 if (that == NULL)
10871 {
10872 #ifdef DEBUG_OSOPTION
10873 cout << "Second object is NULL, first is not" << endl;
10874 #endif
10875 return false;
10876 }
10877 else
10878 {
10879 if ((this->name != that->name) ||
10880 (this->value != that->value) ||
10881 (this->solver != that->solver) ||
10882 (this->category != that->category) ||
10883 (this->type != that->type) ||
10884 (this->description != that->description))
10885 {
10886 #ifdef DEBUG_OSOPTION
10887 cout << "name: " << this->name << " vs. " << that->name << endl;
10888 cout << "value: " << this->value << " vs. " << that->value << endl;
10889 cout << "solver: " << this->solver << " vs. " << that->solver << endl;
10890 cout << "category: " << this->category << " vs. " << that->category << endl;
10891 cout << "type: " << this->type << " vs. " << that->type << endl;
10892 cout << "description: " << this->description << " vs. " << that->description << endl;
10893 #endif
10894 return false;
10895 }
10896
10897 if (this->numberOfCon != that->numberOfCon)
10898 {
10899 #ifdef DEBUG_OSOPTION
10900 cout << "numberOfCon: " << this->numberOfCon << " vs. " << that->numberOfCon << endl;
10901 #endif
10902 return false;
10903 }
10904 int i;
10905 for (i = 0; i < numberOfCon; i++)
10906 if (!this->con[i]->IsEqual(that->con[i]))
10907 return false;
10908 return true;
10909 }
10910 }
10911 }
10912
10913 bool OtherConOption::IsEqual(OtherConOption *that)
10914 {
10915 #ifdef DEBUG_OSOPTION
10916 cout << "Start comparing in OtherConOption" << endl;
10917 #endif
10918 if (this == NULL)
10919 {
10920 if (that == NULL)
10921 return true;
10922 else
10923 {
10924 #ifdef DEBUG_OSOPTION
10925 cout << "First object is NULL, second is not" << endl;
10926 #endif
10927 return false;
10928 }
10929 }
10930 else
10931 {
10932 if (that == NULL)
10933 {
10934 #ifdef DEBUG_OSOPTION
10935 cout << "Second object is NULL, first is not" << endl;
10936 #endif
10937 return false;
10938 }
10939 else
10940 {
10941 if ((this->idx != that->idx) || this->name != that->name || (this->value != that->value) ||
10942 (this->lbValue != that->lbValue) || (this->ubValue != that->ubValue))
10943 {
10944 #ifdef DEBUG_OSOPTION
10945 cout << "idx: " << this->idx << " vs. " << that->idx << endl;
10946 cout << "value: " << this->value << " vs. " << that->value << endl;
10947 cout << "lbValue: " << this->lbValue << " vs. " << that->lbValue << endl;
10948 cout << "ubValue: " << this->ubValue << " vs. " << that->ubValue << endl;
10949 #endif
10950 return false;
10951 }
10952 return true;
10953 }
10954 }
10955 }
10956
10957
10958 bool SolverOptions::IsEqual(SolverOptions *that)
10959 {
10960 #ifdef DEBUG_OSOPTION
10961 cout << "Start comparing in SolverOptions" << endl;
10962 #endif
10963 if (this == NULL)
10964 {
10965 if (that == NULL)
10966 return true;
10967 else
10968 {
10969 #ifdef DEBUG_OSOPTION
10970 cout << "First object is NULL, second is not" << endl;
10971 #endif
10972 return false;
10973 }
10974 }
10975 else
10976 {
10977 if (that == NULL)
10978 {
10979 #ifdef DEBUG_OSOPTION
10980 cout << "Second object is NULL, first is not" << endl;
10981 #endif
10982 return false;
10983 }
10984 else
10985 {
10986 if (this->numberOfSolverOptions != that->numberOfSolverOptions)
10987 {
10988 #ifdef DEBUG_OSOPTION
10989 cout << "numberOfSolverOptions: " << this->numberOfSolverOptions << " vs. " << that->numberOfSolverOptions << endl;
10990 #endif
10991 return false;
10992 }
10993
10994 int i;
10995 for (i = 0; i < numberOfSolverOptions; i++)
10996 if (!this->solverOption[i]->IsEqual(that->solverOption[i]))
10997 return false;
10998
10999 return true;
11000 }
11001 }
11002 }
11003
11004 bool SolverOption::IsEqual(SolverOption *that )
11005 {
11006 #ifdef DEBUG_OSOPTION
11007 cout << "Start comparing in SolverOption" << endl;
11008 #endif
11009 if (this == NULL)
11010 {
11011 if (that == NULL)
11012 return true;
11013 else
11014 {
11015 #ifdef DEBUG_OSOPTION
11016 cout << "First object is NULL, second is not" << endl;
11017 #endif
11018 return false;
11019 }
11020 }
11021 else
11022 {
11023 if (that == NULL)
11024 {
11025 #ifdef DEBUG_OSOPTION
11026 cout << "Second object is NULL, first is not" << endl;
11027 #endif
11028 return false;
11029 }
11030 else
11031 {
11032 if ((this->name != that->name) ||
11033 (this->value != that->value) ||
11034 (this->solver != that->solver) ||
11035 (this->category != that->category) ||
11036 (this->type != that->type) ||
11037 (this->description != that->description))
11038 {
11039 #ifdef DEBUG_OSOPTION
11040 cout << "name: " << this->name << " vs. " << that->name << endl;
11041 cout << "value: " << this->value << " vs. " << that->value << endl;
11042 cout << "solver: " << this->solver << " vs. " << that->solver << endl;
11043 cout << "category: " << this->category << " vs. " << that->category << endl;
11044 cout << "type: " << this->type << " vs. " << that->type << endl;
11045 cout << "description: " << this->description << " vs. " << that->description << endl;
11046 #endif
11047 return false;
11048 }
11049 return true;
11050 }
11051 }
11052 }
11053
11054
11055
11056
11057
11058
11059
11060
11061
11062
11063
11064
11065
11066
11067 bool OSOption::setRandom( double density, bool conformant )
11068 {
11069 #ifdef DEBUG_OSOPTION
11070 cout << "Set random OSOption" << endl;
11071 #endif
11072 if (OSRand() <= density)
11073 {
11074 optionHeader = new GeneralFileHeader();
11075 optionHeader->setRandom(density, conformant);
11076 }
11077 if (OSRand() <= density)
11078 {
11079 general = new GeneralOption();
11080 general->setRandom(density, conformant);
11081 }
11082 if (OSRand() <= density)
11083 {
11084 system = new SystemOption();
11085 system->setRandom(density, conformant);
11086 }
11087 if (OSRand() <= density)
11088 {
11089 service = new ServiceOption();
11090 service->setRandom(density, conformant);
11091 }
11092 if (OSRand() <= density)
11093 {
11094 job = new JobOption();
11095 job->setRandom(density, conformant);
11096 }
11097 if (OSRand() <= density)
11098 {
11099 optimization = new OptimizationOption();
11100 optimization->setRandom(density, conformant);
11101 }
11102 return true;
11103 }
11104
11105
11106 bool GeneralOption::setRandom( double density, bool conformant )
11107 {
11108 #ifdef DEBUG_OSOPTION
11109 cout << "Set random GeneralOption" << endl;
11110 #endif
11111 if (OSRand() <= density) this->serviceURI = "random string";
11112 if (OSRand() <= density) this->serviceName = "random string";
11113 if (OSRand() <= density) this->instanceName = "random string";
11114 if (OSRand() <= density) this->jobID = "random string";
11115 if (OSRand() <= density) this->solverToInvoke = "random string";
11116 if (OSRand() <= density) this->license = "random string";
11117 if (OSRand() <= density) this->userName = "random string";
11118 if (OSRand() <= density) this->password = "random string";
11119
11120 if (OSRand() <= density)
11121 {
11122 instanceLocation = new InstanceLocationOption();
11123 instanceLocation->setRandom(density, conformant);
11124 }
11125 if (OSRand() <= density)
11126 {
11127 contact = new ContactOption();
11128 contact->setRandom(density, conformant);
11129 }
11130 if (OSRand() <= density)
11131 {
11132 otherOptions = new OtherOptions();
11133 otherOptions->setRandom(density, conformant);
11134 }
11135 return true;
11136 }
11137
11138
11139 bool SystemOption::setRandom( double density, bool conformant )
11140 {
11141 #ifdef DEBUG_OSOPTION
11142 cout << "Set random SystemOption" << endl;
11143 #endif
11144 if (OSRand() <= density)
11145 {
11146 minDiskSpace = new StorageCapacity();
11147 minDiskSpace->setRandom(density, conformant);
11148 }
11149 if (OSRand() <= density)
11150 {
11151 minMemorySize = new StorageCapacity();
11152 minMemorySize->setRandom(density, conformant);
11153 }
11154 if (OSRand() <= density)
11155 {
11156 minCPUSpeed = new CPUSpeed();
11157 minCPUSpeed->setRandom(density, conformant);
11158 }
11159 if (OSRand() <= density)
11160 {
11161 minCPUNumber = new CPUNumber();
11162 minCPUNumber->setRandom(density, conformant);
11163 }
11164 if (OSRand() <= density)
11165 {
11166 otherOptions = new OtherOptions();
11167 otherOptions->setRandom(density, conformant);
11168 }
11169 return true;
11170 }
11171
11172
11173 bool ServiceOption::setRandom( double density, bool conformant )
11174 {
11175 #ifdef DEBUG_OSOPTION
11176 cout << "Set random ServiceOption" << endl;
11177 #endif
11178 if (OSRand() <= density)
11179 {
11180 double temp = OSRand();
11181 if (conformant) temp = 0.5*temp;
11182
11183 if (temp <= 0.25) this->type = "solver";
11184 else if (temp <= 0.50) this->type = "agent";
11185 else if (temp <= 0.75) this->type = "";
11186 else this->type = "spy";
11187 }
11188
11189 if (OSRand() <= density)
11190 {
11191 otherOptions = new OtherOptions();
11192 otherOptions->setRandom(density, conformant);
11193 }
11194
11195 return true;
11196 }
11197
11198
11199 bool JobOption::setRandom( double density, bool conformant )
11200 {
11201 #ifdef DEBUG_OSOPTION
11202 cout << "Set random JobOption" << endl;
11203 #endif
11204 if (OSRand() <= density) this->requestedStartTime = "1997-08-11T01:23:45-09:13";
11205
11206 if (OSRand() <= density)
11207 {
11208 maxTime = new TimeSpan();
11209 maxTime->setRandom(density, conformant);
11210 }
11211 if (OSRand() <= density)
11212 {
11213 dependencies = new JobDependencies();
11214 dependencies->setRandom(density, conformant);
11215 }
11216 if (OSRand() <= density)
11217 {
11218 requiredDirectories = new DirectoriesAndFiles();
11219 requiredDirectories->setRandom(density, conformant);
11220 }
11221 if (OSRand() <= density)
11222 {
11223 requiredFiles = new DirectoriesAndFiles();
11224 requiredFiles->setRandom(density, conformant);
11225 }
11226 if (OSRand() <= density)
11227 {
11228 directoriesToMake = new DirectoriesAndFiles();
11229 directoriesToMake->setRandom(density, conformant);
11230 }
11231 if (OSRand() <= density)
11232 {
11233 filesToMake = new DirectoriesAndFiles();
11234 filesToMake->setRandom(density, conformant);
11235 }
11236 if (OSRand() <= density)
11237 {
11238 inputDirectoriesToMove = new PathPairs();
11239 inputDirectoriesToMove->setRandom(density, conformant);
11240 }
11241 if (OSRand() <= density)
11242 {
11243 inputFilesToMove = new PathPairs();
11244 inputFilesToMove->setRandom(density, conformant);
11245 }
11246 if (OSRand() <= density)
11247 {
11248 outputFilesToMove = new PathPairs();
11249 outputFilesToMove->setRandom(density, conformant);
11250 }
11251 if (OSRand() <= density)
11252 {
11253 outputDirectoriesToMove = new PathPairs();
11254 outputDirectoriesToMove->setRandom(density, conformant);
11255 }
11256 if (OSRand() <= density)
11257 {
11258 filesToDelete = new DirectoriesAndFiles();
11259 filesToDelete->setRandom(density, conformant);
11260 }
11261 if (OSRand() <= density)
11262 {
11263 directoriesToDelete = new DirectoriesAndFiles();
11264 directoriesToDelete->setRandom(density, conformant);
11265 }
11266 if (OSRand() <= density)
11267 {
11268 processesToKill = new Processes();
11269 processesToKill->setRandom(density, conformant);
11270 }
11271 if (OSRand() <= density)
11272 {
11273 otherOptions = new OtherOptions();
11274 otherOptions->setRandom(density, conformant);
11275 }
11276 return true;
11277 }
11278
11279 bool OptimizationOption::setRandom( double density, bool conformant )
11280 {
11281 #ifdef DEBUG_OSOPTION
11282 cout << "Set random OptimizationOption" << endl;
11283 #endif
11284 if (OSRand() <= density && !conformant) this->numberOfVariables = (int)(1+9*OSRand());
11285 if (OSRand() <= density && !conformant) this->numberOfObjectives = (int)(1+9*OSRand());
11286 if (OSRand() <= density && !conformant) this->numberOfConstraints = (int)(1+9*OSRand());
11287
11288 if (OSRand() <= density)
11289 {
11290 variables = new VariableOption();
11291 variables->setRandom(density, conformant);
11292 }
11293 if (OSRand() <= density)
11294 {
11295 objectives = new ObjectiveOption();
11296 objectives->setRandom(density, conformant);
11297 }
11298 if (OSRand() <= density)
11299 {
11300 constraints = new ConstraintOption();
11301 constraints->setRandom(density, conformant);
11302 }
11303 if (OSRand() <= density)
11304 {
11305 solverOptions = new SolverOptions();
11306 solverOptions->setRandom(density, conformant);
11307 }
11308
11309 return true;
11310 }
11311
11312 bool InstanceLocationOption::setRandom( double density, bool conformant )
11313 {
11314 #ifdef DEBUG_OSOPTION
11315 cout << "Set random InstanceLocationOption" << endl;
11316 #endif
11317 if (OSRand() <= density) this->value = "http://www.google.com";
11318 if (OSRand() <= density)
11319 {
11320 double temp = OSRand();
11321 if (conformant) temp = 0.5*temp;
11322
11323 if (temp <= 0.25) this->locationType = "local";
11324 else if (temp <= 0.50) this->locationType = "ftp";
11325 else if (temp <= 0.75) this->locationType = "";
11326 else this->locationType = "global";
11327 }
11328 return true;
11329 }
11330
11331 bool ContactOption::setRandom( double density, bool conformant )
11332 {
11333 #ifdef DEBUG_OSOPTION
11334 cout << "Set random ContactOption" << endl;
11335 #endif
11336 if (OSRand() <= density) this->value = "http://www.google.com";
11337 if (OSRand() <= density)
11338 {
11339 double temp = OSRand();
11340 if (conformant) temp = 0.5*temp;
11341
11342 if (temp <= 0.25) this->transportType = "osp";
11343 else if (temp <= 0.50) this->transportType = "ftp";
11344 else if (temp <= 0.75) this->transportType = "";
11345 else this->transportType = "nlp";
11346 }
11347 return true;
11348 }
11349
11350 bool OtherOptions::setRandom( double density, bool conformant )
11351 {
11352 #ifdef DEBUG_OSOPTION
11353 cout << "Set random OtherOptions" << endl;
11354 #endif
11355 int n;
11356
11357 this->numberOfOtherOptions = (int)(1+4*OSRand());
11358
11359 if (conformant) n = this->numberOfOtherOptions;
11360 else n = (int)(1+4*OSRand());
11361
11362 other = new OtherOption*[n];
11363
11364 for (int i = 0; i < n; i++)
11365 {
11366 other[i] = new OtherOption();
11367 other[i]->setRandom(density, conformant);
11368 }
11369
11370 return true;
11371 }
11372
11373 bool OtherOption::setRandom( double density, bool conformant )
11374 {
11375 #ifdef DEBUG_OSOPTION
11376 cout << "Set random OtherOption" << endl;
11377 #endif
11378 if (OSRand() <= density || conformant) this->name = "random string";
11379 if (OSRand() <= density) this->value = "random string";
11380 if (OSRand() <= density) this->description = "random string";
11381 return true;
11382 }
11383
11384
11385
11386 bool JobDependencies::setRandom( double density, bool conformant )
11387 {
11388 #ifdef DEBUG_OSOPTION
11389 cout << "Set random JobDependencies" << endl;
11390 #endif
11391 int n;
11392
11393 this->numberOfJobIDs = (int)(1+4*OSRand());
11394
11395 if (conformant) n = this->numberOfJobIDs;
11396 else n = (int)(1+4*OSRand());
11397
11398 jobID = new std::string[n];
11399 for (int i = 0; i < n; i++)
11400 jobID[i] = "random string";
11401
11402 return true;
11403 }
11404
11405 bool DirectoriesAndFiles::setRandom( double density, bool conformant )
11406 {
11407 #ifdef DEBUG_OSOPTION
11408 cout << "Set random DirectoriesAndFiles" << endl;
11409 #endif
11410 int n;
11411
11412 this->numberOfPaths = (int)(1+4*OSRand());
11413
11414 if (conformant) n = this->numberOfPaths;
11415 else n = (int)(1+4*OSRand());
11416
11417 path = new std::string[n];
11418 for (int i = 0; i < n; i++)
11419 path[i] = "random string";
11420
11421 return true;
11422 }
11423
11424 bool PathPairs::setRandom( double density, bool conformant )
11425 {
11426 #ifdef DEBUG_OSOPTION
11427 cout << "Set random PathPairs" << endl;
11428 #endif
11429 int n;
11430
11431 this->numberOfPathPairs = (int)(1+4*OSRand());
11432
11433 if (conformant) n = this->numberOfPathPairs;
11434 else n =(int)(1+4*OSRand());
11435
11436 pathPair = new PathPair*[n];
11437 for (int i = 0; i < n; i++)
11438 {
11439 this->pathPair[i] = new PathPair();
11440 this->pathPair[i]->setRandom(density, conformant);
11441 }
11442
11443 return true;
11444 }
11445
11446 bool PathPair::setRandom( double density, bool conformant )
11447 {
11448 #ifdef DEBUG_OSOPTION
11449 cout << "Set random PathPair" << endl;
11450 #endif
11451 this->from = "random string";
11452 this->to = "random string";
11453 if (OSRand() <= density) this->makeCopy = (OSRand() <= 0.5);
11454 return true;
11455 }
11456
11457 bool Processes::setRandom( double density, bool conformant )
11458 {
11459 #ifdef DEBUG_OSOPTION
11460 cout << "Set random Processes" << endl;
11461 #endif
11462 int n;
11463
11464 this->numberOfProcesses = (int)(1+4*OSRand());
11465
11466 if (conformant) n = this->numberOfProcesses;
11467 else n = (int)(1+4*OSRand());
11468
11469 process = new std::string[n];
11470 for (int i = 0; i < n; i++)
11471 process[i] = "random string";
11472
11473 return true;
11474 }
11475
11476 bool VariableOption::setRandom( double density, bool conformant )
11477 {
11478 #ifdef DEBUG_OSOPTION
11479 cout << "Set random VariableOption" << endl;
11480 #endif
11481 if (OSRand() <= density)
11482 {
11483 this->initialVariableValues = new InitVariableValues();
11484 this->initialVariableValues->setRandom(density, conformant);
11485 }
11486 return false;
11487 if (OSRand() <= density)
11488 {
11489 this->initialVariableValuesString = new InitVariableValuesString();
11490 this->initialVariableValuesString->setRandom(density, conformant);
11491 }
11492 if (OSRand() <= density)
11493 {
11494 this->initialBasisStatus = new BasisStatus();
11495 this->initialBasisStatus->setRandom(density, conformant, 0, 9);
11496 }
11497 if (OSRand() <= density)
11498 {
11499 this->integerVariableBranchingWeights = new IntegerVariableBranchingWeights();
11500 this->integerVariableBranchingWeights->setRandom(density, conformant);
11501 }
11502 if (OSRand() <= density)
11503 {
11504 this->sosVariableBranchingWeights = new SOSVariableBranchingWeights();
11505 this->sosVariableBranchingWeights->setRandom(density, conformant);
11506 }
11507
11508
11509 this->numberOfOtherVariableOptions = (int)(4*OSRand());
11510
11511 int n;
11512
11513 if (conformant) n = this->numberOfOtherVariableOptions;
11514 else n = (int)(4*OSRand());
11515
11516 other = new OtherVariableOption*[n];
11517 for (int i = 0; i < n; i++)
11518 {
11519 other[i] = new OtherVariableOption();
11520 other[i]->setRandom(density, conformant);
11521 }
11522 return true;
11523 }
11524
11525 bool InitVariableValues::setRandom( double density, bool conformant )
11526 {
11527 #ifdef DEBUG_OSOPTION
11528 cout << "Set random InitVariableValues" << endl;
11529 #endif
11530 this->numberOfVar = (int)(1+4*OSRand());
11531
11532 int n;
11533
11534 if (conformant) n = this->numberOfVar;
11535 else n = (int)(1+4*OSRand());
11536
11537 var = new InitVarValue*[n];
11538 for (int i = 0; i < n; i++)
11539 {
11540 var[i] = new InitVarValue();
11541 var[i]->setRandom(density, conformant);
11542 }
11543 return true;
11544 }
11545
11546 bool InitVarValue::setRandom( double density, bool conformant )
11547 {
11548 #ifdef DEBUG_OSOPTION
11549 cout << "Set random InitVarValue" << endl;
11550 #endif
11551 this->idx = (int)(4*OSRand());
11552
11553 if (OSRand() <= density)
11554 this->name = "random string";
11555
11556 if (OSRand() <= density)
11557 {
11558 if (OSRand() <= 0.5) this->value = 3.14156;
11559 else this->value = 2.71828;
11560 }
11561 return true;
11562 }
11563
11564
11565 bool InitVariableValuesString::setRandom( double density, bool conformant )
11566 {
11567 #ifdef DEBUG_OSOPTION
11568 cout << "Set random InitVariableValuesString" << endl;
11569 #endif
11570 this->numberOfVar = (int)(1+4*OSRand());
11571
11572 int n;
11573
11574 if (conformant) n = this->numberOfVar;
11575 else n = (int)(1+4*OSRand());
11576
11577 var = new InitVarValueString*[n];
11578 for (int i = 0; i < n; i++)
11579 {
11580 var[i] = new InitVarValueString();
11581 var[i]->setRandom(density, conformant);
11582 }
11583 return true;
11584 }
11585
11586 bool InitVarValueString::setRandom( double density, bool conformant )
11587 {
11588 #ifdef DEBUG_OSOPTION
11589 cout << "Set random InitVarValueString" << endl;
11590 #endif
11591 this->idx = (int)(4*OSRand());
11592
11593 if (OSRand() <= density) this->name = "random string";
11594 if (OSRand() <= density) this->value = "random string";
11595
11596 return true;
11597 }
11598
11599
11600 bool IntegerVariableBranchingWeights::setRandom( double density, bool conformant )
11601 {
11602 #ifdef DEBUG_OSOPTION
11603 cout << "Set random IntegerVariableBranchingWeights" << endl;
11604 #endif
11605 this->numberOfVar = (int)(1+4*OSRand());
11606
11607 int n;
11608
11609 if (conformant) n = this->numberOfVar;
11610 else n = (int)(1+4*OSRand());
11611
11612 var = new BranchingWeight*[n];
11613 for (int i = 0; i < n; i++)
11614 {
11615 var[i] = new BranchingWeight();
11616 var[i]->setRandom(density, conformant);
11617 }
11618 return true;
11619 }
11620
11621 bool SOSVariableBranchingWeights::setRandom( double density, bool conformant )
11622 {
11623 #ifdef DEBUG_OSOPTION
11624 cout << "Set random SOSVariableBranchingWeights" << endl;
11625 #endif
11626 this->numberOfSOS = (int)(1+4*OSRand());
11627
11628 int n;
11629
11630 if (conformant) n = this->numberOfSOS;
11631 else n = (int)(1+4*OSRand());
11632
11633 sos = new SOSWeights*[n];
11634 for (int i = 0; i < n; i++)
11635 {
11636 sos[i] = new SOSWeights();
11637 sos[i]->setRandom(density, conformant);
11638 }
11639 return true;
11640 }
11641
11642
11643 bool SOSWeights::setRandom( double density, bool conformant )
11644 {
11645 #ifdef DEBUG_OSOPTION
11646 cout << "Set random SOSWeights" << endl;
11647 #endif
11648 this->sosIdx = (int)(4*OSRand());
11649 this->numberOfVar = (int)(4*OSRand());
11650
11651 if (OSRand() <= density) this->groupWeight = OSRand();
11652
11653
11654 int n;
11655
11656 if (conformant) n = this->numberOfVar;
11657 else n = (int)(4*OSRand());
11658
11659 var = new BranchingWeight*[n];
11660 for (int i = 0; i < n; i++)
11661 {
11662 var[i] = new BranchingWeight();
11663 var[i]->setRandom(density, conformant);
11664 }
11665 return true;
11666 }
11667
11668
11669 bool BranchingWeight::setRandom( double density, bool conformant )
11670 {
11671 #ifdef DEBUG_OSOPTION
11672 cout << "Set random BranchingWeight" << endl;
11673 #endif
11674 this->idx = (int)(4*OSRand());
11675
11676 if (OSRand() <= density) this->name = "random string";
11677
11678 if (OSRand() <= density)
11679 this->value = OSRand();
11680 return true;
11681 }
11682
11683 bool OtherVariableOption::setRandom( double density, bool conformant )
11684 {
11685 #ifdef DEBUG_OSOPTION
11686 cout << "Set random OtherVariableOption" << endl;
11687 #endif
11688 this->name = "random string";
11689 if (OSRand() <= density) this->name = "randon string";
11690 if (OSRand() <= density) this->value = "randon string";
11691 if (OSRand() <= density) this->solver = "randon string";
11692 if (OSRand() <= density) this->category = "randon string";
11693 if (OSRand() <= density) this->type = "randon string";
11694 if (OSRand() <= density) this->description = "randon string";
11695
11696 if (OSRand() <= density)
11697 {
11698 if (OSRand() <= 0.5)
11699 {
11700 this->numberOfVar = (int)(4*OSRand());
11701
11702 int n;
11703
11704 if (conformant) n = this->numberOfVar;
11705 else n = (int)(4*OSRand());
11706
11707 var = new OtherVarOption*[n];
11708 for (int i = 0; i < n; i++)
11709 {
11710 var[i] = new OtherVarOption();
11711 var[i]->setRandom(density, conformant);
11712 }
11713 }
11714 else
11715 {
11716 this->numberOfEnumerations = (int)(4*OSRand());
11717
11718 int n;
11719
11720 if (conformant) n = this->numberOfEnumerations;
11721 else n = (int)(4*OSRand());
11722
11723 enumeration = new OtherOptionEnumeration*[n];
11724 for (int i = 0; i < n; i++)
11725 {
11726 enumeration[i] = new OtherOptionEnumeration();
11727 enumeration[i]->setRandom(density, conformant, 0, 9);
11728 }
11729 }
11730 }
11731 return true;
11732 }
11733
11734 bool OtherVarOption::setRandom( double density, bool conformant )
11735 {
11736 #ifdef DEBUG_OSOPTION
11737 cout << "Set random OtherVarOption" << endl;
11738 #endif
11739 this->idx = (int)(4*OSRand());
11740 if (OSRand() <= density) this->name = "random string";
11741 if (OSRand() <= density) this->value = "random string";
11742 if (OSRand() <= density) this->lbValue = "random string";
11743 if (OSRand() <= density) this->ubValue = "random string";
11744 return true;
11745 }
11746
11747 bool ObjectiveOption::setRandom( double density, bool conformant )
11748 {
11749 #ifdef DEBUG_OSOPTION
11750 cout << "Set random ObjectiveOption" << endl;
11751 #endif
11752 if (OSRand() <= density)
11753 {
11754 this->initialObjectiveValues = new InitObjectiveValues();
11755 this->initialObjectiveValues->setRandom(density, conformant);
11756 }
11757 return false;
11758 if (OSRand() <= density)
11759 {
11760 this->initialObjectiveBounds = new InitObjectiveBounds();
11761 this->initialObjectiveBounds->setRandom(density, conformant);
11762 }
11763 if (OSRand() <= density)
11764 {
11765 this->initialBasisStatus = new BasisStatus();
11766 this->initialBasisStatus->setRandom(density, conformant, -2, -1);
11767 }
11768
11769 if (OSRand() <= density)
11770 {
11771 this->numberOfOtherObjectiveOptions = (int)(4*OSRand());
11772
11773 int n;
11774
11775 if (conformant) n = this->numberOfOtherObjectiveOptions;
11776 else n = (int)(4*OSRand());
11777
11778 other = new OtherObjectiveOption*[n];
11779 for (int i = 0; i < n; i++)
11780 {
11781 other[i] = new OtherObjectiveOption();
11782 other[i]->setRandom(density, conformant);
11783 }
11784 }
11785 return true;
11786 }
11787
11788 bool InitObjectiveValues::setRandom( double density, bool conformant )
11789 {
11790 #ifdef DEBUG_OSOPTION
11791 cout << "Set random InitObjectiveValues" << endl;
11792 #endif
11793 this->numberOfObj = (int)(1+4*OSRand());
11794
11795 int n;
11796
11797 if (conformant) n = this->numberOfObj;
11798 else n = (int)(1+4*OSRand());
11799
11800 obj = new InitObjValue*[n];
11801 for (int i = 0; i < n; i++)
11802 {
11803 obj[i] = new InitObjValue();
11804 obj[i]->setRandom(density, conformant);
11805 }
11806 return true;
11807 }
11808
11809 bool InitObjValue::setRandom( double density, bool conformant )
11810 {
11811 #ifdef DEBUG_OSOPTION
11812 cout << "Set random InitObjValue" << endl;
11813 #endif
11814 if (OSRand() <= 0.5) idx = -1;
11815 else idx = -2;
11816
11817 if (OSRand() <= density) this->name = "random string";
11818
11819 if (OSRand() <= density)
11820 {
11821 if (OSRand() <= 0.5) this->value = 3.14156;
11822 else this->value = 2.71828;
11823 }
11824 return true;
11825 }
11826
11827 bool InitObjectiveBounds::setRandom( double density, bool conformant )
11828 {
11829 #ifdef DEBUG_OSOPTION
11830 cout << "Set random InitObjectiveBounds" << endl;
11831 #endif
11832 this->numberOfObj = (int)(1+4*OSRand());
11833
11834 int n;
11835
11836 if (conformant) n = this->numberOfObj;
11837 else n = (int)(1+4*OSRand());
11838
11839 obj = new InitObjBound*[n];
11840 for (int i = 0; i < n; i++)
11841 {
11842 obj[i] = new InitObjBound();
11843 obj[i]->setRandom(density, conformant);
11844 }
11845 return true;
11846 }
11847
11848 bool InitObjBound::setRandom( double density, bool conformant )
11849 {
11850 #ifdef DEBUG_OSOPTION
11851 cout << "Set random InitObjBound" << endl;
11852 #endif
11853 if (OSRand() <= 0.5) idx = -1;
11854 else idx = -2;
11855
11856 if (OSRand() <= density) this->name = "random string";
11857
11858 if (OSRand() <= density)
11859 {
11860 if (OSRand() <= 0.5) this->lbValue = 3.14156;
11861 else this->lbValue = 2.71828;
11862 if (OSRand() <= 0.5) this->ubValue = 3.14156;
11863 else this->ubValue = 2.71828;
11864 }
11865 return true;
11866 }
11867
11868 bool OtherObjectiveOption::setRandom( double density, bool conformant )
11869 {
11870 #ifdef DEBUG_OSOPTION
11871 cout << "Set random OtherObjectiveOption" << endl;
11872 #endif
11873 this->name = "random string";
11874 if (OSRand() <= density) this->name = "randon string";
11875 if (OSRand() <= density) this->value = "randon string";
11876 if (OSRand() <= density) this->solver = "randon string";
11877 if (OSRand() <= density) this->category = "randon string";
11878 if (OSRand() <= density) this->type = "randon string";
11879 if (OSRand() <= density) this->description = "randon string";
11880
11881 if (OSRand() <= density)
11882 {
11883 if (OSRand() <= 0.5)
11884 {
11885 this->numberOfObj = (int)(4*OSRand());
11886
11887 int n;
11888
11889 if (conformant) n = this->numberOfObj;
11890 else n = (int)(4*OSRand());
11891
11892 obj = new OtherObjOption*[n];
11893 for (int i = 0; i < n; i++)
11894 {
11895 obj[i] = new OtherObjOption();
11896 obj[i]->setRandom(density, conformant);
11897 }
11898 }
11899 else
11900 {
11901 this->numberOfEnumerations = (int)(4*OSRand());
11902
11903 int n;
11904
11905 if (conformant) n = this->numberOfEnumerations;
11906 else n = (int)(4*OSRand());
11907
11908 enumeration = new OtherOptionEnumeration*[n];
11909 for (int i = 0; i < n; i++)
11910 {
11911 enumeration[i] = new OtherOptionEnumeration();
11912 enumeration[i]->setRandom(density, conformant, -2, -1);
11913 }
11914 }
11915 }
11916 return true;
11917 }
11918
11919 bool OtherObjOption::setRandom( double density, bool conformant )
11920 {
11921 #ifdef DEBUG_OSOPTION
11922 cout << "Set random OtherObjOption" << endl;
11923 #endif
11924 if (OSRand() <= 0.5) this->idx = -1;
11925 else this->idx = -2;
11926 if (OSRand() <= density) this->name = "random string";
11927 if (OSRand() <= density) this->value = "random string";
11928 if (OSRand() <= density) this->lbValue = "random string";
11929 if (OSRand() <= density) this->ubValue = "random string";
11930 return true;
11931 }
11932
11933 bool ConstraintOption::setRandom( double density, bool conformant )
11934 {
11935 #ifdef DEBUG_OSOPTION
11936 cout << "Set random ConstraintOption" << endl;
11937 #endif
11938 if (OSRand() <= density)
11939 {
11940 this->initialConstraintValues = new InitConstraintValues();
11941 this->initialConstraintValues->setRandom(density, conformant);
11942 }
11943 return false;
11944 if (OSRand() <= density)
11945 {
11946 this->initialDualValues = new InitDualVariableValues();
11947 this->initialDualValues->setRandom(density, conformant);
11948 }
11949 if (OSRand() <= density)
11950 {
11951 this->initialBasisStatus = new BasisStatus();
11952 this->initialBasisStatus->setRandom(density, conformant, 0, 4);
11953 }
11954
11955 if (OSRand() <= density)
11956 {
11957 this->numberOfOtherConstraintOptions = (int)(4*OSRand());
11958
11959 int n;
11960
11961 if (conformant) n = this->numberOfOtherConstraintOptions;
11962 else n = (int)(4*OSRand());
11963
11964 other = new OtherConstraintOption*[n];
11965 for (int i = 0; i < n; i++)
11966 {
11967 other[i] = new OtherConstraintOption();
11968 other[i]->setRandom(density, conformant);
11969 }
11970 }
11971 return true;
11972 }
11973
11974 bool InitConstraintValues::setRandom( double density, bool conformant )
11975 {
11976 #ifdef DEBUG_OSOPTION
11977 cout << "Set random InitConstraintValues" << endl;
11978 #endif
11979 this->numberOfCon = (int)(1+4*OSRand());
11980
11981 int n;
11982
11983 if (conformant) n = this->numberOfCon;
11984 else n = (int)(1+4*OSRand());
11985
11986 con = new InitConValue*[n];
11987 for (int i = 0; i < n; i++)
11988 {
11989 con[i] = new InitConValue();
11990 con[i]->setRandom(density, conformant);
11991 }
11992 return true;
11993 }
11994
11995 bool InitConValue::setRandom( double density, bool conformant )
11996 {
11997 #ifdef DEBUG_OSOPTION
11998 cout << "Set random InitConValue" << endl;
11999 #endif
12000 this->idx = (int)(4*OSRand());
12001
12002 if (OSRand() <= density) this->name = "random string";
12003
12004 if (OSRand() <= density)
12005 {
12006 if (OSRand() <= 0.5) this->value = 3.14156;
12007 else this->value = 2.71828;
12008 }
12009 return true;
12010 }
12011
12012 bool InitDualVariableValues::setRandom( double density, bool conformant )
12013 {
12014 #ifdef DEBUG_OSOPTION
12015 cout << "Set random InitDualVariableValues" << endl;
12016 #endif
12017 this->numberOfCon = (int)(1+4*OSRand());
12018
12019 int n;
12020
12021 if (conformant) n = this->numberOfCon;
12022 else n = (int)(1+4*OSRand());
12023
12024 con = new InitDualVarValue*[n];
12025 for (int i = 0; i < n; i++)
12026 {
12027 con[i] = new InitDualVarValue();
12028 con[i]->setRandom(density, conformant);
12029 }
12030 return true;
12031 }
12032
12033 bool InitDualVarValue::setRandom( double density, bool conformant )
12034 {
12035 #ifdef DEBUG_OSOPTION
12036 cout << "Set random InitDualVarValue" << endl;
12037 #endif
12038 this->idx = (int)(4*OSRand());
12039
12040 if (OSRand() <= density) this->name = "random string";
12041
12042 if (OSRand() <= density)
12043 {
12044 if (OSRand() <= 0.5) this->lbDualValue = 3.14156;
12045 else this->lbDualValue = 2.71828;
12046 if (OSRand() <= 0.5) this->ubDualValue = 3.14156;
12047 else this->ubDualValue = 2.71828;
12048 }
12049 return true;
12050 }
12051
12052 bool OtherConstraintOption::setRandom( double density, bool conformant )
12053 {
12054 #ifdef DEBUG_OSOPTION
12055 cout << "Set random OtherConstraintOption" << endl;
12056 #endif
12057 this->name = "random string";
12058 if (OSRand() <= density) this->name = "randon string";
12059 if (OSRand() <= density) this->value = "randon string";
12060 if (OSRand() <= density) this->solver = "randon string";
12061 if (OSRand() <= density) this->category = "randon string";
12062 if (OSRand() <= density) this->type = "randon string";
12063 if (OSRand() <= density) this->description = "randon string";
12064
12065 if (OSRand() <= density)
12066 {
12067 if (OSRand() <= 0.5)
12068 {
12069 this->numberOfCon = (int)(4*OSRand());
12070
12071 int n;
12072
12073 if (conformant) n = this->numberOfCon;
12074 else n = (int)(4*OSRand());
12075
12076 con = new OtherConOption*[n];
12077 for (int i = 0; i < n; i++)
12078 {
12079 con[i] = new OtherConOption();
12080 con[i]->setRandom(density, conformant);
12081 }
12082 }
12083 else
12084 {
12085 this->numberOfEnumerations = (int)(4*OSRand());
12086
12087 int n;
12088
12089 if (conformant) n = this->numberOfEnumerations;
12090 else n = (int)(4*OSRand());
12091
12092 enumeration = new OtherOptionEnumeration*[n];
12093 for (int i = 0; i < n; i++)
12094 {
12095 enumeration[i] = new OtherOptionEnumeration();
12096 enumeration[i]->setRandom(density, conformant, 0, 4);
12097 }
12098 }
12099 }
12100 return true;
12101 }
12102
12103 bool OtherConOption::setRandom( double density, bool conformant )
12104 {
12105 #ifdef DEBUG_OSOPTION
12106 cout << "Set random OtherConOption" << endl;
12107 #endif
12108 this->idx = (int)(4*OSRand());
12109 if (OSRand() <= density) this->name = "random string";
12110 if (OSRand() <= density) this->value = "random string";
12111 if (OSRand() <= density) this->lbValue = "random string";
12112 if (OSRand() <= density) this->ubValue = "random string";
12113 return true;
12114 }
12115
12116
12117 bool SolverOptions::setRandom( double density, bool conformant )
12118 {
12119 #ifdef DEBUG_OSOPTION
12120 cout << "Set random SolverOptions" << endl;
12121 #endif
12122 this->numberOfSolverOptions = (int)(1+4*OSRand());
12123
12124 int n;
12125
12126 if (conformant) n = this->numberOfSolverOptions;
12127 else n = (int)(1+4*OSRand());
12128
12129 solverOption = new SolverOption*[n];
12130 for (int i = 0; i < n; i++)
12131 {
12132 solverOption[i] = new SolverOption();
12133 solverOption[i]->setRandom(density, conformant);
12134 }
12135 return true;
12136 }
12137
12138 bool SolverOption::setRandom( double density, bool conformant )
12139 {
12140 #ifdef DEBUG_OSOPTION
12141 cout << "Set random SolverOption" << endl;
12142 #endif
12143 if (OSRand() <= density || conformant) this->name = "random string";
12144
12145 if (OSRand() <= density) this->value = "random string";
12146 if (OSRand() <= density) this->solver = "random string";
12147 if (OSRand() <= density) this->category = "random string";
12148 if (OSRand() <= density) this->type = "random string";
12149 if (OSRand() <= density) this->description = "random string";
12150
12151 if (OSRand() <= density)
12152 {
12153 this->numberOfItems = (int)(4*OSRand());
12154
12155 int n;
12156
12157 if (conformant) n = this->numberOfItems;
12158 else n = (int)(4*OSRand());
12159
12160 item = new std::string[n];
12161 for (int i = 0; i < n; i++)
12162 item[i] = "random string";
12163 }
12164 return true;
12165 }