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