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