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