00001
00016 #include "OSResult.h"
00017 #include "OSParameters.h"
00018 #include "OSErrorClass.h"
00019 #include "OSGeneral.h"
00020 #include "OSParameters.h"
00021 #include "OSMathUtil.h"
00022
00023 #include<iostream>
00024 #include<sstream>
00025
00026
00027
00028 #define DEBUG_ISEQUAL_ROUTINES 1 // Unequal components only
00029
00030
00031 using namespace std;
00032
00038 GeneralSubstatus::GeneralSubstatus():
00039 name( ""),
00040 description( "")
00041 {
00042 #ifdef DEBUG_OSRESULT
00043 cout << "Inside the GeneralSubstatus Constructor" << endl;
00044 #endif
00045 }
00046
00047 GeneralSubstatus::~GeneralSubstatus()
00048 {
00049 #ifdef DEBUG_OSRESULT
00050 cout << "Inside the GeneralSubstatus Destructor" << endl;
00051 #endif
00052 }
00053
00054
00055 GeneralStatus::GeneralStatus():
00056 numberOfSubstatuses (0),
00057 type( ""),
00058 description( ""),
00059 substatus (NULL)
00060 {
00061 #ifdef DEBUG_OSRESULT
00062 cout << "Inside the GeneralStatus Constructor" << endl;
00063 #endif
00064 }
00065
00066 GeneralStatus::~GeneralStatus()
00067 {
00068 #ifdef DEBUG_OSRESULT
00069 cout << "Inside the GeneralStatus Destructor" << endl;
00070 #endif
00071 if (substatus != NULL)
00072 {
00073 for (int i = 0; i < numberOfSubstatuses; i++)
00074 {
00075 delete substatus[i];
00076 substatus[i] = NULL;
00077 }
00078 delete[] substatus;
00079 substatus = NULL;
00080 }
00081 }
00082
00083
00084 OtherResult::OtherResult():
00085 name( ""),
00086 value( ""),
00087 description( "")
00088 {
00089 #ifdef DEBUG_OSRESULT
00090 cout << "Inside the OtherResult Constructor" << endl;
00091 #endif
00092 }
00093
00094 OtherResult::~OtherResult()
00095 {
00096 #ifdef DEBUG_OSRESULT
00097 cout << "Inside the OtherResult Destructor" << endl;
00098 #endif
00099 }
00100
00101
00102 OtherResults::OtherResults():
00103 numberOfOtherResults( 0),
00104 other( NULL)
00105 {
00106 #ifdef DEBUG_OSRESULT
00107 cout << "Inside the OtherResults Constructor" << endl;
00108 #endif
00109 }
00110
00111 OtherResults::~OtherResults()
00112 {
00113 #ifdef DEBUG_OSRESULT
00114 cout << "Inside the OtherResults Destructor" << endl;
00115 #endif
00116 if (other != NULL)
00117 {
00118 for (int i = 0; i < numberOfOtherResults; i++)
00119 {
00120 delete other[i];
00121 other[i] = NULL;
00122 }
00123 delete[] other;
00124 other = NULL;
00125 }
00126 }
00127
00128
00129 GeneralResult::GeneralResult():
00130 generalStatus(NULL),
00131 message(""),
00132 serviceURI(""),
00133 serviceName(""),
00134 instanceName(""),
00135 jobID(""),
00136 solverInvoked(""),
00137 timeStamp(""),
00138 otherResults(NULL)
00139 {
00140 #ifdef DEBUG_OSRESULT
00141 cout << "Inside the GeneralResult Constructor" << endl;
00142 #endif
00143 }
00144
00145
00146 GeneralResult::~GeneralResult()
00147 {
00148 #ifdef DEBUG_OSRESULT
00149 cout << "GeneralResult Destructor Called" << endl;
00150 #endif
00151 if (generalStatus != NULL)
00152 {
00153 delete generalStatus;
00154 generalStatus = NULL;
00155 }
00156 if (otherResults != NULL)
00157 {
00158 delete otherResults;
00159 otherResults = NULL;
00160 }
00161 }
00162
00163 SystemResult::SystemResult():
00164 systemInformation(""),
00165 availableDiskSpace(NULL),
00166 availableMemory(NULL),
00167 availableCPUSpeed(NULL),
00168 availableCPUNumber(NULL),
00169 otherResults(NULL)
00170 {
00171 #ifdef DEBUG_OSRESULT
00172 cout << "Inside the SystemResult Constructor" << endl;
00173 #endif
00174 }
00175
00176
00177 SystemResult::~SystemResult()
00178 {
00179 #ifdef DEBUG_OSRESULT
00180 cout << "SystemResult Destructor Called" << endl;
00181 #endif
00182 if (availableDiskSpace != NULL)
00183 {
00184 delete availableDiskSpace;
00185 availableDiskSpace = NULL;
00186 }
00187 if (availableMemory != NULL)
00188 {
00189 delete availableMemory;
00190 availableMemory = NULL;
00191 }
00192 if (availableCPUSpeed != NULL)
00193 {
00194 delete availableCPUSpeed;
00195 availableCPUSpeed = NULL;
00196 }
00197 if (availableCPUNumber != NULL)
00198 {
00199 delete availableCPUNumber;
00200 availableCPUNumber = NULL;
00201 }
00202 if (otherResults != NULL)
00203 {
00204 delete otherResults;
00205 otherResults = NULL;
00206 }
00207 }
00208
00209
00210 ServiceResult::ServiceResult():
00211 currentState("unknown"),
00212 currentJobCount(-1),
00213 totalJobsSoFar(-1),
00214 timeServiceStarted("1970-01-01T00:00:00-00:00"),
00215 serviceUtilization(-1.0),
00216 otherResults(NULL)
00217 {
00218 #ifdef DEBUG_OSRESULT
00219 cout << "Inside the ServiceResult Constructor" << endl;
00220 #endif
00221 }
00222
00223
00224 ServiceResult::~ServiceResult()
00225 {
00226 #ifdef DEBUG_OSRESULT
00227 cout << "ServiceResult Destructor Called" << endl;
00228 #endif
00229 if (otherResults != NULL)
00230 {
00231 delete otherResults;
00232 otherResults = NULL;
00233 }
00234 }
00235
00236 #if 0
00237 Time::Time():
00238 type("elapsedTime"),
00239 category("total"),
00240 unit("second"),
00241 description(""),
00242 value(0.0)
00243 {
00244 #ifdef DEBUG_OSRESULT
00245 cout << "Inside the Time Constructor" << endl;
00246 #endif
00247 }
00248
00249
00250 Time::~Time()
00251 {
00252 #ifdef DEBUG_OSRESULT
00253 cout << "Inside the Time Destructor" << endl;
00254 #endif
00255
00256 }
00257 #endif
00258
00259 TimeMeasurement::TimeMeasurement():
00260 TimeSpan(),
00261 type("elapsedTime"),
00262 category("total"),
00263 description("")
00264 {
00265 #ifdef DEBUG_OSRESULT
00266 cout << "Inside the TimeMeasurement Constructor" << endl;
00267 #endif
00268 }
00269
00270
00271 TimeMeasurement::~TimeMeasurement()
00272 {
00273 #ifdef DEBUG_OSRESULT
00274 cout << "Inside the TimeMeasurement Destructor" << endl;
00275 #endif
00276
00277 }
00278
00279 TimingInformation::TimingInformation():
00280 numberOfTimes(0),
00281 time(NULL)
00282 {
00283 #ifdef DEBUG_OSRESULT
00284 cout << "Inside the TimingInformation Constructor" << endl;
00285 #endif
00286 }
00287
00288
00289 TimingInformation::~TimingInformation()
00290 {
00291 #ifdef DEBUG_OSRESULT
00292 cout << "Inside the TimingInformation Destructor" << endl;
00293 #endif
00294 if (time != NULL)
00295 {
00296 for (int i = 0; i < numberOfTimes; i++)
00297 {
00298 delete time[i];
00299 time[i] = NULL;
00300 }
00301 delete[] time;
00302 time = NULL;
00303 }
00304 }
00305
00306 JobResult::JobResult():
00307 status("finished"),
00308 submitTime("1970-01-01T00:00:00-00:00"),
00309 scheduledStartTime("1970-01-01T00:00:00-00:00"),
00310 actualStartTime("1970-01-01T00:00:00-00:00"),
00311 endTime("1970-01-01T00:00:00-00:00"),
00312 timingInformation(NULL),
00313 usedDiskSpace(NULL),
00314 usedMemory(NULL),
00315 usedCPUSpeed(NULL),
00316 usedCPUNumber(NULL),
00317 otherResults(NULL)
00318 {
00319 #ifdef DEBUG_OSRESULT
00320 cout << "Inside the JobResult Constructor" << endl;
00321 #endif
00322 timingInformation = NULL;
00323 }
00324
00325
00326 JobResult::~JobResult()
00327 {
00328 #ifdef DEBUG_OSRESULT
00329 cout << "Inside the JobResult Destructor" << endl;
00330 #endif
00331 if (timingInformation != NULL)
00332 {
00333 delete timingInformation;
00334 timingInformation = NULL;
00335 }
00336 if (usedDiskSpace != NULL)
00337 {
00338 delete usedDiskSpace;
00339 usedDiskSpace = NULL;
00340 }
00341 if (usedMemory != NULL)
00342 {
00343 delete usedMemory;
00344 usedMemory = NULL;
00345 }
00346 if (usedCPUSpeed != NULL)
00347 {
00348 delete usedCPUSpeed;
00349 usedCPUSpeed = NULL;
00350 }
00351 if (usedCPUNumber != NULL)
00352 {
00353 delete usedCPUNumber;
00354 usedCPUNumber = NULL;
00355 }
00356 if (otherResults != NULL)
00357 {
00358 delete otherResults;
00359 otherResults = NULL;
00360 }
00361 }
00362
00363
00364 OptimizationSolutionSubstatus::OptimizationSolutionSubstatus():
00365 type(""),
00366 description("")
00367 {
00368 #ifdef DEBUG_OSRESULT
00369 cout << "Inside the OptimizationSolutionSubstatus Constructor" << endl;
00370 #endif
00371 }
00372
00373
00374 OptimizationSolutionSubstatus::~OptimizationSolutionSubstatus()
00375 {
00376 #ifdef DEBUG_OSRESULT
00377 cout << "Inside the OptimizationSolutionSubstatus Destructor" << endl;
00378 #endif
00379 }
00380
00381
00382 OptimizationSolutionStatus::OptimizationSolutionStatus():
00383 numberOfSubstatuses(0),
00384 type(""),
00385 description(""),
00386 substatus(NULL)
00387 {
00388 #ifdef DEBUG_OSRESULT
00389 cout << "Inside the OptimizationSolutionStatus Constructor" << endl;
00390 #endif
00391 }
00392
00393
00394 OptimizationSolutionStatus::~OptimizationSolutionStatus()
00395 {
00396 #ifdef DEBUG_OSRESULT
00397 cout << "Inside the OptimizationSolutionStatus Destructor" << endl;
00398 #endif
00399 if (substatus != NULL)
00400 {
00401 for (int i = 0; i < numberOfSubstatuses; i++)
00402 {
00403 delete substatus[i];
00404 substatus[i] = NULL;
00405 }
00406 delete[] substatus;
00407 substatus = NULL;
00408 }
00409 }
00410
00411
00412 VarValue::VarValue():
00413 idx( -1),
00414 name(""),
00415 value( 0)
00416 {
00417 #ifdef DEBUG_OSRESULT
00418 cout << "Inside the VarValue Constructor" << endl;
00419 #endif
00420 }
00421
00422
00423 VarValue::~VarValue()
00424 {
00425 #ifdef DEBUG_OSRESULT
00426 cout << "Inside the VarValue Destructor" << endl;
00427 #endif
00428 }
00429
00430
00431
00432 VariableValues::VariableValues():
00433 numberOfVar(0),
00434 var(NULL)
00435 {
00436 #ifdef DEBUG_OSRESULT
00437 cout << "Inside the VariableValues Constructor" << endl;
00438 #endif
00439 }
00440
00441
00442 VariableValues::~VariableValues()
00443 {
00444 #ifdef DEBUG_OSRESULT
00445 cout << "Inside the VariableValues Destructor" << endl;
00446 #endif
00447 if(var != NULL)
00448 {
00449 for(int i = 0; i < numberOfVar; i++)
00450 {
00451 delete var[i];
00452 var[i] = NULL;
00453 }
00454 delete[] var;
00455 var = NULL;
00456 }
00457 }
00458
00459
00460 VarValueString::VarValueString():
00461 idx( -1),
00462 name(""),
00463 value( "")
00464 {
00465 #ifdef DEBUG_OSRESULT
00466 cout << "Inside the VarValueString Constructor" << endl;
00467 #endif
00468 }
00469
00470
00471 VarValueString::~VarValueString()
00472 {
00473 #ifdef DEBUG_OSRESULT
00474 cout << "Inside the VarValueString Destructor" << endl;
00475 #endif
00476 }
00477
00478
00479
00480 VariableValuesString::VariableValuesString():
00481 numberOfVar(0),
00482 var(NULL)
00483 {
00484 #ifdef DEBUG_OSRESULT
00485 cout << "Inside the VariableValuesString Constructor" << endl;
00486 #endif
00487 }
00488
00489
00490 VariableValuesString::~VariableValuesString()
00491 {
00492 #ifdef DEBUG_OSRESULT
00493 cout << "Inside the VariableValuesString Destructor" << endl;
00494 #endif
00495 if(var != NULL)
00496 {
00497 for(int i = 0; i < numberOfVar; i++)
00498 {
00499 delete var[i];
00500 var[i] = NULL;
00501 }
00502 delete[] var;
00503 var = NULL;
00504 }
00505 }
00506
00507
00508 OtherVarResult::OtherVarResult():
00509 idx( -1),
00510 name(""),
00511 value( "")
00512 {
00513 #ifdef DEBUG_OSRESULT
00514 cout << "Inside the OtherVarResult Constructor" << endl;
00515 #endif
00516 }
00517
00518
00519 OtherVarResult::~OtherVarResult()
00520 {
00521 #ifdef DEBUG_OSRESULT
00522 cout << "Inside the OtherVarResult Destructor" << endl;
00523 #endif
00524 }
00525
00526
00527
00528 OtherVariableResult::OtherVariableResult():
00529 numberOfVar(0),
00530 numberOfEnumerations(0),
00531 name(""),
00532 value(""),
00533 description(""),
00534 var(NULL),
00535 enumeration(NULL)
00536 {
00537 #ifdef DEBUG_OSRESULT
00538 cout << "Inside the OtherVariableResult Constructor" << endl;
00539 #endif
00540
00541 }
00542
00543
00544 OtherVariableResult::~OtherVariableResult()
00545 {
00546 #ifdef DEBUG_OSRESULT
00547 cout << "Inside the OtherVariableResult Destructor" << endl;
00548 #endif
00549 if (var != NULL)
00550 {
00551 for(int i = 0; i < numberOfVar; i++)
00552 {
00553 delete var[i];
00554 var[i] = NULL;
00555 }
00556 delete[] var;
00557 var = NULL;
00558 }
00559 if (enumeration != NULL)
00560 {
00561 for(int i = 0; i < numberOfEnumerations; i++)
00562 {
00563 delete enumeration[i];
00564 enumeration[i] = NULL;
00565 }
00566 delete[] enumeration;
00567 enumeration = NULL;
00568 }
00569 #ifdef DEBUG_OSRESULT
00570 cout << "Inside the OtherVariableResult Destructor - Done" << endl;
00571 #endif
00572 }
00573
00574
00575 VariableSolution::VariableSolution():
00576 numberOfOtherVariableResults( 0),
00577 values( NULL),
00578 valuesString( NULL),
00579 basisStatus(NULL),
00580 other( NULL)
00581 {
00582 #ifdef DEBUG_OSRESULT
00583 cout << "Inside the VariableSolution Constructor" << endl;
00584 #endif
00585 }
00586
00587
00588 VariableSolution::~VariableSolution()
00589 {
00590 #ifdef DEBUG_OSRESULT
00591 cout << "Inside the VariableSolution Destructor" << endl;
00592 #endif
00593 if (values != NULL)
00594 {
00595 delete values;
00596 values = NULL;
00597 }
00598 if (valuesString != NULL)
00599 {
00600 delete valuesString;
00601 valuesString = NULL;
00602 }
00603 if (basisStatus != NULL)
00604 {
00605 delete basisStatus;
00606 basisStatus = NULL;
00607 }
00608 if(numberOfOtherVariableResults > 0 && other != NULL)
00609 {
00610 for(int i = 0; i < numberOfOtherVariableResults; i++)
00611 {
00612 delete other[i];
00613 other[i] = NULL;
00614 }
00615 delete[] other;
00616 other = NULL;
00617 }
00618 }
00619
00620
00621
00622 ObjValue::ObjValue():
00623 idx( -1),
00624 name(""),
00625 value(0.0)
00626
00627 {
00628 #ifdef DEBUG_OSRESULT
00629 cout << "Inside the ObjValue Constructor" << endl;
00630 #endif
00631 }
00632
00633 ObjValue::~ObjValue()
00634 {
00635 #ifdef DEBUG_OSRESULT
00636 cout << "Inside the ObjValue Destructor" << endl;
00637 #endif
00638 }
00639
00640
00641
00642 ObjectiveValues::ObjectiveValues():
00643 numberOfObj(0),
00644 obj(NULL)
00645 {
00646 #ifdef DEBUG_OSRESULT
00647 cout << "Inside the ObjectiveValues Constructor" << endl;
00648 #endif
00649
00650 }
00651
00652
00653 ObjectiveValues::~ObjectiveValues()
00654 {
00655 #ifdef DEBUG_OSRESULT
00656 cout << "Inside the ObjectiveValues Destructor" << endl;
00657 #endif
00658 if((obj != NULL) && (numberOfObj > 0) )
00659 {
00660 for(int i = 0; i < numberOfObj; i++)
00661 {
00662 delete obj[i];
00663 obj[i] = NULL;
00664 }
00665 delete[] obj;
00666 obj = NULL;
00667 }
00668 }
00669
00670
00671 OtherObjResult::OtherObjResult():
00672 idx(-1),
00673 name(""),
00674 value( "")
00675 {
00676 #ifdef DEBUG_OSRESULT
00677 cout << "Inside the OtherObjResult Constructor" << endl;
00678 #endif
00679 }
00680
00681
00682 OtherObjResult::~OtherObjResult()
00683 {
00684 #ifdef DEBUG_OSRESULT
00685 cout << "Inside the OtherObjResult Destructor" << endl;
00686 #endif
00687 }
00688
00689
00690 OtherObjectiveResult::OtherObjectiveResult():
00691 numberOfObj(0),
00692 numberOfEnumerations(0),
00693 name(""),
00694 value(""),
00695 description(""),
00696 obj(NULL),
00697 enumeration(NULL)
00698 {
00699 #ifdef DEBUG_OSRESULT
00700 cout << "Inside the OtherObjectiveResult Constructor" << endl;
00701 #endif
00702 }
00703
00704
00705 OtherObjectiveResult::~OtherObjectiveResult()
00706 {
00707 #ifdef DEBUG_OSRESULT
00708 cout << "Inside the OtherObjectiveResult Destructor" << endl;
00709 #endif
00710 if(obj != NULL)
00711 {
00712 for(int i = 0; i < numberOfObj; i++)
00713 {
00714 delete obj[i];
00715 obj[i] = NULL;
00716 }
00717 delete[] obj;
00718 obj = NULL;
00719 }
00720 if (enumeration != NULL)
00721 {
00722 for(int i = 0; i < numberOfEnumerations; i++)
00723 {
00724 delete enumeration[i];
00725 enumeration[i] = NULL;
00726 }
00727 delete[] enumeration;
00728 enumeration = NULL;
00729 }
00730 }
00731
00732
00733 ObjectiveSolution::ObjectiveSolution():
00734 numberOfOtherObjectiveResults( 0),
00735 values( NULL),
00736 basisStatus(NULL),
00737 other( NULL)
00738 {
00739 #ifdef DEBUG_OSRESULT
00740 cout << "Inside the ObjectiveSolution Constructor" << endl;
00741 #endif
00742 }
00743
00744
00745 ObjectiveSolution::~ObjectiveSolution()
00746 {
00747 #ifdef DEBUG_OSRESULT
00748 cout << "Inside the ObjectiveSolution Destructor" << endl;
00749 #endif
00750 if (values != NULL)
00751 {
00752 delete values;
00753 values = NULL;
00754 }
00755 if (basisStatus != NULL)
00756 {
00757 delete basisStatus;
00758 basisStatus = NULL;
00759 }
00760 if(numberOfOtherObjectiveResults > 0 && other != NULL)
00761 {
00762 for(int i = 0; i < numberOfOtherObjectiveResults; i++)
00763 {
00764 delete other[i];
00765 other[i] = NULL;
00766 }
00767 delete[] other;
00768 other = NULL;
00769 }
00770 }
00771
00772
00773 DualVarValue::DualVarValue():
00774 idx( -1),
00775 name(""),
00776
00777
00778 value( 0)
00779 {
00780 #ifdef DEBUG_OSRESULT
00781 cout << "Inside the DualVarValue Constructor" << endl;
00782 #endif
00783 }
00784
00785
00786 DualVarValue::~DualVarValue()
00787 {
00788 #ifdef DEBUG_OSRESULT
00789 cout << "Inside the DualVarValue Destructor" << endl;
00790 #endif
00791 }
00792
00793
00794 DualVariableValues::DualVariableValues():
00795 numberOfCon(0),
00796 con(NULL)
00797 {
00798 #ifdef DEBUG_OSRESULT
00799 cout << "Inside the DualVariableValues Constructor" << endl;
00800 #endif
00801
00802 }
00803
00804
00805 DualVariableValues::~DualVariableValues()
00806 {
00807 #ifdef DEBUG_OSRESULT
00808 cout << "Inside the DualVariableValues Destructor" << endl;
00809 #endif
00810 if (con != NULL)
00811 {
00812 for(int i = 0; i < numberOfCon; i++)
00813 {
00814 delete con[i];
00815 con[i] = NULL;
00816 }
00817 delete[] con;
00818 con = NULL;
00819 }
00820 }
00821
00822
00823 OtherConResult::OtherConResult():
00824 idx( -1),
00825 name(""),
00826 value( "")
00827 {
00828 #ifdef DEBUG_OSRESULT
00829 cout << "Inside the OtherConResult Constructor" << endl;
00830 #endif
00831 }
00832
00833
00834 OtherConResult::~OtherConResult()
00835 {
00836 #ifdef DEBUG_OSRESULT
00837 cout << "Inside the OtherConResult Destructor" << endl;
00838 #endif
00839 }
00840
00841
00842
00843 OtherConstraintResult::OtherConstraintResult():
00844 numberOfCon(0),
00845 numberOfEnumerations(0),
00846 name(""),
00847 value(""),
00848 description(""),
00849 con(NULL),
00850 enumeration(NULL)
00851 {
00852 #ifdef DEBUG_OSRESULT
00853 cout << "Inside the OtherConstraintResult Constructor" << endl;
00854 #endif
00855 }
00856
00857
00858 OtherConstraintResult::~OtherConstraintResult()
00859 {
00860 #ifdef DEBUG_OSRESULT
00861 cout << "Inside the OtherConstraintResult Destructor" << endl;
00862 #endif
00863 if (con != NULL)
00864 {
00865 for(int i = 0; i < numberOfCon; i++)
00866 {
00867 delete con[i];
00868 con[i] = NULL;
00869 }
00870 delete[] con;
00871 con = NULL;
00872 }
00873 if (enumeration != NULL)
00874 {
00875 for(int i = 0; i < numberOfEnumerations; i++)
00876 {
00877 delete enumeration[i];
00878 enumeration[i] = NULL;
00879 }
00880 delete[] enumeration;
00881 enumeration = NULL;
00882 }
00883 }
00884
00885
00886
00887 ConstraintSolution::ConstraintSolution():
00888 numberOfOtherConstraintResults( 0),
00889 dualValues( NULL),
00890 basisStatus(NULL),
00891 other( NULL)
00892 {
00893 #ifdef DEBUG_OSRESULT
00894 cout << "Inside the ConstraintSolution Constructor" << endl;
00895 #endif
00896 }
00897
00898
00899 ConstraintSolution::~ConstraintSolution()
00900 {
00901 #ifdef DEBUG_OSRESULT
00902 cout << "Inside the ConstraintSolution Destructor" << endl;
00903 #endif
00904 if (dualValues != NULL)
00905 {
00906 delete dualValues;
00907 dualValues = NULL;
00908 }
00909 if (basisStatus != NULL)
00910 {
00911 delete basisStatus;
00912 basisStatus = NULL;
00913 }
00914 if(numberOfOtherConstraintResults > 0 && other != NULL)
00915 {
00916 for(int i = 0; i < numberOfOtherConstraintResults; i++)
00917 {
00918 delete other[i];
00919 other[i] = NULL;
00920 }
00921 delete[] other;
00922 other = NULL;
00923 }
00924 }
00925
00926
00927
00928 OtherSolutionResult::OtherSolutionResult():
00929 name( ""),
00930 category (""),
00931 description (""),
00932 numberOfItems (0),
00933 item( NULL)
00934 {
00935 #ifdef DEBUG_OSRESULT
00936 cout << "Inside the OtherSolutionResult Constructor" << endl;
00937 #endif
00938 }
00939
00940
00941 OtherSolutionResult::~OtherSolutionResult()
00942 {
00943 #ifdef DEBUG_OSRESULT
00944 cout << "Inside the OtherSolutionResult Destructor" << endl;
00945 #endif
00946 if (item != NULL)
00947 {
00948
00949
00950
00951
00952 delete[] item;
00953 item = NULL;
00954 }
00955 }
00956
00957
00958
00959 OtherSolutionResults::OtherSolutionResults():
00960 numberOfOtherSolutionResults( 0),
00961 otherSolutionResult( NULL)
00962 {
00963 #ifdef DEBUG_OSRESULT
00964 cout << "Inside the OtherSolutionResults Constructor" << endl;
00965 #endif
00966 }
00967
00968
00969 OtherSolutionResults::~OtherSolutionResults()
00970 {
00971 #ifdef DEBUG_OSRESULT
00972 cout << "Inside the OtherSolutionResults Destructor" << endl;
00973 #endif
00974 if(numberOfOtherSolutionResults > 0 && otherSolutionResult != NULL)
00975 {
00976 for(int i = 0; i < numberOfOtherSolutionResults; i++)
00977 {
00978 delete otherSolutionResult[i];
00979 otherSolutionResult[i] = NULL;
00980 }
00981 delete[] otherSolutionResult;
00982 otherSolutionResult = NULL;
00983 }
00984 }
00985
00986
00987
00988 OptimizationSolution::OptimizationSolution():
00989 targetObjectiveIdx( -1),
00990 targetObjectiveName(""),
00991 weightedObjectives(false),
00992 status(NULL),
00993 message( ""),
00994 variables( NULL),
00995 objectives( NULL),
00996 constraints( NULL),
00997 otherSolutionResults( NULL)
00998
00999 {
01000 #ifdef DEBUG_OSRESULT
01001 cout << "Inside the OptimizationSolution Constructor" << endl;
01002 #endif
01003 }
01004
01005
01006 OptimizationSolution::~OptimizationSolution()
01007 {
01008 #ifdef DEBUG_OSRESULT
01009 cout << "Inside the OptimzationSolution Destructor" << endl;
01010 #endif
01011 if(status != NULL)
01012 {
01013 delete status;
01014 status = NULL;
01015 }
01016 if(variables != NULL)
01017 {
01018 delete variables;
01019 variables = NULL;
01020 }
01021 if(constraints != NULL)
01022 {
01023 delete constraints;
01024 constraints = NULL;
01025 }
01026 if(objectives != NULL)
01027 {
01028 delete objectives;
01029 objectives = NULL;
01030 }
01031 if(otherSolutionResults != NULL)
01032 {
01033 delete otherSolutionResults;
01034 otherSolutionResults = NULL;
01035 }
01036 }
01037
01038
01039 SolverOutput::SolverOutput():
01040 name( ""),
01041 category (""),
01042 description (""),
01043 numberOfItems (0),
01044 item( NULL)
01045 {
01046 #ifdef DEBUG_OSRESULT
01047 cout << "Inside the SolverOutput Constructor" << endl;
01048 #endif
01049 }
01050
01051
01052 SolverOutput::~SolverOutput()
01053 {
01054 #ifdef DEBUG_OSRESULT
01055 cout << "Inside the SolverOutput Destructor" << endl;
01056 #endif
01057 if (item != NULL)
01058 {
01059
01060
01061
01062
01063 delete[] item;
01064 item = NULL;
01065 }
01066 }
01067
01068
01069
01070 OtherSolverOutput::OtherSolverOutput():
01071 numberOfSolverOutputs(0),
01072 solverOutput(NULL)
01073 {
01074 #ifdef DEBUG_OSRESULT
01075 cout << "Inside the OtherSolverOutput Constructor" << endl;
01076 #endif
01077
01078 }
01079
01080
01081 OtherSolverOutput::~OtherSolverOutput()
01082 {
01083 #ifdef DEBUG_OSRESULT
01084 cout << "Inside the OtherSolverOutput Destructor" << endl;
01085 #endif
01086 if (solverOutput != NULL)
01087 {
01088 for(int i = 0; i < numberOfSolverOutputs; i++)
01089 {
01090 delete solverOutput[i];
01091 solverOutput[i] = NULL;
01092 }
01093 delete[] solverOutput;
01094 solverOutput = NULL;
01095 }
01096 }
01097
01098
01099
01100 OptimizationResult::OptimizationResult():
01101 numberOfSolutions(0),
01102 numberOfVariables( -1),
01103 numberOfObjectives( -1),
01104 numberOfConstraints(-1),
01105 solution(NULL),
01106 otherSolverOutput(NULL)
01107 {
01108 #ifdef DEBUG_OSRESULT
01109 cout << "Inside the OptimizationResult Constructor" << endl;
01110 #endif
01111 }
01112
01113
01114 OptimizationResult::~OptimizationResult()
01115 {
01116 #ifdef DEBUG_OSRESULT
01117 cout << "OptimizationResult Destructor Called" << endl;
01118 #endif
01119 if( solution != NULL)
01120 {
01121 for(int i = 0; i < this->numberOfSolutions; i++)
01122 {
01123 delete solution[i];
01124 solution[i] = NULL;
01125 #ifdef DEBUG_OSRESULT
01126 cout << "Deleting Solution: " << i << endl;
01127 #endif
01128 }
01129 delete[] solution;
01130 solution = NULL;
01131 if( otherSolverOutput != NULL)
01132 {
01133 delete otherSolverOutput;
01134 otherSolverOutput = NULL;
01135 }
01136 }
01137 }
01138
01139
01140 OSResult::OSResult():
01141 m_iVariableNumber( -1),
01142 m_iObjectiveNumber( -1),
01143 m_iConstraintNumber( -1),
01144 m_iNumberOfOtherVariableResults( -1),
01145 m_mdPrimalValues( NULL),
01146 m_mdDualValues( NULL)
01147
01148 {
01149 #ifdef DEBUG_OSRESULT
01150 cout << "Inside the OSResult Constructor" << endl;
01151 #endif
01152 resultHeader = NULL;
01153 general = NULL;
01154 system = NULL;
01155 service = NULL;
01156 job = NULL;
01157 optimization = NULL;
01158 }
01159
01160 OSResult::~OSResult()
01161 {
01162 #ifdef DEBUG_OSRESULT
01163 cout << "OSResult Destructor Called" << endl;
01164 #endif
01165
01166
01167 if (resultHeader != NULL)
01168 {
01169 delete resultHeader;
01170 resultHeader = NULL;
01171 }
01172
01173 if (general != NULL)
01174 {
01175 delete general;
01176 general = NULL;
01177 }
01178
01179 if (system != NULL)
01180 {
01181 delete system;
01182 system = NULL;
01183 }
01184
01185 if (service != NULL)
01186 {
01187 delete service;
01188 service = NULL;
01189 }
01190
01191 if (job != NULL)
01192 {
01193 delete job;
01194 job = NULL;
01195 }
01196
01197 if (optimization != NULL)
01198 {
01199 delete optimization;
01200 optimization = NULL;
01201 }
01202
01203 int k;
01204
01205 if (m_mdPrimalValues != NULL) delete[] m_mdPrimalValues;
01206 m_mdPrimalValues = 0;
01207
01208 if (m_mdDualValues != NULL) delete[] m_mdDualValues;
01209 m_mdDualValues = 0;
01210
01211 int numPrimalVals = this->primalVals.size();
01212 for (k = 0; k < numPrimalVals; k++)
01213 {
01214 if (this->primalVals[ k] != NULL )
01215 delete this->primalVals[ k];
01216 }
01217 this->primalVals.clear();
01218
01219 int numDualVals = this->dualVals.size();
01220 for (k = 0; k < numDualVals; k++)
01221 {
01222 if (this->dualVals[ k] != NULL )
01223 delete this->dualVals[ k];
01224 }
01225 this->dualVals.clear();
01226 }
01227
01228
01229
01230
01231 GeneralStatus* OSResult::getGeneralStatus()
01232 {
01233 if (general == NULL) return NULL;
01234 return general->generalStatus;
01235 }
01236
01237 string OSResult::getGeneralStatusType()
01238 {
01239 if (general == NULL) return "";
01240 if (general->generalStatus == NULL) return "";
01241 return general->generalStatus->type;
01242 }
01243
01244 string OSResult::getGeneralStatusDescription()
01245 {
01246 if (general == NULL) return "";
01247 if (general->generalStatus == NULL) return "";
01248 return general->generalStatus->description;
01249 }
01250
01251 int OSResult::getNumberOfGeneralSubstatuses()
01252 {
01253 if (general == NULL) return -1;
01254 if (general->generalStatus == NULL) return -1;
01255 return general->generalStatus->numberOfSubstatuses;
01256 }
01257
01258 string OSResult::getGeneralSubstatusName(int i)
01259 {
01260 if (general == NULL) return "";
01261 if (general->generalStatus == NULL) return "";
01262 if (i < 0 || i >= general->generalStatus->numberOfSubstatuses)
01263 throw ErrorClass("idx is outside of range in routine getGeneralSubstatusName()");
01264 if (general->generalStatus->substatus[i] == NULL) return "";
01265 return general->generalStatus->substatus[i]->name;
01266 }
01267
01268 string OSResult::getGeneralSubstatusDescription(int i)
01269 {
01270 if (general == NULL) return "";
01271 if (general->generalStatus == NULL) return "";
01272 if (i < 0 || i >= general->generalStatus->numberOfSubstatuses)
01273 throw ErrorClass("idx is outside of range in routine getGeneralSubstatusDescription()");
01274 if (general->generalStatus->substatus[i] == NULL) return "";
01275 return general->generalStatus->substatus[i]->description;
01276 }
01277
01278 string OSResult::getGeneralMessage()
01279 {
01280 if (general == NULL) return "";
01281 return general->message;
01282 }
01283
01284 string OSResult::getServiceName()
01285 {
01286 if (general == NULL) return "";
01287 return general->serviceName;
01288 }
01289
01290 string OSResult::getServiceURI()
01291 {
01292 if (general == NULL) return "";
01293 return general->serviceURI;
01294 }
01295
01296 string OSResult::getInstanceName()
01297 {
01298 if (general == NULL) return "";
01299 return general->instanceName;
01300 }
01301
01302 string OSResult::getJobID()
01303 {
01304 if (general == NULL) return "";
01305 return general->jobID;
01306 }
01307
01308 string OSResult::getSolverInvoked()
01309 {
01310 if (general == NULL) return "";
01311 return general->solverInvoked;
01312 }
01313
01314 string OSResult::getTimeStamp()
01315 {
01316 if (general == NULL) return "";
01317 return general->timeStamp;
01318 }
01319
01320 int OSResult::getNumberOfOtherGeneralResults()
01321 {
01322 if (general == NULL) return -1;
01323 if (general->otherResults == NULL) return -1;
01324 return general->otherResults->numberOfOtherResults;
01325 }
01326
01327 string OSResult::getOtherGeneralResultName(int idx)
01328 {
01329 if (general == NULL) return "";
01330 if (general->otherResults == NULL) return "";
01331 if (idx < 0 || idx >= general->otherResults->numberOfOtherResults)
01332 throw ErrorClass("idx is outside of range in routine getOtherGeneralResultName()");
01333 if (general->otherResults->other[idx] == NULL) return "";
01334 return general->otherResults->other[idx]->name;
01335 }
01336
01337 string OSResult::getOtherGeneralResultValue(int idx)
01338 {
01339 if (general == NULL) return "";
01340 if (general->otherResults == NULL) return "";
01341 if (idx < 0 || idx >= general->otherResults->numberOfOtherResults)
01342 throw ErrorClass("idx is outside of range in routine getOtherGeneralResultValue()");
01343 if (general->otherResults->other[idx] == NULL) return "";
01344 return general->otherResults->other[idx]->value;
01345 }
01346
01347 string OSResult::getOtherGeneralResultDescription(int idx)
01348 {
01349 if (general == NULL) return "";
01350 if (general->otherResults == NULL) return "";
01351 if (idx < 0 || idx >= general->otherResults->numberOfOtherResults)
01352 throw ErrorClass("idx is outside of range in routine getOtherGeneralResultDescription()");
01353 if (general->otherResults->other[idx] == NULL) return "";
01354 return general->otherResults->other[idx]->description;
01355 }
01356
01357 string OSResult::getSystemInformation()
01358 {
01359 if (system == NULL) return "";
01360 return system->systemInformation;
01361 }
01362
01363 string OSResult::getAvailableDiskSpaceUnit()
01364 {
01365 if (system == NULL) return "";
01366 if (system->availableDiskSpace == NULL) return "";
01367 return system->availableDiskSpace->unit;
01368 }
01369
01370 string OSResult::getAvailableDiskSpaceDescription()
01371 {
01372 if (system == NULL) return "";
01373 if (system->availableDiskSpace == NULL) return "";
01374 return system->availableDiskSpace->description;
01375 }
01376
01377 double OSResult::getAvailableDiskSpaceValue()
01378 {
01379 if (system == NULL) return -1.;
01380 if (system->availableDiskSpace == NULL) return -1.;
01381 return system->availableDiskSpace->value;
01382 }
01383
01384 string OSResult::getAvailableMemoryUnit()
01385 {
01386 if (system == NULL) return "";
01387 if (system->availableMemory == NULL) return "";
01388 return system->availableMemory->unit;
01389 }
01390
01391 string OSResult::getAvailableMemoryDescription()
01392 {
01393 if (system == NULL) return "";
01394 if (system->availableMemory == NULL) return "";
01395 return system->availableMemory->description;
01396 }
01397
01398 double OSResult::getAvailableMemoryValue()
01399 {
01400 if (system == NULL) return -1.;
01401 if (system->availableMemory == NULL) return -1.;
01402 return system->availableMemory->value;
01403 }
01404
01405 string OSResult::getAvailableCPUSpeedUnit()
01406 {
01407 if (system == NULL) return "";
01408 if (system->availableCPUSpeed == NULL) return "";
01409 return system->availableCPUSpeed->unit;
01410 }
01411
01412 string OSResult::getAvailableCPUSpeedDescription()
01413 {
01414 if (system == NULL) return "";
01415 if (system->availableCPUSpeed == NULL) return "";
01416 return system->availableCPUSpeed->description;
01417 }
01418
01419 double OSResult::getAvailableCPUSpeedValue()
01420 {
01421 if (system == NULL) return -1.;
01422 if (system->availableCPUSpeed == NULL) return -1.;
01423 return system->availableCPUSpeed->value;
01424 }
01425
01426 string OSResult::getAvailableCPUNumberDescription()
01427 {
01428 if (system == NULL) return "";
01429 if (system->availableCPUNumber == NULL) return "";
01430 return system->availableCPUNumber->description;
01431 }
01432
01433 int OSResult::getAvailableCPUNumberValue()
01434 {
01435 if (system == NULL) return -1;
01436 if (system->availableCPUNumber == NULL) return -1;
01437 return system->availableCPUNumber->value;
01438 }
01439
01440 int OSResult::getNumberOfOtherSystemResults()
01441 {
01442 if (system == NULL) return -1;
01443 if (system->otherResults == NULL) return -1;
01444 return system->otherResults->numberOfOtherResults;
01445 }
01446
01447 string OSResult::getOtherSystemResultName(int idx)
01448 {
01449 if (system == NULL) return "";
01450 if (system->otherResults == NULL) return "";
01451 if (idx < 0 || idx >= system->otherResults->numberOfOtherResults)
01452 throw ErrorClass("idx is outside of range in routine getOtherSystemResultName()");
01453 if (system->otherResults->other[idx] == NULL) return "";
01454 return system->otherResults->other[idx]->name;
01455 }
01456
01457 string OSResult::getOtherSystemResultValue(int idx)
01458 {
01459 if (system == NULL) return "";
01460 if (system->otherResults == NULL) return "";
01461 if (idx < 0 || idx >= system->otherResults->numberOfOtherResults)
01462 throw ErrorClass("idx is outside of range in routine getOtherSystemResultValue()");
01463 if (system->otherResults->other[idx] == NULL) return "";
01464 return system->otherResults->other[idx]->value;
01465 }
01466
01467 string OSResult::getOtherSystemResultDescription(int idx)
01468 {
01469 if (system == NULL) return "";
01470 if (system->otherResults == NULL) return "";
01471 if (idx < 0 || idx >= system->otherResults->numberOfOtherResults)
01472 throw ErrorClass("idx is outside of range in routine getOtherSystemResultDescription()");
01473 if (system->otherResults->other[idx] == NULL) return "";
01474 return system->otherResults->other[idx]->description;
01475 }
01476
01477 string OSResult::getCurrentState()
01478 {
01479 if (service == NULL) return "";
01480 return service->currentState;
01481 }
01482
01483 int OSResult::getCurrentJobCount()
01484 {
01485 if (service == NULL) return -1;
01486 return service->currentJobCount;
01487 }
01488
01489 int OSResult::getTotalJobsSoFar()
01490 {
01491 if (service == NULL) return -1;
01492 return service->totalJobsSoFar;
01493 }
01494
01495 string OSResult::getTimeServiceStarted()
01496 {
01497 if (service == NULL) return "";
01498 return service->timeServiceStarted;
01499 }
01500
01501 double OSResult::getServiceUtilization()
01502 {
01503 if (service == NULL) return -1.;
01504 return service->serviceUtilization;
01505 }
01506
01507 int OSResult::getNumberOfOtherServiceResults()
01508 {
01509 if (service == NULL) return -1;
01510 if (service->otherResults == NULL) return -1;
01511 return service->otherResults->numberOfOtherResults;
01512 }
01513
01514 string OSResult::getOtherServiceResultName(int idx)
01515 {
01516 if (service == NULL) return "";
01517 if (service->otherResults == NULL) return "";
01518 if (idx < 0 || idx >= service->otherResults->numberOfOtherResults)
01519 throw ErrorClass("idx is outside of range in routine getOtherServiceResultName()");
01520 if (service->otherResults->other[idx] == NULL) return "";
01521 return service->otherResults->other[idx]->name;
01522 }
01523
01524 string OSResult::getOtherServiceResultValue(int idx)
01525 {
01526 if (service == NULL) return "";
01527 if (service->otherResults == NULL) return "";
01528 if (idx < 0 || idx >= service->otherResults->numberOfOtherResults)
01529 throw ErrorClass("idx is outside of range in routine getOtherServiceResultValue()");
01530 if (service->otherResults->other[idx] == NULL) return "";
01531 return service->otherResults->other[idx]->value;
01532 }
01533
01534 string OSResult::getOtherServiceResultDescription(int idx)
01535 {
01536 if (service == NULL) return "";
01537 if (service->otherResults == NULL) return "";
01538 if (idx < 0 || idx >= service->otherResults->numberOfOtherResults)
01539 throw ErrorClass("idx is outside of range in routine getOtherServiceResultDescription()");
01540 if (service->otherResults->other[idx] == NULL) return "";
01541 return service->otherResults->other[idx]->description;
01542 }
01543
01544 string OSResult::getJobStatus()
01545 {
01546 if (job == NULL) return "";
01547 return job->status;
01548 }
01549
01550 string OSResult::getJobSubmitTime()
01551 {
01552 if (job == NULL) return "";
01553 return job->submitTime;
01554 }
01555
01556 string OSResult::getScheduledStartTime()
01557 {
01558 if (job == NULL) return "";
01559 return job->scheduledStartTime;
01560 }
01561
01562 string OSResult::getActualStartTime()
01563 {
01564 if (job == NULL) return "";
01565 return job->actualStartTime;
01566 }
01567
01568 string OSResult::getJobEndTime()
01569 {
01570 if (job == NULL) return "";
01571 return job->endTime;
01572 }
01573
01574 int OSResult::getNumberOfTimes()
01575 {
01576 if (job == NULL) return -1;
01577 if (job->timingInformation == NULL) return -1;
01578 return job->timingInformation->numberOfTimes;
01579 }
01580
01581 string OSResult::getTimingInfoUnit(int idx)
01582 {
01583 if (job == NULL) return "";
01584 if (job->timingInformation == NULL) return "";
01585 if (idx < 0 || idx >= job->timingInformation->numberOfTimes)
01586 throw ErrorClass("idx is outside of range in routine getTimingInfoUnit()");
01587 if (job->timingInformation->time[idx] == NULL) return "";
01588 return job->timingInformation->time[idx]->unit;
01589 }
01590
01591 string OSResult::getTimingInfoType(int idx)
01592 {
01593 if (job == NULL) return "";
01594 if (job->timingInformation == NULL) return "";
01595 if (idx < 0 || idx >= job->timingInformation->numberOfTimes)
01596 throw ErrorClass("idx is outside of range in routine getTimingInfoType()");
01597 if (job->timingInformation->time[idx] == NULL) return "";
01598 return job->timingInformation->time[idx]->type;
01599 }
01600
01601 string OSResult::getTimingInfoCategory(int idx)
01602 {
01603 if (job == NULL) return "";
01604 if (job->timingInformation == NULL) return "";
01605 if (idx < 0 || idx >= job->timingInformation->numberOfTimes)
01606 throw ErrorClass("idx is outside of range in routine getTimingInfoCategory()");
01607 if (job->timingInformation->time[idx] == NULL) return "";
01608 return job->timingInformation->time[idx]->category;
01609 }
01610
01611 string OSResult::getTimingInfoDescription(int idx)
01612 {
01613 if (job == NULL) return "";
01614 if (job->timingInformation == NULL) return "";
01615 if (idx < 0 || idx >= job->timingInformation->numberOfTimes)
01616 throw ErrorClass("idx is outside of range in routine getTimingInfoDescription()");
01617 if (job->timingInformation->time[idx] == NULL) return "";
01618 return job->timingInformation->time[idx]->description;
01619 }
01620
01621 double OSResult::getTimingInfoValue(int idx)
01622 {
01623 if (job == NULL) return OSNaN();
01624 if (job->timingInformation == NULL) return OSNaN();
01625 if (idx < 0 || idx >= job->timingInformation->numberOfTimes)
01626 throw ErrorClass("idx is outside of range in routine getTimingInfoValue()");
01627 if (job->timingInformation->time[idx] == NULL) return OSNaN();
01628 return job->timingInformation->time[idx]->value;
01629 }
01630
01631 string OSResult::getUsedDiskSpaceUnit()
01632 {
01633 if (job == NULL) return "";
01634 if (job->usedDiskSpace == NULL) return "";
01635 return job->usedDiskSpace->unit;
01636 }
01637
01638 string OSResult::getUsedDiskSpaceDescription()
01639 {
01640 if (job == NULL) return "";
01641 if (job->usedDiskSpace == NULL) return "";
01642 return job->usedDiskSpace->description;
01643 }
01644
01645 double OSResult::getUsedDiskSpaceValue()
01646 {
01647 if (job == NULL) return -1.;
01648 if (job->usedDiskSpace == NULL) return -1.;
01649 return job->usedDiskSpace->value;
01650 }
01651
01652 string OSResult::getUsedMemoryUnit()
01653 {
01654 if (job == NULL) return "";
01655 if (job->usedMemory == NULL) return "";
01656 return job->usedMemory->unit;
01657 }
01658
01659 string OSResult::getUsedMemoryDescription()
01660 {
01661 if (job == NULL) return "";
01662 if (job->usedMemory == NULL) return "";
01663 return job->usedMemory->description;
01664 }
01665
01666 double OSResult::getUsedMemoryValue()
01667 {
01668 if (job == NULL) return -1.;
01669 if (job->usedMemory == NULL) return -1.;
01670 return job->usedMemory->value;
01671 }
01672
01673 string OSResult::getUsedCPUSpeedUnit()
01674 {
01675 if (job == NULL) return "";
01676 if (job->usedCPUSpeed == NULL) return "";
01677 return job->usedCPUSpeed->unit;
01678 }
01679
01680 string OSResult::getUsedCPUSpeedDescription()
01681 {
01682 if (job == NULL) return "";
01683 if (job->usedCPUSpeed == NULL) return "";
01684 return job->usedCPUSpeed->description;
01685 }
01686
01687 double OSResult::getUsedCPUSpeedValue()
01688 {
01689 if (job == NULL) return -1.;
01690 if (job->usedCPUSpeed == NULL) return -1.;
01691 return job->usedCPUSpeed->value;
01692 }
01693
01694 string OSResult::getUsedCPUNumberDescription()
01695 {
01696 if (job == NULL) return "";
01697 if (job->usedCPUNumber == NULL) return "";
01698 return job->usedCPUNumber->description;
01699 }
01700
01701 int OSResult::getUsedCPUNumberValue()
01702 {
01703 if (job == NULL) return -1;
01704 if (job->usedCPUNumber == NULL) return -1;
01705 return job->usedCPUNumber->value;
01706 }
01707
01708 int OSResult::getNumberOfOtherJobResults()
01709 {
01710 if (job == NULL) return -1;
01711 if (job->otherResults == NULL) return -1;
01712 return job->otherResults->numberOfOtherResults;
01713 }
01714
01715 string OSResult::getOtherJobResultName(int idx)
01716 {
01717 if (job == NULL) return "";
01718 if (job->otherResults == NULL) return "";
01719 if (idx < 0 || idx >= job->otherResults->numberOfOtherResults)
01720 throw ErrorClass("idx is outside of range in routine getOtherJobResultName()");
01721 if (job->otherResults->other[idx] == NULL) return "";
01722 return job->otherResults->other[idx]->name;
01723 }
01724
01725 string OSResult::getOtherJobResultValue(int idx)
01726 {
01727 if (job == NULL) return "";
01728 if (job->otherResults == NULL) return "";
01729 if (idx < 0 || idx >= job->otherResults->numberOfOtherResults)
01730 throw ErrorClass("idx is outside of range in routine getOtherJobResultValue()");
01731 if (job->otherResults->other[idx] == NULL) return "";
01732 return job->otherResults->other[idx]->value;
01733 }
01734
01735 string OSResult::getOtherJobResultDescription(int idx)
01736 {
01737 if (job == NULL) return "";
01738 if (job->otherResults == NULL) return "";
01739 if (idx < 0 || idx >= job->otherResults->numberOfOtherResults)
01740 throw ErrorClass("idx is outside of range in routine getOtherJobResultDescription()");
01741 if (job->otherResults->other[idx] == NULL) return "";
01742 return job->otherResults->other[idx]->description;
01743 }
01744
01745 double OSResult::getTimeValue()
01746 {
01747 if (job == NULL) return 0.0;
01748 if (job->timingInformation == NULL) return 0.0;
01749 if (job->timingInformation->numberOfTimes <= 0) return 0.0;
01750 return job->timingInformation->time[0]->value;
01751 }
01752
01753 int OSResult::getTimeNumber()
01754 {
01755 if (job == NULL) return -1;
01756 if (job->timingInformation == NULL) return -1;
01757 return job->timingInformation->numberOfTimes;
01758 }
01759
01760
01761 int OSResult::getVariableNumber()
01762 {
01763 if(m_iVariableNumber == -1)
01764 {
01765 if(optimization == NULL) return -1;
01766 m_iVariableNumber = optimization->numberOfVariables;
01767 }
01768 return m_iVariableNumber;
01769 }
01770
01771 int OSResult::getObjectiveNumber()
01772 {
01773 if(m_iObjectiveNumber == -1)
01774 {
01775 if(optimization == NULL) return -1;
01776 m_iObjectiveNumber = optimization->numberOfObjectives;
01777 }
01778 return m_iObjectiveNumber;
01779 }
01780
01781 int OSResult::getConstraintNumber()
01782 {
01783 if(m_iConstraintNumber == -1)
01784 {
01785 if(optimization == NULL) return -1;
01786 m_iConstraintNumber = optimization->numberOfConstraints;
01787 }
01788 return m_iConstraintNumber;
01789 }
01790
01791 int OSResult::getSolutionNumber()
01792 {
01793 if(optimization == NULL) return 0;
01794 if(optimization->solution == NULL) return 0;
01795 return optimization->numberOfSolutions;
01796 }
01797
01798
01799 OptimizationSolutionStatus* OSResult::getSolutionStatus( int solIdx)
01800 {
01801 if (optimization == NULL || optimization->solution == NULL)
01802 throw ErrorClass("No solution defined");
01803 if (solIdx < 0 || solIdx >= optimization->numberOfSolutions)
01804 throw ErrorClass("solIdx is outside of range in routine getSolutionStatus()");
01805 if(optimization->solution[solIdx] == NULL) return NULL;
01806 return optimization->solution[solIdx]->status;
01807 }
01808
01809 string OSResult::getSolutionStatusType(int solIdx)
01810 {
01811 if (optimization == NULL || optimization->solution == NULL)
01812 throw ErrorClass("No solution defined");
01813 if (solIdx < 0 || solIdx >= optimization->numberOfSolutions)
01814 throw ErrorClass("solIdx is outside of range in routine getSolutionStatusType()");
01815 if (optimization->solution[solIdx] == NULL) return "";
01816 if (optimization->solution[solIdx]->status == NULL) return "";
01817 return optimization->solution[solIdx]->status->type;
01818 }
01819
01820 string OSResult::getSolutionStatusDescription(int solIdx)
01821 {
01822 if (optimization == NULL || optimization->solution == NULL)
01823 throw ErrorClass("No solution defined");
01824 if (solIdx < 0 || solIdx >= optimization->numberOfSolutions)
01825 throw ErrorClass("solIdx is outside of range in routine getSolutionStatusDescription()");
01826 if (optimization->solution[solIdx] == NULL) return "";
01827 if (optimization->solution[solIdx]->status == NULL) return "";
01828 return optimization->solution[solIdx]->status->description;
01829 }
01830
01831 int OSResult::getNumberOfSolutionSubstatuses(int solIdx)
01832 {
01833 if (optimization == NULL || optimization->solution == NULL)
01834 throw ErrorClass("No solution defined");
01835 if (solIdx < 0 || solIdx >= optimization->numberOfSolutions)
01836 throw ErrorClass("solIdx is outside of range in routine getNumberOfSolutionSubstatuses()");
01837 if (optimization->solution[solIdx] == NULL) return -1;
01838 if (optimization->solution[solIdx]->status == NULL) return -1;
01839 return optimization->solution[solIdx]->status->numberOfSubstatuses;
01840 }
01841
01842 string OSResult::getSolutionSubstatusType(int solIdx, int substatusIdx)
01843 {
01844 if (optimization == NULL || optimization->solution == NULL)
01845 throw ErrorClass("No solution defined");
01846 if (solIdx < 0 || solIdx >= optimization->numberOfSolutions)
01847 throw ErrorClass("solIdx is outside of range in routine getSolutionSubstatusType()");
01848 if (optimization->solution[solIdx] == NULL) return "";
01849 if (optimization->solution[solIdx]->status == NULL) return "";
01850 if (substatusIdx < 0 || substatusIdx >= optimization->solution[solIdx]->status->numberOfSubstatuses)
01851 throw ErrorClass("solution substatus index is outside of range in routine getSolutionSubstatusType()");
01852 return optimization->solution[solIdx]->status->substatus[substatusIdx]->type;
01853 }
01854
01855 string OSResult::getSolutionSubstatusDescription(int solIdx, int substatusIdx)
01856 {
01857 if (optimization == NULL || optimization->solution == NULL)
01858 throw ErrorClass("No solution defined");
01859 if (solIdx < 0 || solIdx >= optimization->numberOfSolutions)
01860 throw ErrorClass("solIdx is outside of range in routine getSolutionSubstatusDescription()");
01861 if (optimization->solution[solIdx] == NULL) return "";
01862 if (optimization->solution[solIdx]->status == NULL) return "";
01863 if (substatusIdx < 0 || substatusIdx >= optimization->solution[solIdx]->status->numberOfSubstatuses)
01864 return "";
01865 return optimization->solution[solIdx]->status->substatus[substatusIdx]->description;
01866 }
01867
01868 int OSResult::getSolutionTargetObjectiveIdx(int solIdx)
01869 {
01870 if (optimization == NULL || optimization->solution == NULL)
01871 throw ErrorClass("No solution defined");
01872 if (solIdx < 0 || solIdx >= optimization->numberOfSolutions)
01873 throw ErrorClass("solIdx is outside of range in routine getSolutionTargetObjectiveIdx()");
01874 if (optimization->solution[solIdx] == NULL) return 0;
01875 return optimization->solution[solIdx]->targetObjectiveIdx;
01876 }
01877
01878 std::string OSResult::getSolutionTargetObjectiveName(int solIdx)
01879 {
01880 if (optimization == NULL || optimization->solution == NULL)
01881 throw ErrorClass("No solution defined");
01882 if (solIdx < 0 || solIdx >= optimization->numberOfSolutions)
01883 throw ErrorClass("solIdx is outside of range in routine getSolutionTargetObjectiveName()");
01884 if (optimization->solution[solIdx] == NULL) return 0;
01885 return optimization->solution[solIdx]->targetObjectiveName;
01886 }
01887
01888 bool OSResult::getSolutionWeightedObjectives(int solIdx)
01889 {
01890 if (optimization == NULL || optimization->solution == NULL)
01891 throw ErrorClass("No solution defined");
01892 if (solIdx < 0 || solIdx >= optimization->numberOfSolutions)
01893 throw ErrorClass("solIdx is outside of range in routine getSolutionWeightedObjectives()");
01894 if (optimization->solution[solIdx] == NULL) return false;
01895 return optimization->solution[solIdx]->weightedObjectives;
01896 }
01897
01898 string OSResult::getSolutionMessage(int solIdx)
01899 {
01900 if(optimization == NULL) return "there is no solution";
01901 if(optimization->solution == NULL ||
01902 solIdx < 0 || solIdx >= optimization->numberOfSolutions) return "there is no solution";
01903 if(optimization->solution[solIdx] == NULL) return "there is no solution";
01904 return optimization->solution[solIdx]->message;
01905 }
01906
01907 int OSResult::getNumberOfPrimalVariableValues(int solIdx)
01908 {
01909 if (optimization == NULL || optimization->solution == NULL)
01910 throw ErrorClass("No solution defined");
01911 if (solIdx < 0 || solIdx >= optimization->numberOfSolutions)
01912 throw ErrorClass("solIdx is outside of range in routine getNumberOfPrimalVariableValues()");
01913 if (optimization->solution[solIdx] == NULL) return -1;
01914 if (optimization->solution[solIdx]->variables == NULL) return -1;
01915 if (optimization->solution[solIdx]->variables->values == NULL) return -1;
01916 return optimization->solution[solIdx]->variables->values->numberOfVar;
01917 }
01918
01919 int OSResult::getNumberOfVarValues(int solIdx)
01920 {
01921 if (optimization == NULL || optimization->solution == NULL)
01922 throw ErrorClass("No solution defined");
01923 if (solIdx < 0 || solIdx >= optimization->numberOfSolutions)
01924 throw ErrorClass("solIdx is outside of range in routine getNumberOfVarValues()");
01925 if (optimization->solution[solIdx] == NULL) return -1;
01926 if (optimization->solution[solIdx]->variables == NULL) return -1;
01927 if (optimization->solution[solIdx]->variables->values == NULL) return -1;
01928 return optimization->solution[solIdx]->variables->values->numberOfVar;
01929 }
01930
01931 int OSResult::getVarValueIdx(int solIdx, int varIdx)
01932 {
01933 if (optimization == NULL || optimization->solution == NULL)
01934 throw ErrorClass("No solution defined");
01935 if (solIdx < 0 || solIdx >= optimization->numberOfSolutions)
01936 throw ErrorClass("solIdx is outside of range in routine getVarValueIdx()");
01937 if (optimization->solution[solIdx] == NULL) return -1;
01938 if (optimization->solution[solIdx]->variables == NULL) return -1;
01939 if (optimization->solution[solIdx]->variables->values == NULL) return -1;
01940 if (varIdx < 0 || varIdx >= optimization->solution[solIdx]->variables->values->numberOfVar)
01941 throw ErrorClass("varIdx is outside of range in routine getVarValueIdx()");
01942 return optimization->solution[solIdx]->variables->values->var[varIdx]->idx;
01943 }
01944
01945 std::string OSResult::getVarValueName(int solIdx, int varIdx)
01946 {
01947 if (optimization == NULL || optimization->solution == NULL)
01948 throw ErrorClass("No solution defined");
01949 if (solIdx < 0 || solIdx >= optimization->numberOfSolutions)
01950 throw ErrorClass("solIdx is outside of range in routine getVarValueIdx()");
01951 if (optimization->solution[solIdx] == NULL) return "";
01952 if (optimization->solution[solIdx]->variables == NULL) return "";
01953 if (optimization->solution[solIdx]->variables->values == NULL) return "";
01954 if (varIdx < 0 || varIdx >= optimization->solution[solIdx]->variables->values->numberOfVar)
01955 throw ErrorClass("varIdx is outside of range in routine getVarValueIdx()");
01956 return optimization->solution[solIdx]->variables->values->var[varIdx]->name;
01957 }
01958
01959 double OSResult::getVarValue(int solIdx, int varIdx)
01960 {
01961 if (optimization == NULL || optimization->solution == NULL)
01962 throw ErrorClass("No solution defined");
01963 if (solIdx < 0 || solIdx >= optimization->numberOfSolutions)
01964 throw ErrorClass("solIdx is outside of range in routine getVarValue()");
01965 if (optimization->solution[solIdx] == NULL) return OSNaN();
01966 if (optimization->solution[solIdx]->variables == NULL) return OSNaN();
01967 if (optimization->solution[solIdx]->variables->values == NULL) return OSNaN();
01968 if (varIdx < 0 || varIdx >= optimization->solution[solIdx]->variables->values->numberOfVar)
01969 throw ErrorClass("varIdx is outside of range in routine getVarValue()");
01970 return optimization->solution[solIdx]->variables->values->var[varIdx]->value;
01971 }
01972
01973 std::vector<IndexValuePair*> OSResult::getOptimalPrimalVariableValues(int solIdx)
01974 {
01975 int numberOfVar;
01976 struct IndexValuePair *primalValPair;
01977 int iSolutions = this->getSolutionNumber();
01978 for(int i = 0; i < iSolutions; i++)
01979 {
01980 if( i != solIdx) continue;
01981 if(optimization->solution[i] == NULL) continue;
01982 if(optimization->solution[i]->variables == NULL) continue;
01983 if(optimization->solution[i]->variables->values == NULL) continue;
01984 if((optimization->solution[i]->status->type.find("ptimal") != string::npos && m_mdPrimalValues == NULL) ||
01985 optimization->solution[i]->status->type.compare("globallyOptimal") == 0)
01986 {
01987 numberOfVar = optimization->solution[i]->variables->values->numberOfVar;
01988 for(int j = 0; j < numberOfVar; j++)
01989 {
01990 primalValPair = new IndexValuePair();
01991 primalValPair->value = optimization->solution[i]->variables->values->var[j]->value;
01992 primalValPair->idx = optimization->solution[i]->variables->values->var[j]->idx;
01993 primalVals.push_back( primalValPair);
01994 }
01995 }
01996 if(optimization->solution[i]->status->type.compare("globallyOptimal") == 0)
01997 {
01998 return primalVals;
01999 }
02000 }
02001 return primalVals;
02002 }
02003
02004
02005 int OSResult::getNumberOfVarValuesString(int solIdx)
02006 {
02007 if (optimization == NULL || optimization->solution == NULL)
02008 throw ErrorClass("No solution defined");
02009 if (solIdx < 0 || solIdx >= optimization->numberOfSolutions)
02010 throw ErrorClass("solIdx is outside of range in routine getNumberOfVarValuesString()");
02011 if (optimization->solution[solIdx] == NULL) return -1;
02012 if (optimization->solution[solIdx]->variables == NULL) return -1;
02013 if (optimization->solution[solIdx]->variables->valuesString == NULL) return -1;
02014 return optimization->solution[solIdx]->variables->valuesString->numberOfVar;
02015 }
02016
02017 int OSResult::getVarValueStringIdx(int solIdx, int varIdx)
02018 {
02019 if (optimization == NULL || optimization->solution == NULL)
02020 throw ErrorClass("No solution defined");
02021 if (solIdx < 0 || solIdx >= optimization->numberOfSolutions)
02022 throw ErrorClass("solIdx is outside of range in routine getVarValueStringIdx()");
02023 if (optimization->solution[solIdx] == NULL) return -1;
02024 if (optimization->solution[solIdx]->variables == NULL) return -1;
02025 if (optimization->solution[solIdx]->variables->valuesString == NULL) return -1;
02026 if (varIdx < 0 || varIdx >= optimization->solution[solIdx]->variables->valuesString->numberOfVar)
02027 throw ErrorClass("varIdx is outside of range in routine getVarValueStringIdx()");
02028 return optimization->solution[solIdx]->variables->valuesString->var[varIdx]->idx;
02029 }
02030
02031 std::string OSResult::getVarValueStringName(int solIdx, int varIdx)
02032 {
02033 if (optimization == NULL || optimization->solution == NULL)
02034 throw ErrorClass("No solution defined");
02035 if (solIdx < 0 || solIdx >= optimization->numberOfSolutions)
02036 throw ErrorClass("solIdx is outside of range in routine getVarValueStringIdx()");
02037 if (optimization->solution[solIdx] == NULL) return "";
02038 if (optimization->solution[solIdx]->variables == NULL) return "";
02039 if (optimization->solution[solIdx]->variables->valuesString == NULL) return "";
02040 if (varIdx < 0 || varIdx >= optimization->solution[solIdx]->variables->valuesString->numberOfVar)
02041 throw ErrorClass("varIdx is outside of range in routine getVarValueStringIdx()");
02042 return optimization->solution[solIdx]->variables->valuesString->var[varIdx]->name;
02043 }
02044
02045 std::string OSResult::getVarValueString(int solIdx, int varIdx)
02046 {
02047 if (optimization == NULL || optimization->solution == NULL)
02048 throw ErrorClass("No solution defined");
02049 if (solIdx < 0 || solIdx >= optimization->numberOfSolutions)
02050 throw ErrorClass("solIdx is outside of range in routine getVarValueString()");
02051 if (optimization->solution[solIdx] == NULL) return NULL;
02052 if (optimization->solution[solIdx]->variables == NULL) return NULL;
02053 if (optimization->solution[solIdx]->variables->valuesString == NULL) return NULL;
02054 if (varIdx < 0 || varIdx >= optimization->solution[solIdx]->variables->valuesString->numberOfVar)
02055 throw ErrorClass("varIdx is outside of range in routine getVarValueString()");
02056 return optimization->solution[solIdx]->variables->valuesString->var[varIdx]->value;
02057 }
02058
02059 int OSResult::getBasisStatusNumberOfEl(int solIdx, int object, int status)
02060 {
02061 if (optimization == NULL || optimization->solution == NULL)
02062 throw ErrorClass("No solution defined");
02063 if (solIdx < 0 || solIdx >= optimization->numberOfSolutions)
02064 throw ErrorClass("solIdx is outside of range in routine getBasisStatusNumberOfEl()");
02065 if (optimization->solution[solIdx] == NULL) return -1;
02066
02067 switch (object)
02068 {
02069 case ENUM_PROBLEM_COMPONENT_variables:
02070 {
02071 if (optimization->solution[solIdx]->variables == NULL) return -1;
02072 if (optimization->solution[solIdx]->variables->basisStatus == NULL) return -1;
02073 return optimization->solution[solIdx]->variables->basisStatus->getNumberOfEl(status);
02074 }
02075 case ENUM_PROBLEM_COMPONENT_objectives:
02076 {
02077 if (optimization->solution[solIdx]->objectives == NULL) return -1;
02078 if (optimization->solution[solIdx]->objectives->basisStatus == NULL) return -1;
02079 return optimization->solution[solIdx]->objectives->basisStatus->getNumberOfEl(status);
02080 }
02081 case ENUM_PROBLEM_COMPONENT_constraints:
02082 {
02083 if (optimization->solution[solIdx]->constraints == NULL) return -1;
02084 if (optimization->solution[solIdx]->constraints->basisStatus == NULL) return -1;
02085 return optimization->solution[solIdx]->constraints->basisStatus->getNumberOfEl(status);
02086 }
02087 default:
02088 throw ErrorClass("target object not implemented in getBasisStatusNumberOfEl");
02089 }
02090 }
02091
02092 int OSResult::getBasisStatusEl(int solIdx, int object, int status, int j)
02093 {
02094 if (optimization == NULL || optimization->solution == NULL)
02095 throw ErrorClass("No solution defined");
02096 if (solIdx < 0 || solIdx >= optimization->numberOfSolutions)
02097 throw ErrorClass("solIdx is outside of range in routine getBasisStatusEl()");
02098 if (optimization->solution[solIdx] == NULL)
02099 throw ErrorClass("solution never defined in routine getBasisStatusEl()");
02100
02101 switch (object)
02102 {
02103 case ENUM_PROBLEM_COMPONENT_variables:
02104 {
02105 if (optimization->solution[solIdx]->variables == NULL)
02106 throw ErrorClass("variables result never defined in routine getBasisStatusEl()");
02107 if (optimization->solution[solIdx]->variables->basisStatus == NULL)
02108 throw ErrorClass("basis status never defined in routine getBasisStatusEl()");
02109 return optimization->solution[solIdx]->variables->basisStatus->getEl(status, j);
02110 }
02111 case ENUM_PROBLEM_COMPONENT_objectives:
02112 {
02113 if (optimization->solution[solIdx]->objectives == NULL)
02114 throw ErrorClass("objectives result never defined in routine getBasisStatusEl()");
02115 if (optimization->solution[solIdx]->objectives->basisStatus == NULL)
02116 throw ErrorClass("basis status never defined in routine getBasisStatusEl()");
02117 return optimization->solution[solIdx]->objectives->basisStatus->getEl(status, j);
02118 }
02119 case ENUM_PROBLEM_COMPONENT_constraints:
02120 {
02121 if (optimization->solution[solIdx]->constraints == NULL)
02122 throw ErrorClass("constraints result never defined in routine getBasisStatusEl()");
02123 if (optimization->solution[solIdx]->constraints->basisStatus == NULL)
02124 throw ErrorClass("basis status never defined in routine getBasisStatusEl()");
02125 return optimization->solution[solIdx]->constraints->basisStatus->getEl(status, j);
02126 }
02127 default:
02128 throw ErrorClass("target object not implemented in getBasisStatusEl");
02129 }
02130 }
02131
02132
02133
02134
02135
02136
02137
02138
02139
02140
02141
02142
02143
02144
02145
02146
02147
02148
02149
02150
02151
02152
02153
02154
02155
02156
02157
02158
02159
02160
02161
02162
02163
02164
02165
02166
02167
02168
02169
02170
02171 int OSResult::getNumberOfOtherVariableResults(int solIdx)
02172 {
02173 if(m_iNumberOfOtherVariableResults == -1)
02174 {
02175 if (optimization == NULL || optimization->solution == NULL)
02176 throw ErrorClass("No solution defined");
02177 if (solIdx < 0 || solIdx >= optimization->numberOfSolutions)
02178 throw ErrorClass("solIdx is outside of range in routine getNumberOfOtherVariableResults()");
02179 if(optimization->solution[solIdx] == NULL) return -1;
02180 if(optimization->solution[solIdx]->variables == NULL) return -1;
02181 if(optimization->solution[solIdx]->variables->other == NULL) return -1;
02182 m_iNumberOfOtherVariableResults = optimization->solution[solIdx]->variables->numberOfOtherVariableResults;
02183 }
02184 return m_iNumberOfOtherVariableResults;
02185 }
02186
02187 int OSResult::getAnOtherVariableResultNumberOfVar(int solIdx, int iOther)
02188 {
02189 if (optimization == NULL || optimization->solution == NULL)
02190 throw ErrorClass("No solution defined");
02191 int iSolutions = this->getSolutionNumber();
02192 if (solIdx < 0 || solIdx >= iSolutions)
02193 throw ErrorClass("solIdx is outside of range in routine getAnOtherVariableResultNumberOfVar()");
02194 if (optimization->solution[solIdx] == NULL) return -1;
02195 if (optimization->solution[solIdx]->variables == NULL) return -1;
02196 if (optimization->solution[solIdx]->variables->other == NULL) return -1;
02197 if (iOther < 0 || iOther >= optimization->solution[solIdx]->variables->numberOfOtherVariableResults)
02198 throw ErrorClass("other variables result index is outside of range in routine getAnOtherVariableResultNumberOfVar()");
02199 return optimization->solution[solIdx]->variables->other[iOther]->numberOfVar;
02200 }
02201
02202 string OSResult::getOtherVariableResultName(int solIdx, int otherIdx)
02203 {
02204 if (optimization == NULL || optimization->solution == NULL)
02205 throw ErrorClass("No solution defined");
02206 int iSolutions = this->getSolutionNumber();
02207 if (solIdx < 0 || solIdx >= iSolutions)
02208 throw ErrorClass("solIdx is outside of range in routine getOtherVariableResultName()");
02209 if (optimization->solution[solIdx] == NULL) return "";
02210 if (optimization->solution[solIdx]->variables == NULL) return "";
02211 if (optimization->solution[solIdx]->variables->other == NULL) return "";
02212 if (otherIdx < 0 || otherIdx >= optimization->solution[solIdx]->variables->numberOfOtherVariableResults)
02213 throw ErrorClass("otherIdx is outside of range in routine getOtherVariableResultName()");
02214 if (optimization->solution[solIdx]->variables->other[ otherIdx] == NULL) return "";
02215 return optimization->solution[solIdx]->variables->other[ otherIdx]->name;
02216 }
02217
02218 string OSResult::getOtherVariableResultValue(int solIdx, int otherIdx)
02219 {
02220 if (optimization == NULL || optimization->solution == NULL)
02221 throw ErrorClass("No solution defined");
02222 int iSolutions = this->getSolutionNumber();
02223 if (solIdx < 0 || solIdx >= iSolutions)
02224 throw ErrorClass("solIdx is outside of range in routine getOtherVariableResultValue()");
02225 if (optimization->solution[solIdx] == NULL) return "";
02226 if (optimization->solution[solIdx]->variables == NULL) return "";
02227 if (optimization->solution[solIdx]->variables->other == NULL) return "";
02228 if (otherIdx < 0 || otherIdx >= optimization->solution[solIdx]->variables->numberOfOtherVariableResults)
02229 throw ErrorClass("otherIdx is outside of range in routine getOtherVariableResultValue()");
02230 if (optimization->solution[solIdx]->variables->other[ otherIdx] == NULL) return "";
02231 return optimization->solution[solIdx]->variables->other[ otherIdx]->value;
02232 }
02233
02234 string OSResult::getOtherVariableResultDescription(int solIdx, int otherIdx)
02235 {
02236 if (optimization == NULL || optimization->solution == NULL)
02237 throw ErrorClass("No solution defined");
02238 int iSolutions = this->getSolutionNumber();
02239 if (solIdx < 0 || solIdx >= iSolutions)
02240 throw ErrorClass("solIdx is outside of range in routine getOtherVariableResultDescription()");
02241 if (optimization->solution[solIdx] == NULL) return "";
02242 if (optimization->solution[solIdx]->variables == NULL) return "";
02243 if (optimization->solution[solIdx]->variables->other == NULL) return "";
02244 if (otherIdx < 0 || otherIdx >= optimization->solution[solIdx]->variables->numberOfOtherVariableResults)
02245 throw ErrorClass("otherIdx is outside of range in routine getOtherVariableResultDescription()");
02246 if (optimization->solution[solIdx]->variables->other[ otherIdx] == NULL) return "";
02247 return optimization->solution[solIdx]->variables->other[ otherIdx]->description;
02248 }
02249
02250 int OSResult::getOtherVariableResultNumberOfVar(int solIdx, int otherIdx)
02251 {
02252 if (optimization == NULL || optimization->solution == NULL)
02253 throw ErrorClass("No solution defined");
02254 int iSolutions = this->getSolutionNumber();
02255 if (solIdx < 0 || solIdx >= iSolutions)
02256 throw ErrorClass("solIdx is outside of range in routine getOtherVariableResultNumberOfVar()");
02257 if (optimization->solution[solIdx] == NULL) return -1;
02258 if (optimization->solution[solIdx]->variables == NULL) return -1;
02259 if (optimization->solution[solIdx]->variables->other == NULL) return -1;
02260 if (otherIdx < 0 || otherIdx >= optimization->solution[solIdx]->variables->numberOfOtherVariableResults)
02261 throw ErrorClass("otherIdx is outside of range in routine getOtherVariableResultNumberOfVar()");
02262 if (optimization->solution[solIdx]->variables->other[ otherIdx] == NULL) return -1;
02263 return optimization->solution[solIdx]->variables->other[ otherIdx]->numberOfVar;
02264 }
02265
02266 int OSResult::getOtherVariableResultVarIdx(int solIdx, int otherIdx, int varIdx)
02267 {
02268 if (optimization == NULL || optimization->solution == NULL)
02269 throw ErrorClass("No solution defined");
02270 int iSolutions = this->getSolutionNumber();
02271 if (solIdx < 0 || solIdx >= iSolutions)
02272 throw ErrorClass("solIdx is outside of range in routine getOtherVariableResultVarIdx()");
02273 if (optimization->solution[solIdx] == NULL) return -1;
02274 if (optimization->solution[solIdx]->variables == NULL) return -1;
02275 if (optimization->solution[solIdx]->variables->other == NULL) return -1;
02276 if (otherIdx < 0 || otherIdx >= optimization->solution[solIdx]->variables->numberOfOtherVariableResults)
02277 throw ErrorClass("otherIdx is outside of range in routine getOtherVariableResultVarIdx()");
02278 if (optimization->solution[solIdx]->variables->other[ otherIdx] == NULL) return -1;
02279 if (optimization->solution[solIdx]->variables->other[ otherIdx]->var == NULL) return -1;
02280 if (varIdx < 0 || varIdx >= optimization->solution[solIdx]->variables->other[ otherIdx]->numberOfVar)
02281 throw ErrorClass("varIdx is outside of range in routine getOtherVariableResultVarIdx()");
02282 return optimization->solution[solIdx]->variables->other[otherIdx]->var[varIdx]->idx;
02283 }
02284
02285 string OSResult::getOtherVariableResultVar(int solIdx, int otherIdx, int varIdx)
02286 {
02287 if (optimization == NULL || optimization->solution == NULL)
02288 throw ErrorClass("No solution defined");
02289 int iSolutions = this->getSolutionNumber();
02290 if (solIdx < 0 || solIdx >= iSolutions)
02291 throw ErrorClass("solIdx is outside of range in routine getOtherVariableResultVar()");
02292 if (optimization->solution[solIdx] == NULL) return "";
02293 if (optimization->solution[solIdx]->variables == NULL) return "";
02294 if (optimization->solution[solIdx]->variables->other == NULL) return "";
02295 if (otherIdx < 0 || otherIdx >= optimization->solution[solIdx]->variables->numberOfOtherVariableResults)
02296 throw ErrorClass("otherIdx is outside of range in routine getOtherVariableResultVar()");
02297 if (optimization->solution[solIdx]->variables->other[ otherIdx] == NULL) return "";
02298 if (optimization->solution[solIdx]->variables->other[ otherIdx]->var == NULL) return "";
02299 if (varIdx < 0 || varIdx >= optimization->solution[solIdx]->variables->other[ otherIdx]->numberOfVar)
02300 throw ErrorClass("varIdx is outside of range in routine getOtherVariableResultVar()");
02301 return optimization->solution[solIdx]->variables->other[otherIdx]->var[varIdx]->value;
02302 }
02303
02304
02305 int OSResult::getOtherVariableResultNumberOfEnumerations(int solIdx, int otherIdx)
02306 {
02307 if (optimization == NULL || optimization->solution == NULL)
02308 throw ErrorClass("No solution defined");
02309 int iSolutions = this->getSolutionNumber();
02310 if (solIdx < 0 || solIdx >= iSolutions)
02311 throw ErrorClass("solIdx is outside of range in routine getOtherVariableResultNumberOfEnumerations()");
02312 if (optimization->solution[solIdx] == NULL) return -1;
02313 if (optimization->solution[solIdx]->variables == NULL) return -1;
02314 if (optimization->solution[solIdx]->variables->other == NULL) return -1;
02315 if (otherIdx < 0 || otherIdx >= optimization->solution[solIdx]->variables->numberOfOtherVariableResults)
02316 throw ErrorClass("otherIdx is outside of range in routine getOtherVariableResultNumberOfEnumerations()");
02317 if (optimization->solution[solIdx]->variables->other[ otherIdx] == NULL) return -1;
02318 return optimization->solution[solIdx]->variables->other[ otherIdx]->numberOfEnumerations;
02319 }
02320
02321
02322 std::string OSResult::getOtherVariableResultEnumerationValue(int solIdx,int otherIdx, int enumIdx)
02323 {
02324 if (optimization == NULL || optimization->solution == NULL)
02325 throw ErrorClass("No solution defined");
02326 if (solIdx < 0 || solIdx >= optimization->numberOfSolutions)
02327 throw ErrorClass("solIdx is outside of range in routine getOtherVariableResultEnumerationValue()");
02328 if (optimization->solution[solIdx] == NULL)
02329 throw ErrorClass("solution never defined in routine getOtherVariableResultEnumerationValue()");
02330
02331 if (optimization->solution[solIdx]->variables == NULL)
02332 throw ErrorClass("variables result never defined in routine getOtherVariableResultEnumerationValue()");
02333 if (otherIdx < 0 || otherIdx >= optimization->solution[solIdx]->variables->numberOfOtherVariableResults)
02334 throw ErrorClass("otherIdx is outside of range in routine getOtherVariableResultEnumerationValue()");
02335 if (optimization->solution[solIdx]->variables->other == NULL)
02336 throw ErrorClass("other variable array never defined in routine getOtherVariableResultEnumerationValue()");
02337 if (optimization->solution[solIdx]->variables->other[otherIdx] == NULL)
02338 throw ErrorClass("other variable result never defined in routine getOtherVariableResultEnumerationValue()");
02339 if (optimization->solution[solIdx]->variables->other[otherIdx]->enumeration == NULL)
02340 throw ErrorClass("enumerations array never defined in routine getOtherVariableResultEnumerationValue()");
02341 if (enumIdx < 0 || enumIdx >= optimization->solution[solIdx]->variables->other[otherIdx]->numberOfEnumerations)
02342 throw ErrorClass("enumIdx is outside of range in routine getOtherVariableResultEnumerationValue()");
02343 if (optimization->solution[solIdx]->variables->other[otherIdx]->enumeration[enumIdx] == NULL)
02344 throw ErrorClass("enumeration never defined in routine getOtherVariableResultEnumerationValue()");
02345
02346 return optimization->solution[solIdx]->variables->other[otherIdx]->enumeration[enumIdx]->value;
02347 }
02348
02349 std::string OSResult::getOtherVariableResultEnumerationDescription(int solIdx,int otherIdx, int enumIdx)
02350 {
02351 if (optimization == NULL || optimization->solution == NULL)
02352 throw ErrorClass("No solution defined");
02353 if (solIdx < 0 || solIdx >= optimization->numberOfSolutions)
02354 throw ErrorClass("solIdx is outside of range in routine getOtherVariableResultEnumerationDescription()");
02355 if (optimization->solution[solIdx] == NULL)
02356 throw ErrorClass("solution never defined in routine getOtherVariableResultEnumerationDescription()");
02357
02358 if (optimization->solution[solIdx]->variables == NULL)
02359 throw ErrorClass("variables result never defined in routine getOtherVariableResultEnumerationDescription()");
02360 if (otherIdx < 0 || otherIdx >= optimization->solution[solIdx]->variables->numberOfOtherVariableResults)
02361 throw ErrorClass("otherIdx is outside of range in routine getOtherVariableResultEnumerationDescription()");
02362 if (optimization->solution[solIdx]->variables->other == NULL)
02363 throw ErrorClass("other variable array never defined in routine getOtherVariableResultEnumerationDescription()");
02364 if (optimization->solution[solIdx]->variables->other[otherIdx] == NULL)
02365 throw ErrorClass("other variable result never defined in routine getOtherVariableResultEnumerationDescription()");
02366 if (optimization->solution[solIdx]->variables->other[otherIdx]->enumeration == NULL)
02367 throw ErrorClass("enumerations array never defined in routine getOtherVariableResultEnumerationDescription()");
02368 if (enumIdx < 0 || enumIdx >= optimization->solution[solIdx]->variables->other[otherIdx]->numberOfEnumerations)
02369 throw ErrorClass("enumIdx is outside of range in routine getOtherVariableResultEnumerationDescription()");
02370 if (optimization->solution[solIdx]->variables->other[otherIdx]->enumeration[enumIdx] == NULL)
02371 throw ErrorClass("enumeration never defined in routine getOtherVariableResultEnumerationDescription()");
02372
02373 return optimization->solution[solIdx]->variables->other[otherIdx]->enumeration[enumIdx]->description;
02374 }
02375
02376 int OSResult::getOtherVariableResultEnumerationNumberOfEl(int solIdx,int otherIdx, int enumIdx)
02377 {
02378 if (optimization == NULL || optimization->solution == NULL)
02379 throw ErrorClass("No solution defined");
02380 if (solIdx < 0 || solIdx >= optimization->numberOfSolutions)
02381 throw ErrorClass("solIdx is outside of range in routine getOtherVariableResultEnumerationNumberOfEl()");
02382 if (optimization->solution[solIdx] == NULL)
02383 throw ErrorClass("solution never defined in routine getOtherVariableResultEnumerationNumberOfEl()");
02384
02385 if (optimization->solution[solIdx]->variables == NULL)
02386 throw ErrorClass("variables result never defined in routine getOtherVariableResultEnumerationNumberOfEl()");
02387 if (otherIdx < 0 || otherIdx >= optimization->solution[solIdx]->variables->numberOfOtherVariableResults)
02388 throw ErrorClass("otherIdx is outside of range in routine getOtherVariableResultEnumerationNumberOfEl()");
02389 if (optimization->solution[solIdx]->variables->other == NULL)
02390 throw ErrorClass("other variable array never defined in routine getOtherVariableResultEnumerationNumberOfEl()");
02391 if (optimization->solution[solIdx]->variables->other[otherIdx] == NULL)
02392 throw ErrorClass("other variable result never defined in routine getOtherVariableResultEnumerationNumberOfEl()");
02393 if (optimization->solution[solIdx]->variables->other[otherIdx]->enumeration == NULL)
02394 throw ErrorClass("enumerations array never defined in routine getOtherVariableResultEnumerationNumberOfEl()");
02395 if (enumIdx < 0 || enumIdx >= optimization->solution[solIdx]->variables->other[otherIdx]->numberOfEnumerations)
02396 throw ErrorClass("enumIdx is outside of range in routine getOtherVariableResultEnumerationNumberOfEl()");
02397 if (optimization->solution[solIdx]->variables->other[otherIdx]->enumeration[enumIdx] == NULL)
02398 throw ErrorClass("enumeration never defined in routine getOtherVariableResultEnumerationNumberOfEl()");
02399
02400 return optimization->solution[solIdx]->variables->other[otherIdx]->enumeration[enumIdx]->numberOfEl;
02401 }
02402
02403 int OSResult::getOtherVariableResultEnumerationEl(int solIdx,int otherIdx, int enumIdx, int j)
02404 {
02405 if (optimization == NULL || optimization->solution == NULL)
02406 throw ErrorClass("No solution defined");
02407 if (solIdx < 0 || solIdx >= optimization->numberOfSolutions)
02408 throw ErrorClass("solIdx is outside of range in routine getOtherVariableResultEnumerationEl()");
02409 if (optimization->solution[solIdx] == NULL)
02410 throw ErrorClass("solution never defined in routine getOtherVariableResultEnumerationEl()");
02411
02412 if (optimization->solution[solIdx]->variables == NULL)
02413 throw ErrorClass("variables result never defined in routine getOtherVariableResultEnumerationEl()");
02414 if (otherIdx < 0 || otherIdx >= optimization->solution[solIdx]->variables->numberOfOtherVariableResults)
02415 throw ErrorClass("otherIdx is outside of range in routine getOtherVariableResultEnumerationEl()");
02416 if (optimization->solution[solIdx]->variables->other == NULL)
02417 throw ErrorClass("other variable array never defined in routine getOtherVariableResultEnumerationEl()");
02418 if (optimization->solution[solIdx]->variables->other[otherIdx] == NULL)
02419 throw ErrorClass("other variable result never defined in routine getOtherVariableResultEnumerationEl()");
02420 if (optimization->solution[solIdx]->variables->other[otherIdx]->enumeration == NULL)
02421 throw ErrorClass("enumerations array never defined in routine getOtherVariableResultEnumerationEl()");
02422 if (enumIdx < 0 || enumIdx >= optimization->solution[solIdx]->variables->other[otherIdx]->numberOfEnumerations)
02423 throw ErrorClass("enumIdx is outside of range in routine getOtherVariableResultEnumerationEl()");
02424 if (optimization->solution[solIdx]->variables->other[otherIdx]->enumeration[enumIdx] == NULL)
02425 throw ErrorClass("enumeration never defined in routine getOtherVariableResultEnumerationEl()");
02426
02427 return optimization->solution[solIdx]->variables->other[otherIdx]->enumeration[enumIdx]->getEl(j);
02428 }
02429
02430
02431
02432
02433
02434
02435
02436
02437
02438
02439
02440
02441
02442
02443
02444
02445
02446
02447
02448
02449
02450
02451
02452
02453
02454
02455
02456
02457
02458
02459
02460
02461
02462
02463
02464
02465
02466
02467
02468
02469
02470
02471
02472
02473
02474
02475
02476
02477
02478
02479
02480
02481
02482
02483
02484
02485
02486
02487
02488
02489
02490
02491
02492
02493
02494
02495
02496
02497
02498
02499
02500
02501
02502
02503
02504
02505
02506
02507
02508
02509
02510
02511
02512
02513
02514
02515
02516
02517
02518
02519
02520
02521
02522
02523
02524
02525
02526
02527
02528
02529
02530
02531
02532
02533
02534
02535
02536
02537
02538
02539
02540
02541
02542
02543
02544
02545
02546
02547
02548
02549
02550
02551
02552
02553
02554
02555
02556
02557
02558
02559
02560
02561
02562
02563
02564
02565
02566
02567
02568
02569
02570
02571
02572
02573
02574
02575
02576
02577
02578
02579
02580
02581
02582
02583
02584
02585
02586
02587
02588
02589
02590
02591
02592
02593
02594
02595
02596
02597
02598
02599
02600
02601
02602
02603
02604
02605
02606
02607
02608
02609
02610
02611
02612
02613
02614
02615
02616
02617
02618
02619 int OSResult::getNumberOfObjValues(int solIdx)
02620 {
02621 if (optimization == NULL || optimization->solution == NULL)
02622 throw ErrorClass("No solution defined");
02623 int iSolutions = this->getSolutionNumber();
02624 if (solIdx < 0 || solIdx >= iSolutions)
02625 throw ErrorClass("solIdx is outside of range in routine getNumberOfObjValues()");
02626 if (optimization->solution[solIdx] == NULL) return -1;
02627 if (optimization->solution[solIdx]->objectives == NULL) return -1;
02628 if (optimization->solution[solIdx]->objectives->values == NULL) return -1;
02629 return optimization->solution[solIdx]->objectives->values->numberOfObj;
02630 }
02631
02632 int OSResult::getObjValueIdx(int solIdx, int objIdx)
02633 {
02634 if (optimization == NULL || optimization->solution == NULL)
02635 throw ErrorClass("No solution defined");
02636 int iSolutions = this->getSolutionNumber();
02637 if (solIdx < 0 || solIdx >= iSolutions)
02638 throw ErrorClass("solIdx is outside of range in routine getObjValueIdx()");
02639 if (optimization->solution[solIdx] == NULL) return 0;
02640 if (optimization->solution[solIdx]->objectives == NULL) return 0;
02641 if (optimization->solution[solIdx]->objectives->values == NULL) return 0;
02642 if (objIdx < 0 || objIdx >= optimization->solution[solIdx]->objectives->values->numberOfObj)
02643 throw ErrorClass("objIdx is outside of range in routine getObjValueIdx()");
02644 return optimization->solution[solIdx]->objectives->values->obj[objIdx]->idx;
02645 }
02646
02647 std::string OSResult::getObjValueName(int solIdx, int objIdx)
02648 {
02649 if (optimization == NULL || optimization->solution == NULL)
02650 throw ErrorClass("No solution defined");
02651 int iSolutions = this->getSolutionNumber();
02652 if (solIdx < 0 || solIdx >= iSolutions)
02653 throw ErrorClass("solIdx is outside of range in routine getObjValueIdx()");
02654 if (optimization->solution[solIdx] == NULL) return "";
02655 if (optimization->solution[solIdx]->objectives == NULL) return "";
02656 if (optimization->solution[solIdx]->objectives->values == NULL) return "";
02657 if (objIdx < 0 || objIdx >= optimization->solution[solIdx]->objectives->values->numberOfObj)
02658 throw ErrorClass("objIdx is outside of range in routine getObjValueIdx()");
02659 return optimization->solution[solIdx]->objectives->values->obj[objIdx]->name;
02660 }
02661
02662 double OSResult::getObjValue(int solIdx, int objIdx)
02663 {
02664 if (optimization == NULL || optimization->solution == NULL)
02665 throw ErrorClass("No solution defined");
02666 int iSolutions = this->getSolutionNumber();
02667 if (solIdx < 0 || solIdx >= iSolutions)
02668 throw ErrorClass("solIdx is outside of range in routine getObjValue()");
02669 if (optimization->solution[solIdx] == NULL) return OSNaN();
02670 if (optimization->solution[solIdx]->objectives == NULL) return OSNaN();
02671 if (optimization->solution[solIdx]->objectives->values == NULL) return OSNaN();
02672 if (objIdx < 0 || objIdx >= optimization->solution[solIdx]->objectives->values->numberOfObj)
02673 throw ErrorClass("objIdx is outside of range in routine getObjValue()");
02674 return optimization->solution[solIdx]->objectives->values->obj[objIdx]->value;
02675 }
02676
02677 double OSResult::getOptimalObjValue(int objIdx, int solIdx)
02678 {
02679 if (this->optimization == NULL || this->optimization->solution == NULL)
02680 throw ErrorClass("No optimization or solution object defined");
02681 int iSolutions = this->getSolutionNumber();
02682 for (int i = 0; i < iSolutions; i++)
02683 {
02684 if(i != solIdx) continue;
02685 if(this->optimization->solution[i]->targetObjectiveIdx != objIdx) continue;
02686 if((this->optimization->solution[i]->status->type.find("ptimal") != string::npos ) ||
02687 this->optimization->solution[i]->status->type.compare("globallyOptimal") == 0)
02688 {
02689 return this->optimization->solution[i]->objectives->values->obj[ (objIdx >= 0 ? objIdx : -objIdx) -1 ]->value;
02690 }
02691 else
02692 {
02693 throw ErrorClass("There is no optimal solution");
02694 }
02695 }
02696 throw ErrorClass("There is no optimal solution");
02697 }
02698
02699 int OSResult::getNumberOfOtherObjectiveResults(int solIdx)
02700 {
02701 if (optimization == NULL || optimization->solution == NULL)
02702 throw ErrorClass("No solution defined");
02703 int iSolutions = this->getSolutionNumber();
02704 if (solIdx < 0 || solIdx >= iSolutions)
02705 throw ErrorClass("solIdx is outside of range in routine getNumberOfOtherObjectiveResults()");
02706 if (optimization->solution[solIdx]->objectives == NULL) return -1;
02707 if (optimization->solution[solIdx]->objectives->other == NULL) return -1;
02708 return optimization->solution[solIdx]->objectives->numberOfOtherObjectiveResults;
02709 }
02710
02711
02712 string OSResult::getOtherObjectiveResultName(int solIdx, int otherIdx)
02713 {
02714 if (optimization == NULL || optimization->solution == NULL)
02715 throw ErrorClass("No solution defined");
02716 int iSolutions = this->getSolutionNumber();
02717 if (solIdx < 0 || solIdx >= iSolutions)
02718 throw ErrorClass("solIdx is outside of range in routine getOtherObjectiveResultName()");
02719 if (optimization->solution[solIdx] == NULL) return "";
02720 if (optimization->solution[solIdx]->objectives == NULL) return "";
02721 if (optimization->solution[solIdx]->objectives->other == NULL) return "";
02722 if (otherIdx < 0 || otherIdx >= optimization->solution[solIdx]->objectives->numberOfOtherObjectiveResults)
02723 throw ErrorClass("otherIdx is outside of range in routine getOtherObjectiveResultName()");
02724 if (optimization->solution[solIdx]->objectives->other[ otherIdx] == NULL) return "";
02725 return optimization->solution[solIdx]->objectives->other[ otherIdx]->name;
02726 }
02727
02728 string OSResult::getOtherObjectiveResultValue(int solIdx, int otherIdx)
02729 {
02730 if (optimization == NULL || optimization->solution == NULL)
02731 throw ErrorClass("No solution defined");
02732 int iSolutions = this->getSolutionNumber();
02733 if (solIdx < 0 || solIdx >= iSolutions)
02734 throw ErrorClass("solIdx is outside of range in routine getOtherObjectiveResultValue()");
02735 if (optimization->solution[solIdx] == NULL) return "";
02736 if (optimization->solution[solIdx]->objectives == NULL) return "";
02737 if (optimization->solution[solIdx]->objectives->other == NULL) return "";
02738 if (otherIdx < 0 || otherIdx >= optimization->solution[solIdx]->objectives->numberOfOtherObjectiveResults)
02739 throw ErrorClass("otherIdx is outside of range in routine getOtherObjectiveResultValue()");
02740 if (optimization->solution[solIdx]->objectives->other[ otherIdx] == NULL) return "";
02741 return optimization->solution[solIdx]->objectives->other[ otherIdx]->value;
02742 }
02743
02744 string OSResult::getOtherObjectiveResultDescription(int solIdx, int otherIdx)
02745 {
02746 if (optimization == NULL || optimization->solution == NULL)
02747 throw ErrorClass("No solution defined");
02748 int iSolutions = this->getSolutionNumber();
02749 if (solIdx < 0 || solIdx >= iSolutions)
02750 throw ErrorClass("solIdx is outside of range in routine getOtherObjectiveResultDescription()");
02751 if (optimization->solution[solIdx] == NULL) return "";
02752 if (optimization->solution[solIdx]->objectives == NULL) return "";
02753 if (optimization->solution[solIdx]->objectives->other == NULL) return "";
02754 if (otherIdx < 0 || otherIdx >= optimization->solution[solIdx]->objectives->numberOfOtherObjectiveResults)
02755 throw ErrorClass("otherIdx is outside of range in routine getOtherObjectiveResultDescription()");
02756 if (optimization->solution[solIdx]->objectives->other[ otherIdx] == NULL) return "";
02757 return optimization->solution[solIdx]->objectives->other[ otherIdx]->description;
02758 }
02759
02760 int OSResult::getOtherObjectiveResultNumberOfObj(int solIdx, int otherIdx)
02761 {
02762 if (optimization == NULL || optimization->solution == NULL)
02763 throw ErrorClass("No solution defined");
02764 int iSolutions = this->getSolutionNumber();
02765 if (solIdx < 0 || solIdx >= iSolutions)
02766 throw ErrorClass("solIdx is outside of range in routine getOtherObjectiveResultNumberOfObj()");
02767 if (optimization->solution[solIdx] == NULL) return -1;
02768 if (optimization->solution[solIdx]->objectives == NULL) return -1;
02769 if (optimization->solution[solIdx]->objectives->other == NULL) return -1;
02770 if (otherIdx < 0 || otherIdx >= optimization->solution[solIdx]->objectives->numberOfOtherObjectiveResults)
02771 throw ErrorClass("otherIdx is outside of range in routine getOtherObjectiveResultNumberOfObj()");
02772 if (optimization->solution[solIdx]->objectives->other[ otherIdx] == NULL) return -1;
02773 return optimization->solution[solIdx]->objectives->other[ otherIdx]->numberOfObj;
02774 }
02775
02776 int OSResult::getOtherObjectiveResultObjIdx(int solIdx, int otherIdx, int objIdx)
02777 {
02778 if (optimization == NULL || optimization->solution == NULL)
02779 throw ErrorClass("No solution defined");
02780 int iSolutions = this->getSolutionNumber();
02781 if (solIdx < 0 || solIdx >= iSolutions)
02782 throw ErrorClass("solIdx is outside of range in routine getOtherObjectiveResultObjIdx()");
02783 if (optimization->solution[solIdx] == NULL) return 0;
02784 if (optimization->solution[solIdx]->objectives == NULL) return 0;
02785 if (optimization->solution[solIdx]->objectives->other == NULL) return 0;
02786 if (otherIdx < 0 || otherIdx >= optimization->solution[solIdx]->objectives->numberOfOtherObjectiveResults)
02787 throw ErrorClass("otherIdx is outside of range in routine getOtherObjectiveResultObjIdx()");
02788 if (optimization->solution[solIdx]->objectives->other[ otherIdx] == NULL) return -1;
02789 if (optimization->solution[solIdx]->objectives->other[ otherIdx]->obj == NULL) return -1;
02790 if (objIdx < 0 || objIdx >= optimization->solution[solIdx]->objectives->other[ otherIdx]->numberOfObj)
02791 throw ErrorClass("objIdx is outside of range in routine getOtherObjectiveResultObjIdx()");
02792 return optimization->solution[solIdx]->objectives->other[otherIdx]->obj[objIdx]->idx;
02793 }
02794
02795 string OSResult::getOtherObjectiveResultObj(int solIdx, int otherIdx, int objIdx)
02796 {
02797 if (optimization == NULL || optimization->solution == NULL)
02798 throw ErrorClass("No solution defined");
02799 int iSolutions = this->getSolutionNumber();
02800 if (solIdx < 0 || solIdx >= iSolutions)
02801 throw ErrorClass("solIdx is outside of range in routine getOtherObjectiveResultObj()");
02802 if (optimization->solution[solIdx] == NULL) return "";
02803 if (optimization->solution[solIdx]->objectives == NULL) return "";
02804 if (optimization->solution[solIdx]->objectives->other == NULL) return "";
02805 if (otherIdx < 0 || otherIdx >= optimization->solution[solIdx]->objectives->numberOfOtherObjectiveResults)
02806 throw ErrorClass("otherIdx is outside of range in routine getOtherObjectiveResultObj()");
02807 if (optimization->solution[solIdx]->objectives->other[ otherIdx] == NULL) return "";
02808 if (optimization->solution[solIdx]->objectives->other[ otherIdx]->obj == NULL) return "";
02809 if (objIdx < 0 || objIdx >= optimization->solution[solIdx]->objectives->other[ otherIdx]->numberOfObj)
02810 throw ErrorClass("otherIdx is outside of range in routine getOtherObjectiveResultObj()");
02811 return optimization->solution[solIdx]->objectives->other[otherIdx]->obj[objIdx]->value;
02812 }
02813
02814
02815 int OSResult::getOtherObjectiveResultNumberOfEnumerations(int solIdx, int otherIdx)
02816 {
02817 if (optimization == NULL || optimization->solution == NULL)
02818 throw ErrorClass("No solution defined");
02819 int iSolutions = this->getSolutionNumber();
02820 if (solIdx < 0 || solIdx >= iSolutions)
02821 throw ErrorClass("solIdx is outside of range in routine getOtherObjectiveResultNumberOfEnumerations()");
02822 if (optimization->solution[solIdx] == NULL) return -1;
02823 if (optimization->solution[solIdx]->objectives == NULL) return -1;
02824 if (optimization->solution[solIdx]->objectives->other == NULL) return -1;
02825 if (otherIdx < 0 || otherIdx >= optimization->solution[solIdx]->objectives->numberOfOtherObjectiveResults)
02826 throw ErrorClass("otherIdx is outside of range in routine getOtherObjectiveResultNumberOfEnumerations()");
02827 if (optimization->solution[solIdx]->objectives->other[ otherIdx] == NULL) return -1;
02828 return optimization->solution[solIdx]->objectives->other[ otherIdx]->numberOfEnumerations;
02829 }
02830
02831
02832 std::string OSResult::getOtherObjectiveResultEnumerationValue(int solIdx,int otherIdx, int enumIdx)
02833 {
02834 if (optimization == NULL || optimization->solution == NULL)
02835 throw ErrorClass("No solution defined");
02836 if (solIdx < 0 || solIdx >= optimization->numberOfSolutions)
02837 throw ErrorClass("solIdx is outside of range in routine getOtherObjectiveResultEnumerationValue()");
02838 if (optimization->solution[solIdx] == NULL)
02839 throw ErrorClass("solution never defined in routine getOtherObjectiveResultEnumerationValue()");
02840
02841 if (optimization->solution[solIdx]->objectives == NULL)
02842 throw ErrorClass("variables result never defined in routine getOtherObjectiveResultEnumerationValue()");
02843 if (otherIdx < 0 || otherIdx >= optimization->solution[solIdx]->objectives->numberOfOtherObjectiveResults)
02844 throw ErrorClass("otherIdx is outside of range in routine getOtherObjectiveResultEnumerationValue()");
02845 if (optimization->solution[solIdx]->objectives->other == NULL)
02846 throw ErrorClass("other variable array never defined in routine getOtherObjectiveResultEnumerationValue()");
02847 if (optimization->solution[solIdx]->objectives->other[otherIdx] == NULL)
02848 throw ErrorClass("other variable result never defined in routine getOtherObjectiveResultEnumerationValue()");
02849 if (optimization->solution[solIdx]->objectives->other[otherIdx]->enumeration == NULL)
02850 throw ErrorClass("enumerations array never defined in routine getOtherObjectiveResultEnumerationValue()");
02851 if (enumIdx < 0 || enumIdx >= optimization->solution[solIdx]->objectives->other[otherIdx]->numberOfEnumerations)
02852 throw ErrorClass("enumIdx is outside of range in routine getOtherObjectiveResultEnumerationValue()");
02853 if (optimization->solution[solIdx]->objectives->other[otherIdx]->enumeration[enumIdx] == NULL)
02854 throw ErrorClass("enumeration never defined in routine getOtherObjectiveResultEnumerationValue()");
02855
02856 return optimization->solution[solIdx]->objectives->other[otherIdx]->enumeration[enumIdx]->value;
02857 }
02858
02859
02860 std::string OSResult::getOtherObjectiveResultEnumerationDescription(int solIdx,int otherIdx, int enumIdx)
02861 {
02862 if (optimization == NULL || optimization->solution == NULL)
02863 throw ErrorClass("No solution defined");
02864 if (solIdx < 0 || solIdx >= optimization->numberOfSolutions)
02865 throw ErrorClass("solIdx is outside of range in routine getOtherObjectiveResultEnumerationDescription()");
02866 if (optimization->solution[solIdx] == NULL)
02867 throw ErrorClass("solution never defined in routine getOtherObjectiveResultEnumerationDescription()");
02868
02869 if (optimization->solution[solIdx]->objectives == NULL)
02870 throw ErrorClass("variables result never defined in routine getOtherObjectiveResultEnumerationDescription()");
02871 if (otherIdx < 0 || otherIdx >= optimization->solution[solIdx]->objectives->numberOfOtherObjectiveResults)
02872 throw ErrorClass("otherIdx is outside of range in routine getOtherObjectiveResultEnumerationDescription()");
02873 if (optimization->solution[solIdx]->objectives->other == NULL)
02874 throw ErrorClass("other variable array never defined in routine getOtherObjectiveResultEnumerationDescription()");
02875 if (optimization->solution[solIdx]->objectives->other[otherIdx] == NULL)
02876 throw ErrorClass("other variable result never defined in routine getOtherObjectiveResultEnumerationDescription()");
02877 if (optimization->solution[solIdx]->objectives->other[otherIdx]->enumeration == NULL)
02878 throw ErrorClass("enumerations array never defined in routine getOtherObjectiveResultEnumerationDescription()");
02879 if (enumIdx < 0 || enumIdx >= optimization->solution[solIdx]->objectives->other[otherIdx]->numberOfEnumerations)
02880 throw ErrorClass("enumIdx is outside of range in routine getOtherObjectiveResultEnumerationDescription()");
02881 if (optimization->solution[solIdx]->objectives->other[otherIdx]->enumeration[enumIdx] == NULL)
02882 throw ErrorClass("enumeration never defined in routine getOtherObjectiveResultEnumerationDescription()");
02883
02884 return optimization->solution[solIdx]->objectives->other[otherIdx]->enumeration[enumIdx]->description;
02885 }
02886
02887
02888 int OSResult::getOtherObjectiveResultEnumerationNumberOfEl(int solIdx,int otherIdx, int enumIdx)
02889 {
02890 if (optimization == NULL || optimization->solution == NULL)
02891 throw ErrorClass("No solution defined");
02892 if (solIdx < 0 || solIdx >= optimization->numberOfSolutions)
02893 throw ErrorClass("solIdx is outside of range in routine getOtherObjectiveResultEnumerationNumberOfEl()");
02894 if (optimization->solution[solIdx] == NULL)
02895 throw ErrorClass("solution never defined in routine getOtherObjectiveResultEnumerationNumberOfEl()");
02896
02897 if (optimization->solution[solIdx]->objectives == NULL)
02898 throw ErrorClass("variables result never defined in routine getOtherObjectiveResultEnumerationNumberOfEl()");
02899 if (otherIdx < 0 || otherIdx >= optimization->solution[solIdx]->objectives->numberOfOtherObjectiveResults)
02900 throw ErrorClass("otherIdx is outside of range in routine getOtherObjectiveResultEnumerationNumberOfEl()");
02901 if (optimization->solution[solIdx]->objectives->other == NULL)
02902 throw ErrorClass("other variable array never defined in routine getOtherObjectiveResultEnumerationNumberOfEl()");
02903 if (optimization->solution[solIdx]->objectives->other[otherIdx] == NULL)
02904 throw ErrorClass("other variable result never defined in routine getOtherObjectiveResultEnumerationNumberOfEl()");
02905 if (optimization->solution[solIdx]->objectives->other[otherIdx]->enumeration == NULL)
02906 throw ErrorClass("enumerations array never defined in routine getOtherObjectiveResultEnumerationNumberOfEl()");
02907 if (enumIdx < 0 || enumIdx >= optimization->solution[solIdx]->objectives->other[otherIdx]->numberOfEnumerations)
02908 throw ErrorClass("enumIdx is outside of range in routine getOtherObjectiveResultEnumerationNumberOfEl()");
02909 if (optimization->solution[solIdx]->objectives->other[otherIdx]->enumeration[enumIdx] == NULL)
02910 throw ErrorClass("enumeration never defined in routine getOtherObjectiveResultEnumerationNumberOfEl()");
02911
02912 return optimization->solution[solIdx]->objectives->other[otherIdx]->enumeration[enumIdx]->numberOfEl;
02913 }
02914
02915
02916 int OSResult::getOtherObjectiveResultEnumerationEl(int solIdx,int otherIdx, int enumIdx, int j)
02917 {
02918 if (optimization == NULL || optimization->solution == NULL)
02919 throw ErrorClass("No solution defined");
02920 if (solIdx < 0 || solIdx >= optimization->numberOfSolutions)
02921 throw ErrorClass("solIdx is outside of range in routine getOtherObjectiveResultEnumerationEl()");
02922 if (optimization->solution[solIdx] == NULL)
02923 throw ErrorClass("solution never defined in routine getOtherObjectiveResultEnumerationEl()");
02924
02925 if (optimization->solution[solIdx]->objectives == NULL)
02926 throw ErrorClass("variables result never defined in routine getOtherObjectiveResultEnumerationEl()");
02927 if (otherIdx < 0 || otherIdx >= optimization->solution[solIdx]->objectives->numberOfOtherObjectiveResults)
02928 throw ErrorClass("otherIdx is outside of range in routine getOtherObjectiveResultEnumerationEl()");
02929 if (optimization->solution[solIdx]->objectives->other == NULL)
02930 throw ErrorClass("other variable array never defined in routine getOtherObjectiveResultEnumerationEl()");
02931 if (optimization->solution[solIdx]->objectives->other[otherIdx] == NULL)
02932 throw ErrorClass("other variable result never defined in routine getOtherObjectiveResultEnumerationEl()");
02933 if (optimization->solution[solIdx]->objectives->other[otherIdx]->enumeration == NULL)
02934 throw ErrorClass("enumerations array never defined in routine getOtherObjectiveResultEnumerationEl()");
02935 if (enumIdx < 0 || enumIdx >= optimization->solution[solIdx]->objectives->other[otherIdx]->numberOfEnumerations)
02936 throw ErrorClass("enumIdx is outside of range in routine getOtherObjectiveResultEnumerationEl()");
02937 if (optimization->solution[solIdx]->objectives->other[otherIdx]->enumeration[enumIdx] == NULL)
02938 throw ErrorClass("enumeration never defined in routine getOtherObjectiveResultEnumerationEl()");
02939
02940 return optimization->solution[solIdx]->objectives->other[otherIdx]->enumeration[enumIdx]->getEl(j);
02941 }
02942
02943
02944
02945 int OSResult::getNumberOfDualValues(int solIdx)
02946 {
02947 if (optimization == NULL || optimization->solution == NULL)
02948 throw ErrorClass("No solution defined");
02949 int iSolutions = this->getSolutionNumber();
02950 if (solIdx < 0 || solIdx >= iSolutions)
02951 throw ErrorClass("solIdx is outside of range in routine getNumberOfDualValues()");
02952 if (optimization->solution[solIdx] == NULL) return -1;
02953 if (optimization->solution[solIdx]->constraints == NULL) return -1;
02954 if (optimization->solution[solIdx]->constraints->dualValues == NULL) return -1;
02955 return optimization->solution[solIdx]->constraints->dualValues->numberOfCon;
02956 }
02957
02958 int OSResult::getDualValueIdx(int solIdx, int conIdx)
02959 {
02960 if (optimization == NULL || optimization->solution == NULL)
02961 throw ErrorClass("No solution defined");
02962 int iSolutions = this->getSolutionNumber();
02963 if (solIdx < 0 || solIdx >= iSolutions)
02964 throw ErrorClass("solIdx is outside of range in routine getDualValueIdx()");
02965 if (optimization->solution[solIdx] == NULL) return -1;
02966 if (optimization->solution[solIdx]->constraints == NULL) return -1;
02967 if (optimization->solution[solIdx]->constraints->dualValues == NULL) return -1;
02968 if (conIdx < 0 || conIdx >= optimization->solution[solIdx]->constraints->dualValues->numberOfCon)
02969 throw ErrorClass("conIdx is outside of range in routine getDualValueIdx()");
02970 return optimization->solution[solIdx]->constraints->dualValues->con[conIdx]->idx;
02971 }
02972
02973 std::string OSResult::getDualValueName(int solIdx, int conIdx)
02974 {
02975 if (optimization == NULL || optimization->solution == NULL)
02976 throw ErrorClass("No solution defined");
02977 int iSolutions = this->getSolutionNumber();
02978 if (solIdx < 0 || solIdx >= iSolutions)
02979 throw ErrorClass("solIdx is outside of range in routine getDualValueIdx()");
02980 if (optimization->solution[solIdx] == NULL) return "";
02981 if (optimization->solution[solIdx]->constraints == NULL) return "";
02982 if (optimization->solution[solIdx]->constraints->dualValues == NULL) return "";
02983 if (conIdx < 0 || conIdx >= optimization->solution[solIdx]->constraints->dualValues->numberOfCon)
02984 throw ErrorClass("conIdx is outside of range in routine getDualValueIdx()");
02985 return optimization->solution[solIdx]->constraints->dualValues->con[conIdx]->name;
02986 }
02987
02988 double OSResult::getDualValue(int solIdx, int conIdx)
02989 {
02990 if (optimization == NULL || optimization->solution == NULL)
02991 throw ErrorClass("No solution defined");
02992 int iSolutions = this->getSolutionNumber();
02993 if (solIdx < 0 || solIdx >= iSolutions)
02994 throw ErrorClass("solIdx is outside of range in routine getDualValue()");
02995 if (optimization->solution[solIdx] == NULL) return OSNaN();
02996 if (optimization->solution[solIdx]->constraints == NULL) return OSNaN();
02997 if (optimization->solution[solIdx]->constraints->dualValues == NULL) return OSNaN();
02998 if (conIdx < 0 || conIdx >= optimization->solution[solIdx]->constraints->dualValues->numberOfCon)
02999 throw ErrorClass("conIdx is outside of range in routine getDualValue()");
03000 return optimization->solution[solIdx]->constraints->dualValues->con[conIdx]->value;
03001 }
03002
03003 std::vector<IndexValuePair*> OSResult::getOptimalDualVariableValues(int solIdx)
03004 {
03005 int numberOfCon;
03006 struct IndexValuePair *dualValPair;
03007 int iSolutions = this->getSolutionNumber();
03008 for(int i = 0; i < iSolutions; i++)
03009 {
03010 if(i != solIdx) continue;
03011 if(optimization->solution[i] == NULL) continue;
03012 if(optimization->solution[i]->constraints == NULL) continue;
03013 if(optimization->solution[i]->constraints->dualValues == NULL) continue;
03014 if((optimization->solution[i]->status->type.find("ptimal") != string::npos && m_mdDualValues == NULL) ||
03015 optimization->solution[i]->status->type.compare("globallyOptimal") == 0)
03016 {
03017 numberOfCon = optimization->solution[i]->constraints->dualValues->numberOfCon;
03018 for(int j = 0; j < numberOfCon; j++)
03019 {
03020 dualValPair = new IndexValuePair();
03021 dualValPair->idx = optimization->solution[i]->constraints->dualValues->con[j]->idx;
03022 dualValPair->value = optimization->solution[i]->constraints->dualValues->con[j]->value;
03023 dualVals.push_back( dualValPair);
03024 }
03025 }
03026 if(optimization->solution[i]->status->type.compare("globallyOptimal") == 0)
03027 {
03028 return dualVals;
03029 }
03030 }
03031 return dualVals;
03032 }
03033
03034
03035 int OSResult::getNumberOfOtherConstraintResults(int solIdx)
03036 {
03037 if (optimization == NULL || optimization->solution == NULL)
03038 throw ErrorClass("No solution defined");
03039 int iSolutions = this->getSolutionNumber();
03040 if (solIdx < 0 || solIdx >= iSolutions)
03041 throw ErrorClass("solIdx is outside of range in routine getNumberOfOtherConstraintResults()");
03042 if (optimization->solution[solIdx]->constraints == NULL) return -1;
03043 if (optimization->solution[solIdx]->constraints->other == NULL) return -1;
03044 return optimization->solution[solIdx]->constraints->numberOfOtherConstraintResults;
03045 }
03046
03047
03048 string OSResult::getOtherConstraintResultName(int solIdx, int otherIdx)
03049 {
03050 if (optimization == NULL || optimization->solution == NULL)
03051 throw ErrorClass("No solution defined");
03052 int iSolutions = this->getSolutionNumber();
03053 if (solIdx < 0 || solIdx >= iSolutions)
03054 throw ErrorClass("solIdx is outside of range in routine getOtherConstraintResultName()");
03055 if (optimization->solution[solIdx] == NULL) return "";
03056 if (optimization->solution[solIdx]->constraints == NULL) return "";
03057 if (optimization->solution[solIdx]->constraints->other == NULL) return "";
03058 if (otherIdx < 0 || otherIdx >= optimization->solution[solIdx]->constraints->numberOfOtherConstraintResults)
03059 throw ErrorClass("otherIdx is outside of range in routine getOtherConstraintResultName()");
03060 if (optimization->solution[solIdx]->constraints->other[ otherIdx] == NULL) return "";
03061 return optimization->solution[solIdx]->constraints->other[ otherIdx]->name;
03062 }
03063
03064 string OSResult::getOtherConstraintResultValue(int solIdx, int otherIdx)
03065 {
03066 if (optimization == NULL || optimization->solution == NULL)
03067 throw ErrorClass("No solution defined");
03068 int iSolutions = this->getSolutionNumber();
03069 if (solIdx < 0 || solIdx >= iSolutions)
03070 throw ErrorClass("solIdx is outside of range in routine getOtherConstraintResultValue()");
03071 if (optimization->solution[solIdx] == NULL) return "";
03072 if (optimization->solution[solIdx]->constraints == NULL) return "";
03073 if (optimization->solution[solIdx]->constraints->other == NULL) return "";
03074 if (otherIdx < 0 || otherIdx >= optimization->solution[solIdx]->constraints->numberOfOtherConstraintResults)
03075 throw ErrorClass("otherIdx is outside of range in routine getOtherConstraintResultValue()");
03076 if (optimization->solution[solIdx]->constraints->other[ otherIdx] == NULL) return "";
03077 return optimization->solution[solIdx]->constraints->other[ otherIdx]->value;
03078 }
03079
03080 string OSResult::getOtherConstraintResultDescription(int solIdx, int otherIdx)
03081 {
03082 if (optimization == NULL || optimization->solution == NULL)
03083 throw ErrorClass("No solution defined");
03084 int iSolutions = this->getSolutionNumber();
03085 if (solIdx < 0 || solIdx >= iSolutions)
03086 throw ErrorClass("solIdx is outside of range in routine getOtherConstraintResultDescription()");
03087 if (optimization->solution[solIdx] == NULL) return "";
03088 if (optimization->solution[solIdx]->constraints == NULL) return "";
03089 if (optimization->solution[solIdx]->constraints->other == NULL) return "";
03090 if (otherIdx < 0 || otherIdx >= optimization->solution[solIdx]->constraints->numberOfOtherConstraintResults)
03091 throw ErrorClass("otherIdx is outside of range in routine getOtherConstraintResultDescription()");
03092 if (optimization->solution[solIdx]->constraints->other[ otherIdx] == NULL) return "";
03093 return optimization->solution[solIdx]->constraints->other[ otherIdx]->description;
03094 }
03095
03096 int OSResult::getOtherConstraintResultNumberOfCon(int solIdx, int otherIdx)
03097 {
03098 if (optimization == NULL || optimization->solution == NULL)
03099 throw ErrorClass("No solution defined");
03100 int iSolutions = this->getSolutionNumber();
03101 if (solIdx < 0 || solIdx >= iSolutions)
03102 throw ErrorClass("solIdx is outside of range in routine getOtherConstraintResultNumberOfCon()");
03103 if (optimization->solution[solIdx] == NULL) return -1;
03104 if (optimization->solution[solIdx]->constraints == NULL) return -1;
03105 if (optimization->solution[solIdx]->constraints->other == NULL) return -1;
03106 if (otherIdx < 0 || otherIdx >= optimization->solution[solIdx]->constraints->numberOfOtherConstraintResults)
03107 throw ErrorClass("otherIdx is outside of range in routine getOtherConstraintResultNumberOfCon()");
03108 if (optimization->solution[solIdx]->constraints->other[ otherIdx] == NULL) return -1;
03109 return optimization->solution[solIdx]->constraints->other[ otherIdx]->numberOfCon;
03110 }
03111
03112 int OSResult::getOtherConstraintResultConIdx(int solIdx, int otherIdx, int conIdx)
03113 {
03114 if (optimization == NULL || optimization->solution == NULL)
03115 throw ErrorClass("No solution defined");
03116 int iSolutions = this->getSolutionNumber();
03117 if (solIdx < 0 || solIdx >= iSolutions)
03118 throw ErrorClass("solIdx is outside of range in routine getOtherConstraintResultConIdx()");
03119 if (optimization->solution[solIdx] == NULL) return -1;
03120 if (optimization->solution[solIdx]->constraints == NULL) return -1;
03121 if (optimization->solution[solIdx]->constraints->other == NULL) return -1;
03122 if (otherIdx < 0 || otherIdx >= optimization->solution[solIdx]->constraints->numberOfOtherConstraintResults)
03123 throw ErrorClass("otherIdx is outside of range in routine getOtherConstraintResultConIdx()");
03124 if (optimization->solution[solIdx]->constraints->other[ otherIdx] == NULL) return -1;
03125 if (optimization->solution[solIdx]->constraints->other[ otherIdx]->con == NULL) return -1;
03126 if (conIdx < 0 || conIdx >= optimization->solution[solIdx]->constraints->other[ otherIdx]->numberOfCon)
03127 throw ErrorClass("otherIdx is outside of range in routine getOtherConstraintResultConIdx()");
03128 return optimization->solution[solIdx]->constraints->other[otherIdx]->con[conIdx]->idx;
03129 }
03130
03131 string OSResult::getOtherConstraintResultCon(int solIdx, int otherIdx, int conIdx)
03132 {
03133 if (optimization == NULL || optimization->solution == NULL)
03134 throw ErrorClass("No solution defined");
03135 int iSolutions = this->getSolutionNumber();
03136 if (solIdx < 0 || solIdx >= iSolutions)
03137 throw ErrorClass("solIdx is outside of range in routine getOtherConstraintResultCon()");
03138 if (optimization->solution[solIdx] == NULL) return "";
03139 if (optimization->solution[solIdx]->constraints == NULL) return "";
03140 if (optimization->solution[solIdx]->constraints->other == NULL) return "";
03141 if (otherIdx < 0 || otherIdx >= optimization->solution[solIdx]->constraints->numberOfOtherConstraintResults)
03142 throw ErrorClass("otherIdx is outside of range in routine getOtherConstraintResultCon()");
03143 if (optimization->solution[solIdx]->constraints->other[ otherIdx] == NULL) return "";
03144 if (optimization->solution[solIdx]->constraints->other[ otherIdx]->con == NULL) return "";
03145 if (conIdx < 0 || conIdx >= optimization->solution[solIdx]->constraints->other[ otherIdx]->numberOfCon)
03146 throw ErrorClass("otherIdx is outside of range in routine getOtherConstraintResultCon()");
03147 return optimization->solution[solIdx]->constraints->other[otherIdx]->con[conIdx]->value;
03148 }
03149
03150
03151 int OSResult::getOtherConstraintResultNumberOfEnumerations(int solIdx, int otherIdx)
03152 {
03153 if (optimization == NULL || optimization->solution == NULL)
03154 throw ErrorClass("No solution defined");
03155 int iSolutions = this->getSolutionNumber();
03156 if (solIdx < 0 || solIdx >= iSolutions)
03157 throw ErrorClass("solIdx is outside of range in routine getOtherConstraintResultNumberOfEnumerations()");
03158 if (optimization->solution[solIdx] == NULL) return -1;
03159 if (optimization->solution[solIdx]->constraints == NULL) return -1;
03160 if (optimization->solution[solIdx]->constraints->other == NULL) return -1;
03161 if (otherIdx < 0 || otherIdx >= optimization->solution[solIdx]->constraints->numberOfOtherConstraintResults)
03162 throw ErrorClass("otherIdx is outside of range in routine getOtherConstraintResultNumberOfEnumerations()");
03163 if (optimization->solution[solIdx]->constraints->other[ otherIdx] == NULL) return -1;
03164 return optimization->solution[solIdx]->constraints->other[ otherIdx]->numberOfEnumerations;
03165 }
03166
03167
03168 std::string OSResult::getOtherConstraintResultEnumerationValue(int solIdx,int otherIdx, int enumIdx)
03169 {
03170 if (optimization == NULL || optimization->solution == NULL)
03171 throw ErrorClass("No solution defined");
03172 if (solIdx < 0 || solIdx >= optimization->numberOfSolutions)
03173 throw ErrorClass("solIdx is outside of range in routine getOtherConstraintResultEnumerationValue()");
03174 if (optimization->solution[solIdx] == NULL)
03175 throw ErrorClass("solution never defined in routine getOtherConstraintResultEnumerationValue()");
03176
03177 if (optimization->solution[solIdx]->constraints == NULL)
03178 throw ErrorClass("variables result never defined in routine getOtherConstraintResultEnumerationValue()");
03179 if (otherIdx < 0 || otherIdx >= optimization->solution[solIdx]->constraints->numberOfOtherConstraintResults)
03180 throw ErrorClass("otherIdx is outside of range in routine getOtherConstraintResultEnumerationValue()");
03181 if (optimization->solution[solIdx]->constraints->other == NULL)
03182 throw ErrorClass("other variable array never defined in routine getOtherConstraintResultEnumerationValue()");
03183 if (optimization->solution[solIdx]->constraints->other[otherIdx] == NULL)
03184 throw ErrorClass("other variable result never defined in routine getOtherConstraintResultEnumerationValue()");
03185 if (optimization->solution[solIdx]->constraints->other[otherIdx]->enumeration == NULL)
03186 throw ErrorClass("enumerations array never defined in routine getOtherConstraintResultEnumerationValue()");
03187 if (enumIdx < 0 || enumIdx >= optimization->solution[solIdx]->constraints->other[otherIdx]->numberOfEnumerations)
03188 throw ErrorClass("enumIdx is outside of range in routine getOtherConstraintResultEnumerationValue()");
03189 if (optimization->solution[solIdx]->constraints->other[otherIdx]->enumeration[enumIdx] == NULL)
03190 throw ErrorClass("enumeration never defined in routine getOtherConstraintResultEnumerationValue()");
03191
03192 return optimization->solution[solIdx]->constraints->other[otherIdx]->enumeration[enumIdx]->value;
03193 }
03194
03195
03196 std::string OSResult::getOtherConstraintResultEnumerationDescription(int solIdx,int otherIdx, int enumIdx)
03197 {
03198 if (optimization == NULL || optimization->solution == NULL)
03199 throw ErrorClass("No solution defined");
03200 if (solIdx < 0 || solIdx >= optimization->numberOfSolutions)
03201 throw ErrorClass("solIdx is outside of range in routine getOtherConstraintResultEnumerationDescription()");
03202 if (optimization->solution[solIdx] == NULL)
03203 throw ErrorClass("solution never defined in routine getOtherConstraintResultEnumerationDescription()");
03204
03205 if (optimization->solution[solIdx]->constraints == NULL)
03206 throw ErrorClass("variables result never defined in routine getOtherConstraintResultEnumerationDescription()");
03207 if (otherIdx < 0 || otherIdx >= optimization->solution[solIdx]->constraints->numberOfOtherConstraintResults)
03208 throw ErrorClass("otherIdx is outside of range in routine getOtherConstraintResultEnumerationDescription()");
03209 if (optimization->solution[solIdx]->constraints->other == NULL)
03210 throw ErrorClass("other variable array never defined in routine getOtherConstraintResultEnumerationDescription()");
03211 if (optimization->solution[solIdx]->constraints->other[otherIdx] == NULL)
03212 throw ErrorClass("other variable result never defined in routine getOtherConstraintResultEnumerationDescription()");
03213 if (optimization->solution[solIdx]->constraints->other[otherIdx]->enumeration == NULL)
03214 throw ErrorClass("enumerations array never defined in routine getOtherConstraintResultEnumerationDescription()");
03215 if (enumIdx < 0 || enumIdx >= optimization->solution[solIdx]->constraints->other[otherIdx]->numberOfEnumerations)
03216 throw ErrorClass("enumIdx is outside of range in routine getOtherConstraintResultEnumerationDescription()");
03217 if (optimization->solution[solIdx]->constraints->other[otherIdx]->enumeration[enumIdx] == NULL)
03218 throw ErrorClass("enumeration never defined in routine getOtherConstraintResultEnumerationDescription()");
03219
03220 return optimization->solution[solIdx]->constraints->other[otherIdx]->enumeration[enumIdx]->description;
03221 }
03222
03223 int OSResult::getOtherConstraintResultEnumerationNumberOfEl(int solIdx,int otherIdx, int enumIdx)
03224 {
03225 if (optimization == NULL || optimization->solution == NULL)
03226 throw ErrorClass("No solution defined");
03227 if (solIdx < 0 || solIdx >= optimization->numberOfSolutions)
03228 throw ErrorClass("solIdx is outside of range in routine getOtherConstraintResultEnumerationNumberOfEl()");
03229 if (optimization->solution[solIdx] == NULL)
03230 throw ErrorClass("solution never defined in routine getOtherConstraintResultEnumerationNumberOfEl()");
03231
03232 if (optimization->solution[solIdx]->constraints == NULL)
03233 throw ErrorClass("variables result never defined in routine getOtherConstraintResultEnumerationNumberOfEl()");
03234 if (otherIdx < 0 || otherIdx >= optimization->solution[solIdx]->constraints->numberOfOtherConstraintResults)
03235 throw ErrorClass("otherIdx is outside of range in routine getOtherConstraintResultEnumerationNumberOfEl()");
03236 if (optimization->solution[solIdx]->constraints->other == NULL)
03237 throw ErrorClass("other variable array never defined in routine getOtherConstraintResultEnumerationNumberOfEl()");
03238 if (optimization->solution[solIdx]->constraints->other[otherIdx] == NULL)
03239 throw ErrorClass("other variable result never defined in routine getOtherConstraintResultEnumerationNumberOfEl()");
03240 if (optimization->solution[solIdx]->constraints->other[otherIdx]->enumeration == NULL)
03241 throw ErrorClass("enumerations array never defined in routine getOtherConstraintResultEnumerationNumberOfEl()");
03242 if (enumIdx < 0 || enumIdx >= optimization->solution[solIdx]->constraints->other[otherIdx]->numberOfEnumerations)
03243 throw ErrorClass("enumIdx is outside of range in routine getOtherConstraintResultEnumerationNumberOfEl()");
03244 if (optimization->solution[solIdx]->constraints->other[otherIdx]->enumeration[enumIdx] == NULL)
03245 throw ErrorClass("enumeration never defined in routine getOtherConstraintResultEnumerationNumberOfEl()");
03246
03247 return optimization->solution[solIdx]->constraints->other[otherIdx]->enumeration[enumIdx]->numberOfEl;
03248 }
03249
03250 int OSResult::getOtherConstraintResultEnumerationEl(int solIdx,int otherIdx, int enumIdx, int j)
03251 {
03252 if (optimization == NULL || optimization->solution == NULL)
03253 throw ErrorClass("No solution defined");
03254 if (solIdx < 0 || solIdx >= optimization->numberOfSolutions)
03255 throw ErrorClass("solIdx is outside of range in routine getOtherConstraintResultEnumerationEl()");
03256 if (optimization->solution[solIdx] == NULL)
03257 throw ErrorClass("solution never defined in routine getOtherConstraintResultEnumerationEl()");
03258
03259 if (optimization->solution[solIdx]->constraints == NULL)
03260 throw ErrorClass("variables result never defined in routine getOtherConstraintResultEnumerationEl()");
03261 if (otherIdx < 0 || otherIdx >= optimization->solution[solIdx]->constraints->numberOfOtherConstraintResults)
03262 throw ErrorClass("otherIdx is outside of range in routine getOtherConstraintResultEnumerationEl()");
03263 if (optimization->solution[solIdx]->constraints->other == NULL)
03264 throw ErrorClass("other variable array never defined in routine getOtherConstraintResultEnumerationEl()");
03265 if (optimization->solution[solIdx]->constraints->other[otherIdx] == NULL)
03266 throw ErrorClass("other variable result never defined in routine getOtherConstraintResultEnumerationEl()");
03267 if (optimization->solution[solIdx]->constraints->other[otherIdx]->enumeration == NULL)
03268 throw ErrorClass("enumerations array never defined in routine getOtherConstraintResultEnumerationEl()");
03269 if (enumIdx < 0 || enumIdx >= optimization->solution[solIdx]->constraints->other[otherIdx]->numberOfEnumerations)
03270 throw ErrorClass("enumIdx is outside of range in routine getOtherConstraintResultEnumerationEl()");
03271 if (optimization->solution[solIdx]->constraints->other[otherIdx]->enumeration[enumIdx] == NULL)
03272 throw ErrorClass("enumeration never defined in routine getOtherConstraintResultEnumerationEl()");
03273
03274 return optimization->solution[solIdx]->constraints->other[otherIdx]->enumeration[enumIdx]->getEl(j);
03275 }
03276
03277
03278
03279 int OSResult::getNumberOfOtherSolutionResults(int solIdx)
03280 {
03281 if (optimization == NULL || optimization->solution == NULL)
03282 throw ErrorClass("No solution defined");
03283 int iSolutions = this->getSolutionNumber();
03284 if (solIdx < 0 || solIdx >= iSolutions)
03285 throw ErrorClass("solIdx is outside of range in routine getNumberOfOtherSolutionResults()");
03286 if (optimization->solution[solIdx] == NULL) return -1;
03287 if (optimization->solution[solIdx]->otherSolutionResults == NULL) return -1;
03288 return optimization->solution[solIdx]->otherSolutionResults->numberOfOtherSolutionResults;
03289 }
03290
03291 string OSResult::getOtherSolutionResultName(int solIdx, int otherIdx)
03292 {
03293 if (optimization == NULL || optimization->solution == NULL)
03294 throw ErrorClass("No solution defined");
03295 int iSolutions = this->getSolutionNumber();
03296 if (solIdx < 0 || solIdx >= iSolutions)
03297 throw ErrorClass("solIdx is outside of range in routine getOtherSolutionResultName()");
03298 if (optimization->solution[solIdx] == NULL) return "";
03299 if (optimization->solution[solIdx]->otherSolutionResults == NULL) return "";
03300 if (otherIdx < 0 || otherIdx >= optimization->solution[solIdx]->otherSolutionResults->numberOfOtherSolutionResults)
03301 throw ErrorClass("otherIdx is outside of range in routine getOtherSolutionResultName()");
03302 if (optimization->solution[solIdx]->otherSolutionResults->otherSolutionResult[otherIdx] == NULL) return "";
03303 return optimization->solution[solIdx]->otherSolutionResults->otherSolutionResult[otherIdx]->name;
03304 }
03305
03306 string OSResult::getOtherSolutionResultCategory(int solIdx, int otherIdx)
03307 {
03308 if (optimization == NULL || optimization->solution == NULL)
03309 throw ErrorClass("No solution defined");
03310 int iSolutions = this->getSolutionNumber();
03311 if (solIdx < 0 || solIdx >= iSolutions)
03312 throw ErrorClass("solIdx is outside of range in routine getOtherSolutionResultCategory()");
03313 if (optimization->solution[solIdx] == NULL) return "";
03314 if (optimization->solution[solIdx]->otherSolutionResults == NULL) return "";
03315 if (otherIdx < 0 || otherIdx >= optimization->solution[solIdx]->otherSolutionResults->numberOfOtherSolutionResults)
03316 throw ErrorClass("otherIdx is outside of range in routine getOtherSolutionResultCategory()");
03317 if (optimization->solution[solIdx]->otherSolutionResults->otherSolutionResult[otherIdx] == NULL) return "";
03318 return optimization->solution[solIdx]->otherSolutionResults->otherSolutionResult[otherIdx]->category;
03319 }
03320
03321 string OSResult::getOtherSolutionResultDescription(int solIdx, int otherIdx)
03322 {
03323 if (optimization == NULL || optimization->solution == NULL)
03324 throw ErrorClass("No solution defined");
03325 int iSolutions = this->getSolutionNumber();
03326 if (solIdx < 0 || solIdx >= iSolutions)
03327 throw ErrorClass("solIdx is outside of range in routine getOtherSolutionResultDescription()");
03328 if (optimization->solution[solIdx] == NULL) return "";
03329 if (optimization->solution[solIdx]->otherSolutionResults == NULL) return "";
03330 if (otherIdx < 0 || otherIdx >= optimization->solution[solIdx]->otherSolutionResults->numberOfOtherSolutionResults)
03331 throw ErrorClass("otherIdx is outside of range in routine getOtherSolutionResultDescription()");
03332 if (optimization->solution[solIdx]->otherSolutionResults->otherSolutionResult[otherIdx] == NULL) return "";
03333 return optimization->solution[solIdx]->otherSolutionResults->otherSolutionResult[otherIdx]->description;
03334 }
03335
03336 int OSResult::getOtherSolutionResultNumberOfItems(int solIdx, int otherIdx)
03337 {
03338 if (optimization == NULL || optimization->solution == NULL)
03339 throw ErrorClass("No solution defined");
03340 int iSolutions = this->getSolutionNumber();
03341 if (solIdx < 0 || solIdx >= iSolutions)
03342 throw ErrorClass("solIdx is outside of range in routine getOtherSolutionResultNumberOfItems()");
03343 if (optimization->solution[solIdx] == NULL) return -1;
03344 if (optimization->solution[solIdx]->otherSolutionResults == NULL) return -1;
03345 if (otherIdx < 0 || otherIdx >= optimization->solution[solIdx]->otherSolutionResults->numberOfOtherSolutionResults)
03346 throw ErrorClass("otherIdx is outside of range in routine getOtherSolutionResultNumberOfItems()");
03347 if (optimization->solution[solIdx]->otherSolutionResults->otherSolutionResult[otherIdx] == NULL) return -1;
03348 return optimization->solution[solIdx]->otherSolutionResults->otherSolutionResult[otherIdx]->numberOfItems;
03349 }
03350
03351 string OSResult::getOtherSolutionResultItem(int solIdx, int otherIdx, int itemIdx)
03352 {
03353 if (optimization == NULL || optimization->solution == NULL)
03354 throw ErrorClass("No solution defined");
03355 int iSolutions = this->getSolutionNumber();
03356 if (solIdx < 0 || solIdx >= iSolutions)
03357 throw ErrorClass("solIdx is outside of range in routine getOtherSolutionResultItem()");
03358 if (optimization->solution[solIdx] == NULL) return "";
03359 if (optimization->solution[solIdx]->otherSolutionResults == NULL) return "";
03360 if (optimization->solution[solIdx]->otherSolutionResults->otherSolutionResult[otherIdx] == NULL) return "";
03361 if (otherIdx < 0 || otherIdx >= optimization->solution[solIdx]->otherSolutionResults->numberOfOtherSolutionResults)
03362 throw ErrorClass("otherIdx is outside of range in routine getOtherSolutionResultItem()");
03363 if (optimization->solution[solIdx]->otherSolutionResults->otherSolutionResult[otherIdx]->item == NULL) return "";
03364 if (itemIdx < 0 || itemIdx >= optimization->solution[solIdx]->otherSolutionResults->otherSolutionResult[otherIdx]->numberOfItems)
03365 throw ErrorClass("itemIdx is outside of range in routine getOtherSolutionResultItem()");
03366 return optimization->solution[solIdx]->otherSolutionResults->otherSolutionResult[otherIdx]->item[itemIdx];
03367 }
03368
03369 int OSResult::getNumberOfSolverOutputs()
03370 {
03371 if (optimization == NULL || optimization->otherSolverOutput == NULL) return -1;
03372 return optimization->otherSolverOutput->numberOfSolverOutputs;
03373 }
03374
03375 string OSResult::getSolverOutputName(int otherIdx)
03376 {
03377 if (optimization == NULL) return "";
03378 if (optimization->otherSolverOutput == NULL) return "";
03379 if (otherIdx < 0 || otherIdx >= optimization->otherSolverOutput->numberOfSolverOutputs)
03380 throw ErrorClass("otherIdx is outside of range in routine getSolverOutputName()");
03381 if (optimization->otherSolverOutput->solverOutput[otherIdx] == NULL) return "";
03382 return optimization->otherSolverOutput->solverOutput[otherIdx]->name;
03383 }
03384
03385 string OSResult::getSolverOutputCategory(int otherIdx)
03386 {
03387 if (optimization == NULL) return "";
03388 if (optimization->otherSolverOutput == NULL) return "";
03389 if (otherIdx < 0 || otherIdx >= optimization->otherSolverOutput->numberOfSolverOutputs)
03390 throw ErrorClass("otherIdx is outside of range in routine getSolverOutputCategory()");
03391 if (optimization->otherSolverOutput->solverOutput[otherIdx] == NULL) return "";
03392 return optimization->otherSolverOutput->solverOutput[otherIdx]->category;
03393 }
03394
03395 string OSResult::getSolverOutputDescription(int otherIdx)
03396 {
03397 if (optimization == NULL) return "";
03398 if (optimization->otherSolverOutput == NULL) return "";
03399 if (otherIdx < 0 || otherIdx >= optimization->otherSolverOutput->numberOfSolverOutputs)
03400 throw ErrorClass("otherIdx is outside of range in routine getSolverOutputDescription()");
03401 if (optimization->otherSolverOutput->solverOutput[otherIdx] == NULL) return "";
03402 return optimization->otherSolverOutput->solverOutput[otherIdx]->description;
03403 }
03404
03405 int OSResult::getSolverOutputNumberOfItems(int otherIdx)
03406 {
03407 if (optimization == NULL) return -1;
03408 if (optimization->otherSolverOutput == NULL) return -1;
03409 if (otherIdx < 0 || otherIdx >= optimization->otherSolverOutput->numberOfSolverOutputs)
03410 throw ErrorClass("otherIdx is outside of range in routine getSolverOutputNumberOfItems()");
03411 if (optimization->otherSolverOutput->solverOutput[otherIdx] == NULL) return -1;
03412 return optimization->otherSolverOutput->solverOutput[otherIdx]->numberOfItems;
03413 }
03414
03415 string OSResult::getSolverOutputItem(int otherIdx, int itemIdx)
03416 {
03417 if (optimization == NULL) return "";
03418 if (optimization->otherSolverOutput == NULL) return "";
03419 if (otherIdx < 0 || otherIdx >= optimization->otherSolverOutput->numberOfSolverOutputs)
03420 throw ErrorClass("otherIdx is outside of range in routine getSolverOutputItem");
03421 if (optimization->otherSolverOutput->solverOutput[otherIdx] == NULL) return "";
03422 if (itemIdx < 0 || itemIdx >= optimization->otherSolverOutput->solverOutput[otherIdx]->numberOfItems)
03423 throw ErrorClass("itemIdx is outside of range in routine getSolverOutputItem()");
03424 return optimization->otherSolverOutput->solverOutput[otherIdx]->item[itemIdx];;
03425 }
03426
03427
03428
03429
03430 bool OSResult::setResultHeader(std::string name, std::string source,
03431 std::string fileCreator, std::string description, std::string licence)
03432 {
03433 if (this->resultHeader == NULL)
03434 this->resultHeader = new GeneralFileHeader();
03435 return this->resultHeader->setHeader(name, source, fileCreator, description, licence);
03436 }
03437
03438 bool OSResult::setGeneralStatus(GeneralStatus *status)
03439 {
03440 if (general == NULL) general = new GeneralResult();
03441 if (general->generalStatus == NULL) general->generalStatus = new GeneralStatus();
03442 general->generalStatus = status;
03443 return true;
03444 }
03445
03446 bool OSResult::setGeneralStatusType(string type)
03447 {
03448 if (general == NULL) general = new GeneralResult();
03449 if (verifyGeneralResultStatus(type) == 0) return false;
03450 if (general->generalStatus == NULL) general->generalStatus = new GeneralStatus();
03451 general->generalStatus->type = type;
03452 return true;
03453 }
03454
03455 bool OSResult::setGeneralStatusDescription(string description)
03456 {
03457 if (general == NULL) general = new GeneralResult();
03458 if (general->generalStatus == NULL) general->generalStatus = new GeneralStatus();
03459 general->generalStatus->description = description;
03460 return true;
03461 }
03462
03463 bool OSResult::setNumberOfGeneralSubstatuses(int num)
03464 {
03465 if (num < 0) return false;
03466
03467 if (general == NULL) general = new GeneralResult();
03468 if (general->generalStatus == NULL) general->generalStatus = new GeneralStatus();
03469 if (general->generalStatus->substatus != NULL) return false;
03470 general->generalStatus->numberOfSubstatuses = num;
03471 if (num > 0)
03472 {
03473 general->generalStatus->substatus = new GeneralSubstatus*[num];
03474 for(int i = 0; i < num; i++)
03475 general->generalStatus->substatus[i] = new GeneralSubstatus();
03476 }
03477 return true;
03478 }
03479
03480 bool OSResult::setGeneralSubstatusName(int idx, string name)
03481 {
03482 if (general == NULL) general = new GeneralResult();
03483 if (general->generalStatus == NULL) return false;
03484 if (idx < 0 || idx >= general->generalStatus->numberOfSubstatuses) return false;
03485 general->generalStatus->substatus[idx]->name = name;
03486 return true;
03487 }
03488
03489 bool OSResult::setGeneralSubstatusDescription(int idx, string description)
03490 {
03491 if (general == NULL) general = new GeneralResult();
03492 if (general->generalStatus == NULL) return false;
03493 if (idx < 0 || idx >= general->generalStatus->numberOfSubstatuses) return false;
03494 general->generalStatus->substatus[idx]->description = description;
03495 return true;
03496 }
03497
03498 bool OSResult::setGeneralMessage(string message)
03499 {
03500 if (general == NULL) general = new GeneralResult();
03501 general->message = message;
03502 return true;
03503 }
03504
03505 bool OSResult::setServiceName(string serviceName)
03506 {
03507 if (general == NULL) general = new GeneralResult();
03508 general->serviceName = serviceName;
03509 return true;
03510 }
03511
03512 bool OSResult::setServiceURI(string serviceURI)
03513 {
03514 if (general == NULL) general = new GeneralResult();
03515 general->serviceURI = serviceURI;
03516 return true;
03517 }
03518
03519 bool OSResult::setInstanceName(string instanceName)
03520 {
03521 if (general == NULL) general = new GeneralResult();
03522 general->instanceName = instanceName;
03523 return true;
03524 }
03525
03526 bool OSResult::setJobID(string jobID)
03527 {
03528 if (general == NULL) general = new GeneralResult();
03529 general->jobID = jobID;
03530 return true;
03531 }
03532
03533 bool OSResult::setSolverInvoked(string solverInvoked)
03534 {
03535 if (general == NULL) general = new GeneralResult();
03536 general->solverInvoked = solverInvoked;
03537 return true;
03538 }
03539
03540 bool OSResult::setTimeStamp(string timeStamp)
03541 {
03542 if (general == NULL) general = new GeneralResult();
03543 general->timeStamp = timeStamp;
03544 return true;
03545 }
03546
03547 bool OSResult::setNumberOfOtherGeneralResults(int num)
03548 {
03549 if (general == NULL) general = new GeneralResult();
03550 if(general->otherResults == NULL) general->otherResults = new OtherResults();
03551 if (num < 0) return false;
03552 if (general->otherResults->other != NULL) return false;
03553 general->otherResults->numberOfOtherResults = num;
03554 if (num > 0)
03555 {
03556 general->otherResults->other = new OtherResult*[num];
03557 for(int i = 0; i < num; i++)
03558 general->otherResults->other[i] = new OtherResult();
03559 }
03560 return true;
03561 }
03562
03563
03564 bool OSResult::setOtherGeneralResultName(int idx, string name)
03565 {
03566 if (general == NULL) general = new GeneralResult();
03567 if (general->otherResults == NULL) return false;
03568 if (idx < 0 || idx >= general->otherResults->numberOfOtherResults)
03569 return false;
03570 general->otherResults->other[idx]->name = name;
03571 return true;
03572 }
03573
03574 bool OSResult::setOtherGeneralResultValue(int idx, string value)
03575 {
03576 if (general == NULL) general = new GeneralResult();
03577 if (general->otherResults == NULL) return false;
03578 if (idx < 0 || idx >= general->otherResults->numberOfOtherResults)
03579 return false;
03580 general->otherResults->other[idx]->value = value;
03581 return true;
03582 }
03583
03584 bool OSResult::setOtherGeneralResultDescription(int idx, string description)
03585 {
03586 if (general == NULL) general = new GeneralResult();
03587 if (general->otherResults == NULL) return false;
03588 if (idx < 0 || idx >= general->otherResults->numberOfOtherResults)
03589 return false;
03590 general->otherResults->other[idx]->description = description;
03591 return true;
03592 }
03593
03594 bool OSResult::setSystemInformation(string systemInformation)
03595 {
03596 if (system == NULL) system = new SystemResult();
03597 system->systemInformation = systemInformation;
03598 return true;
03599 }
03600
03601 bool OSResult::setAvailableDiskSpaceUnit(std::string unit)
03602 {
03603 if (system == NULL) system = new SystemResult();
03604 if (system->availableDiskSpace == NULL) system->availableDiskSpace = new StorageCapacity();
03605 if (verifyStorageUnit(unit) == false) return false;
03606 system->availableDiskSpace->unit = unit;
03607 return true;
03608 }
03609
03610 bool OSResult::setAvailableDiskSpaceDescription(std::string description)
03611 {
03612 if (system == NULL) system = new SystemResult();
03613 if (system->availableDiskSpace == NULL) system->availableDiskSpace = new StorageCapacity();
03614 system->availableDiskSpace->description = description;
03615 return true;
03616 }
03617
03618 bool OSResult::setAvailableDiskSpaceValue(double value)
03619 {
03620 if (system == NULL) system = new SystemResult();
03621 if (system->availableDiskSpace == NULL) system->availableDiskSpace = new StorageCapacity();
03622 system->availableDiskSpace->value = value;
03623 return true;
03624 }
03625
03626 bool OSResult::setAvailableMemoryUnit(std::string unit)
03627 {
03628 if (system == NULL) system = new SystemResult();
03629 if (system->availableMemory == NULL) system->availableMemory = new StorageCapacity();
03630 if (verifyStorageUnit(unit) == false) return false;
03631 system->availableMemory->unit = unit;
03632 return true;
03633 }
03634
03635 bool OSResult::setAvailableMemoryDescription(std::string description)
03636 {
03637 if (system == NULL) system = new SystemResult();
03638 if (system->availableMemory == NULL) system->availableMemory = new StorageCapacity();
03639 system->availableMemory->description = description;
03640 return true;
03641 }
03642
03643 bool OSResult::setAvailableMemoryValue(double value)
03644 {
03645 if (system == NULL) system = new SystemResult();
03646 if (system->availableMemory == NULL) system->availableMemory = new StorageCapacity();
03647 system->availableMemory->value = value;
03648 return true;
03649 }
03650
03651 bool OSResult::setAvailableCPUSpeedUnit(std::string unit)
03652 {
03653 if (system == NULL) return false;
03654 if (system->availableCPUSpeed == NULL) system->availableCPUSpeed = new CPUSpeed();
03655 if (verifyCPUSpeedUnit(unit) == false) return false;
03656 system->availableCPUSpeed->unit = unit;
03657 return true;
03658 }
03659
03660 bool OSResult::setAvailableCPUSpeedDescription(std::string description)
03661 {
03662 if (system == NULL) system = new SystemResult();
03663 if (system->availableCPUSpeed == NULL) system->availableCPUSpeed = new CPUSpeed();
03664 system->availableCPUSpeed->description = description;
03665 return true;
03666 }
03667
03668 bool OSResult::setAvailableCPUSpeedValue(double value)
03669 {
03670 if (system == NULL) system = new SystemResult();
03671 if (system->availableCPUSpeed == NULL) system->availableCPUSpeed = new CPUSpeed();
03672 system->availableCPUSpeed->value = value;
03673 return true;
03674 }
03675
03676 bool OSResult::setAvailableCPUNumberDescription(std::string description)
03677 {
03678 if (system == NULL) system = new SystemResult();
03679 if (system->availableCPUNumber == NULL) system->availableCPUNumber = new CPUNumber();
03680 system->availableCPUNumber->description = description;
03681 return true;
03682 }
03683
03684 bool OSResult::setAvailableCPUNumberValue(int value)
03685 {
03686 if (system == NULL) system = new SystemResult();
03687 if (system->availableCPUNumber == NULL) system->availableCPUNumber = new CPUNumber();
03688 system->availableCPUNumber->value = value;
03689 return true;
03690 }
03691
03692 bool OSResult::setNumberOfOtherSystemResults(int num)
03693 {
03694 if (system == NULL) system = new SystemResult();
03695 if(system->otherResults == NULL) system->otherResults = new OtherResults();
03696 if (num < 0) return false;
03697 if (system->otherResults->other != NULL) return false;
03698 system->otherResults->numberOfOtherResults = num;
03699 if (num > 0)
03700 {
03701 system->otherResults->other = new OtherResult*[num];
03702 for(int i = 0; i < num; i++)
03703 system->otherResults->other[i] = new OtherResult();
03704 }
03705 return true;
03706 }
03707
03708
03709 bool OSResult::setOtherSystemResultName(int idx, string name)
03710 {
03711 if (system == NULL) system = new SystemResult();
03712 if (system->otherResults == NULL) return false;
03713 if (idx < 0 || idx >= system->otherResults->numberOfOtherResults)
03714 return false;
03715 system->otherResults->other[idx]->name = name;
03716 return true;
03717 }
03718
03719 bool OSResult::setOtherSystemResultValue(int idx, string value)
03720 {
03721 if (system == NULL) system = new SystemResult();
03722 if (system->otherResults == NULL) return false;
03723 if (idx < 0 || idx >= system->otherResults->numberOfOtherResults)
03724 return false;
03725 system->otherResults->other[idx]->value = value;
03726 return true;
03727 }
03728
03729 bool OSResult::setOtherSystemResultDescription(int idx, string description)
03730 {
03731 if (system == NULL) system = new SystemResult();
03732 if (system->otherResults == NULL) return false;
03733 if (idx < 0 || idx >= system->otherResults->numberOfOtherResults)
03734 return false;
03735 system->otherResults->other[idx]->description = description;
03736 return true;
03737 }
03738
03739 bool OSResult::setCurrentState(std::string currentState)
03740 {
03741 if(verifySystemCurrentState(currentState) == 0) return false;
03742
03743 if (service == NULL) service = new ServiceResult();
03744 service->currentState = currentState;
03745 return true;
03746 }
03747
03748 bool OSResult::setCurrentJobCount(int jobCount)
03749 {
03750 if (service == NULL) service = new ServiceResult();
03751 service->currentJobCount = jobCount;
03752 return true;
03753 }
03754
03755 bool OSResult::setTotalJobsSoFar(int number)
03756 {
03757 if (service == NULL) service = new ServiceResult();
03758 service->totalJobsSoFar = number;
03759 return true;
03760 }
03761
03762 bool OSResult::setTimeServiceStarted(std::string startTime)
03763 {
03764 if (service == NULL) service = new ServiceResult();
03765 service->timeServiceStarted = startTime;
03766 return true;
03767 }
03768
03769 bool OSResult::setServiceUtilization(double value)
03770 {
03771 if (service == NULL) service = new ServiceResult();
03772 service->serviceUtilization = value;
03773 return true;
03774 }
03775
03776 bool OSResult::setNumberOfOtherServiceResults(int num)
03777 {
03778 if (num < 0) return false;
03779
03780 if (service == NULL) service = new ServiceResult();
03781 if(service->otherResults == NULL) service->otherResults = new OtherResults();
03782 if (service->otherResults->other != NULL) return false;
03783 service->otherResults->numberOfOtherResults = num;
03784 if (num > 0)
03785 {
03786 service->otherResults->other = new OtherResult*[num];
03787 for(int i = 0; i < num; i++)
03788 service->otherResults->other[i] = new OtherResult();
03789 }
03790 return true;
03791 }
03792
03793 bool OSResult::setOtherServiceResultName(int idx, string name)
03794 {
03795 if (service == NULL) service = new ServiceResult();
03796 if (service->otherResults == NULL) return false;
03797 if (idx < 0 || idx >= service->otherResults->numberOfOtherResults)
03798 return false;
03799 service->otherResults->other[idx]->name = name;
03800 return true;
03801 }
03802
03803 bool OSResult::setOtherServiceResultValue(int idx, string value)
03804 {
03805 if (service == NULL) service = new ServiceResult();
03806 if (service->otherResults == NULL) return false;
03807 if (idx < 0 || idx >= service->otherResults->numberOfOtherResults)
03808 return false;
03809 service->otherResults->other[idx]->value = value;
03810 return true;
03811 }
03812
03813 bool OSResult::setOtherServiceResultDescription(int idx, string description)
03814 {
03815 if (service == NULL) service = new ServiceResult();
03816 if (service->otherResults == NULL) return false;
03817 if (idx < 0 || idx >= service->otherResults->numberOfOtherResults)
03818 return false;
03819 service->otherResults->other[idx]->description = description;
03820 return true;
03821 }
03822
03823 bool OSResult::setJobStatus(std::string status)
03824 {
03825 if (verifyJobStatus(status) == 0) return false;
03826
03827 if (job == NULL) job = new JobResult();
03828 job->status = status;
03829 return true;
03830 }
03831
03832 bool OSResult::setJobSubmitTime(std::string submitTime)
03833 {
03834 if (job == NULL) job = new JobResult();
03835 job->submitTime = submitTime;
03836 return true;
03837 }
03838
03839 bool OSResult::setScheduledStartTime(std::string scheduledStartTime)
03840 {
03841 if (job == NULL) job = new JobResult();
03842 job->scheduledStartTime = scheduledStartTime;
03843 return true;
03844 }
03845
03846 bool OSResult::setActualStartTime(std::string actualStartTime)
03847 {
03848 if (job == NULL) job = new JobResult();
03849 job->actualStartTime = actualStartTime;
03850 return true;
03851 }
03852
03853 bool OSResult::setJobEndTime(std::string endTime)
03854 {
03855 if (job == NULL) job = new JobResult();
03856 job->endTime = endTime;
03857 return true;
03858 }
03859
03860 bool OSResult::setTime(double time)
03861 {
03862 return addTimingInformation("elapsedTime", "total", "second", "", time);
03863 }
03864
03865 bool OSResult::addTimingInformation(std::string type, std::string category, std::string unit, std::string description, double value)
03866
03867 {
03868 int nt;
03869 int i;
03870 if (verifyTimeUnit(unit) != true)
03871 throw ErrorClass("Invalid unit of time in addTimingInformation()");
03872 if (job == NULL) job = new JobResult();
03873 if (job->timingInformation == NULL) job->timingInformation = new TimingInformation();
03874
03875 nt = job->timingInformation->numberOfTimes;
03876 TimeMeasurement** temp = new TimeMeasurement*[nt+1];
03877 for (i = 0; i < nt; i++)
03878 temp[i] = job->timingInformation->time[i];
03879
03880 delete[] job->timingInformation->time;
03881
03882
03883 temp[ nt] = new TimeMeasurement();
03884
03885 temp[ nt]->type = type;
03886 temp[ nt]->category = category;
03887 temp[ nt]->unit = unit;
03888 temp[ nt]->description = description;
03889 temp[ nt]->value = value;
03890
03891 job->timingInformation->time = temp;
03892 job->timingInformation->numberOfTimes = ++nt;
03893
03894 return true;
03895 }
03896
03897
03898 bool OSResult::setTimingInformation(int idx, std::string type, std::string category,
03899 std::string unit, std::string description, double value)
03900 {
03901 if (verifyTimeUnit(unit) == 0) return false;
03902 if (verifyTimeType(type) == 0) return false;
03903 if (verifyTimeCategory(category) == 0) return false;
03904
03905 if (job == NULL) job = new JobResult();
03906 if (job->timingInformation == NULL) return false;
03907 if (idx < 0 || idx >= job->timingInformation->numberOfTimes)
03908 return false;
03909
03910 job->timingInformation->time[idx]->type = type;
03911 job->timingInformation->time[idx]->category = category;
03912 job->timingInformation->time[idx]->unit = unit;
03913 job->timingInformation->time[idx]->description = description;
03914 job->timingInformation->time[idx]->value = value;
03915
03916 return true;
03917 }
03918
03919
03920 bool OSResult::setNumberOfTimes(int numberOfTimes)
03921 {
03922 if (numberOfTimes < 0) return false;
03923
03924 if (job == NULL) job = new JobResult();
03925 if (job->timingInformation == NULL) job->timingInformation = new TimingInformation();
03926 job->timingInformation->numberOfTimes = numberOfTimes;
03927 if (numberOfTimes > 0)
03928 {
03929 job->timingInformation->time = new TimeMeasurement*[numberOfTimes];
03930 for(int i = 0; i < numberOfTimes; i++)
03931 job->timingInformation->time[i] = new TimeMeasurement();
03932 }
03933 return true;
03934 }
03935
03936 bool OSResult::setTimeNumber(int numberOfTimes)
03937 {
03938 if (numberOfTimes < 0) return false;
03939
03940 if (job == NULL) job = new JobResult();
03941 if (job->timingInformation == NULL) job->timingInformation = new TimingInformation();
03942 job->timingInformation->numberOfTimes = numberOfTimes;
03943 return true;
03944 }
03945
03946 bool OSResult::setUsedDiskSpaceUnit(std::string unit)
03947 {
03948 if (verifyStorageUnit(unit) == 0) return false;
03949
03950 if (job == NULL) job = new JobResult();
03951 if (job->usedDiskSpace == NULL) job->usedDiskSpace = new StorageCapacity();
03952 job->usedDiskSpace->unit = unit;
03953 return true;
03954 }
03955
03956 bool OSResult::setUsedDiskSpaceDescription(std::string description)
03957 {
03958 if (job == NULL) job = new JobResult();
03959 if (job->usedDiskSpace == NULL) job->usedDiskSpace = new StorageCapacity();
03960 job->usedDiskSpace->description = description;
03961 return true;
03962 }
03963
03964 bool OSResult::setUsedDiskSpaceValue(double value)
03965 {
03966 if (job == NULL) job = new JobResult();
03967 if (job->usedDiskSpace == NULL) job->usedDiskSpace = new StorageCapacity();
03968 job->usedDiskSpace->value = value;
03969 return true;
03970 }
03971
03972 bool OSResult::setUsedMemoryUnit(std::string unit)
03973 {
03974 if (verifyStorageUnit(unit) == 0) return false;
03975
03976 if (job == NULL) job = new JobResult();
03977 if (job->usedMemory == NULL) job->usedMemory = new StorageCapacity();
03978 job->usedMemory->unit = unit;
03979 return true;
03980 }
03981
03982 bool OSResult::setUsedMemoryDescription(std::string description)
03983 {
03984 if (job == NULL) job = new JobResult();
03985 if (job->usedMemory == NULL) job->usedMemory = new StorageCapacity();
03986 job->usedMemory->description = description;
03987 return true;
03988 }
03989
03990 bool OSResult::setUsedMemoryValue(double value)
03991 {
03992 if (job == NULL) job = new JobResult();
03993 if (job->usedMemory == NULL) job->usedMemory = new StorageCapacity();
03994 job->usedMemory->value = value;
03995 return true;
03996 }
03997
03998 bool OSResult::setUsedCPUSpeedUnit(std::string unit)
03999 {
04000 if ( verifyCPUSpeedUnit(unit) == 0) return false;
04001
04002 if (job == NULL) job = new JobResult();
04003 if (job->usedCPUSpeed == NULL) job->usedCPUSpeed = new CPUSpeed();
04004 job->usedCPUSpeed->unit = unit;
04005 return true;
04006 }
04007
04008 bool OSResult::setUsedCPUSpeedDescription(std::string description)
04009 {
04010 if (job == NULL) job = new JobResult();
04011 if (job->usedCPUSpeed == NULL) job->usedCPUSpeed = new CPUSpeed();
04012 job->usedCPUSpeed->description = description;
04013 return true;
04014 }
04015
04016 bool OSResult::setUsedCPUSpeedValue(double value)
04017 {
04018 if (job == NULL) job = new JobResult();
04019 if (job->usedCPUSpeed == NULL) job->usedCPUSpeed = new CPUSpeed();
04020 job->usedCPUSpeed->value = value;
04021 return true;
04022 }
04023
04024 bool OSResult::setUsedCPUNumberDescription(std::string description)
04025 {
04026 if (job == NULL) job = new JobResult();
04027 if (job->usedCPUNumber == NULL) job->usedCPUNumber = new CPUNumber();
04028 job->usedCPUNumber->description = description;
04029 return true;
04030 }
04031
04032 bool OSResult::setUsedCPUNumberValue(int value)
04033 {
04034 if (job == NULL) job = new JobResult();
04035 if (job->usedCPUNumber == NULL) job->usedCPUNumber = new CPUNumber();
04036 job->usedCPUNumber->value = value;
04037 return true;
04038 }
04039
04040 bool OSResult::setNumberOfOtherJobResults(int num)
04041 {
04042 if (job == NULL) job = new JobResult();
04043 if (job->otherResults == NULL) job->otherResults = new OtherResults();
04044 if (num < 0) return false;
04045 if (job->otherResults->other != NULL) return false;
04046 job->otherResults->numberOfOtherResults = num;
04047 if (num > 0)
04048 {
04049 job->otherResults->other = new OtherResult*[num];
04050 for(int i = 0; i < num; i++)
04051 job->otherResults->other[i] = new OtherResult();
04052 }
04053 return true;
04054 }
04055
04056
04057 bool OSResult::setOtherJobResultName(int idx, string name)
04058 {
04059 if (job == NULL) job = new JobResult();
04060 if (job->otherResults == NULL) return false;
04061 if (idx < 0 || idx >= job->otherResults->numberOfOtherResults)
04062 return false;
04063 job->otherResults->other[idx]->name = name;
04064 return true;
04065 }
04066
04067 bool OSResult::setOtherJobResultValue(int idx, string value)
04068 {
04069 if (job == NULL) job = new JobResult();
04070 if (job->otherResults == NULL) return false;
04071 if (idx < 0 || idx >= job->otherResults->numberOfOtherResults)
04072 return false;
04073 job->otherResults->other[idx]->value = value;
04074 return true;
04075 }
04076
04077 bool OSResult::setOtherJobResultDescription(int idx, string description)
04078 {
04079 if (job == NULL) job = new JobResult();
04080 if (job->otherResults == NULL) return false;
04081 if (idx < 0 || idx >= job->otherResults->numberOfOtherResults)
04082 return false;
04083 job->otherResults->other[idx]->description = description;
04084 return true;
04085 }
04086
04087
04088 bool OSResult::setVariableNumber(int variableNumber)
04089 {
04090 if(variableNumber < 0)
04091 return false;
04092 if(optimization == NULL) optimization = new OptimizationResult();
04093 optimization->numberOfVariables = variableNumber;
04094 return true;
04095 }
04096
04097 bool OSResult::setObjectiveNumber(int objectiveNumber)
04098 {
04099 if(objectiveNumber < 0)
04100 return false;
04101 if(optimization == NULL) optimization = new OptimizationResult();
04102 optimization->numberOfObjectives = objectiveNumber;
04103 return true;
04104 }
04105
04106 bool OSResult::setConstraintNumber(int constraintNumber)
04107 {
04108 if(constraintNumber < 0)
04109 return false;
04110 if(optimization == NULL) optimization = new OptimizationResult();
04111 optimization->numberOfConstraints = constraintNumber;
04112 return true;
04113 }
04114
04115 bool OSResult::setSolutionNumber(int number)
04116 {
04117 if(number < 0) return false;
04118 if(number == 0) return true;
04119 if(optimization == NULL) optimization = new OptimizationResult();
04120 optimization->numberOfSolutions = number;
04121 optimization->solution = new OptimizationSolution*[number];
04122 for(int i = 0; i < number; i++)
04123 {
04124 optimization->solution[i] = new OptimizationSolution();
04125 }
04126 return true;
04127 }
04128
04129 bool OSResult::setSolutionStatus(int solIdx, string type, string description)
04130 {
04131 int nSols = this->getSolutionNumber();
04132 if(optimization == NULL) return false;
04133 if(nSols <= 0) return false;
04134 if(optimization->solution == NULL ||
04135 solIdx < 0 || solIdx >= nSols) return false;
04136 if(optimization->solution[solIdx] == NULL)
04137 optimization->solution[solIdx] = new OptimizationSolution();
04138 if(optimization->solution[solIdx]->status == NULL)
04139 optimization->solution[solIdx]->status = new OptimizationSolutionStatus();
04140
04141 if (verifySolutionStatus(type) == false) return false;
04142
04143 optimization->solution[solIdx]->status->type = type;
04144 optimization->solution[solIdx]->status->description = description;
04145 return true;
04146 }
04147
04148 bool OSResult::setSolutionStatusType(int solIdx, std::string type)
04149 {
04150 int nSols = this->getSolutionNumber();
04151 if(optimization == NULL) return false;
04152 if(nSols <= 0) return false;
04153 if(optimization->solution == NULL ||
04154 solIdx < 0 || solIdx >= nSols) return false;
04155 if(optimization->solution[solIdx] == NULL)
04156 optimization->solution[solIdx] = new OptimizationSolution();
04157 if(optimization->solution[solIdx]->status == NULL)
04158 optimization->solution[solIdx]->status = new OptimizationSolutionStatus();
04159
04160 if (verifySolutionStatus(type) == false) return false;
04161
04162 optimization->solution[solIdx]->status->type = type;
04163 return true;
04164 }
04165
04166 bool OSResult::setSolutionStatusDescription(int solIdx, std::string description)
04167 {
04168 int nSols = this->getSolutionNumber();
04169 if(optimization == NULL) return false;
04170 if(nSols <= 0) return false;
04171 if(optimization->solution == NULL ||
04172 solIdx < 0 || solIdx >= nSols) return false;
04173 if(optimization->solution[solIdx] == NULL)
04174 {
04175 optimization->solution[solIdx] = new OptimizationSolution();
04176 }
04177 if(optimization->solution[solIdx]->status == NULL)
04178 {
04179 optimization->solution[solIdx]->status = new OptimizationSolutionStatus();
04180 }
04181 optimization->solution[solIdx]->status->description = description;
04182 return true;
04183 }
04184
04185 bool OSResult::setNumberOfSolutionSubstatuses(int solIdx, int num)
04186 {
04187 int nSols = this->getSolutionNumber();
04188 if (optimization == NULL) return false;
04189 if (nSols <= 0) return false;
04190 if (optimization->solution == NULL ||
04191 solIdx < 0 || solIdx >= nSols) return false;
04192 if (optimization->solution[solIdx] == NULL)
04193 {
04194 optimization->solution[solIdx] = new OptimizationSolution();
04195 }
04196 if (optimization->solution[solIdx]->status == NULL)
04197 {
04198 optimization->solution[solIdx]->status = new OptimizationSolutionStatus();
04199 }
04200 if (num < 0) return false;
04201 if (optimization->solution[solIdx]->status->substatus != NULL) return false;
04202 optimization->solution[solIdx]->status->numberOfSubstatuses = num;
04203 if (num > 0)
04204 {
04205 optimization->solution[solIdx]->status->substatus = new OptimizationSolutionSubstatus*[num];
04206 for(int i = 0; i < num; i++)
04207 {
04208 optimization->solution[solIdx]->status->substatus[i] = new OptimizationSolutionSubstatus();
04209 }
04210 }
04211 return true;
04212 }
04213
04214 bool OSResult::setSolutionSubstatusType(int solIdx, int substatusIdx, std::string type)
04215 {
04216 int nSols = this->getSolutionNumber();
04217 if(optimization == NULL) return false;
04218 if(optimization->solution == NULL ||
04219 solIdx < 0 || solIdx >= nSols) return false;
04220 if(optimization->solution[solIdx] == NULL) return false;
04221 if(optimization->solution[solIdx]->status == NULL) return false;
04222 int nSubs = optimization->solution[solIdx]->status->numberOfSubstatuses;
04223 if (substatusIdx < 0 || substatusIdx >= nSubs) return false;
04224
04225 if (verifySolutionSubstatusType(type) == 0) return false;
04226
04227 optimization->solution[solIdx]->status->substatus[substatusIdx]->type = type;
04228 return true;
04229 }
04230
04231 bool OSResult::setSolutionSubstatusDescription(int solIdx, int substatusIdx, std::string description)
04232 {
04233 int nSols = this->getSolutionNumber();
04234 if(optimization == NULL) return false;
04235 if(optimization->solution == NULL ||
04236 solIdx < 0 || solIdx >= nSols) return false;
04237 if(optimization->solution[solIdx] == NULL) return false;
04238 if(optimization->solution[solIdx]->status == NULL) return false;
04239 int nSubs = optimization->solution[solIdx]->status->numberOfSubstatuses;
04240 if (substatusIdx < 0 || substatusIdx >= nSubs) return false;
04241 optimization->solution[solIdx]->status->substatus[substatusIdx]->description = description;
04242 return true;
04243 }
04244
04245 bool OSResult::setSolutionTargetObjectiveIdx(int solIdx, int objectiveIdx)
04246 {
04247 int nSols = this->getSolutionNumber();
04248 if(optimization == NULL) return false;
04249 if(nSols <= 0) return false;
04250 if(optimization == NULL) return false;
04251 if(optimization->solution == NULL ||
04252 solIdx < 0 || solIdx >= nSols) return false;
04253 if(optimization->solution[solIdx] == NULL)
04254 {
04255 optimization->solution[solIdx] = new OptimizationSolution();
04256 }
04257 if(objectiveIdx >= 0) return false;
04258 optimization->solution[solIdx]->targetObjectiveIdx = objectiveIdx;
04259 return true;
04260 }
04261
04262 bool OSResult::setSolutionTargetObjectiveName(int solIdx, std::string objectiveName)
04263 {
04264 int nSols = this->getSolutionNumber();
04265 if(optimization == NULL) return false;
04266 if(nSols <= 0) return false;
04267 if(optimization == NULL) return false;
04268 if(optimization->solution == NULL ||
04269 solIdx < 0 || solIdx >= nSols) return false;
04270 if(optimization->solution[solIdx] == NULL)
04271 {
04272 optimization->solution[solIdx] = new OptimizationSolution();
04273 }
04274 optimization->solution[solIdx]->targetObjectiveName = objectiveName;
04275 return true;
04276 }
04277
04278 bool OSResult::setSolutionWeightedObjectives(int solIdx, bool weightedObjectives)
04279 {
04280 int nSols = this->getSolutionNumber();
04281 if (optimization == NULL) return false;
04282 if (nSols <= 0) return false;
04283 if (optimization == NULL) return false;
04284 if (optimization->solution == NULL ||
04285 solIdx < 0 || solIdx >= nSols) return false;
04286 if (optimization->solution[solIdx] == NULL)
04287 optimization->solution[solIdx] = new OptimizationSolution();
04288 optimization->solution[solIdx]->weightedObjectives = weightedObjectives;
04289 return true;
04290 }
04291
04292 bool OSResult::setSolutionMessage(int solIdx, std::string msg)
04293 {
04294 int nSols = this->getSolutionNumber();
04295 if(optimization == NULL) return false;
04296 if(nSols <= 0) return false;
04297 if(optimization == NULL) return false;
04298 if(optimization->solution == NULL ||
04299 solIdx < 0 || solIdx >= nSols) return false;
04300 if(optimization->solution[solIdx] == NULL)
04301 {
04302 optimization->solution[solIdx] = new OptimizationSolution();
04303 }
04304 optimization->solution[solIdx]->message = msg;
04305 return true;
04306 }
04307
04308 bool OSResult::setNumberOfPrimalVariableValues(int solIdx, int numberOfVar)
04309 {
04310 int nSols = this->getSolutionNumber();
04311 int nVar = this->getVariableNumber();
04312 if (numberOfVar <= 0 || numberOfVar > nVar) return false;
04313 if (optimization == NULL) return false;
04314 if (nSols <= 0) return false;
04315 if (optimization->solution == NULL ||
04316 solIdx < 0 || solIdx >= nSols) return false;
04317 if (optimization->solution[solIdx] == NULL)
04318 {
04319 optimization->solution[solIdx] = new OptimizationSolution();
04320 }
04321 if (optimization->solution[solIdx]->variables == NULL)
04322 {
04323 optimization->solution[solIdx]->variables = new VariableSolution();
04324 }
04325 if (optimization->solution[solIdx]->variables->values == NULL)
04326 {
04327 optimization->solution[solIdx]->variables->values = new VariableValues();
04328 }
04329 if (numberOfVar < 0) return false;
04330 if (optimization->solution[solIdx]->variables->values->var != NULL) return false;
04331 optimization->solution[solIdx]->variables->values->numberOfVar = numberOfVar;
04332 if (numberOfVar > 0)
04333 optimization->solution[solIdx]->variables->values->var = new VarValue*[numberOfVar];
04334 return true;
04335 }
04336
04337 bool OSResult::setPrimalVariableValuesSparse(int solIdx, std::vector<IndexValuePair*> x)
04338 {
04339 int nSols = this->getSolutionNumber();
04340 int numberOfVar = x.size();
04341 if(optimization == NULL) return false;
04342 if(nSols <= 0) return false;
04343 if(optimization->solution == NULL ||
04344 solIdx < 0 || solIdx >= nSols) return false;
04345 if(optimization->solution[solIdx] == NULL)
04346 {
04347 optimization->solution[solIdx] = new OptimizationSolution();
04348 }
04349 if(optimization->solution[solIdx]->variables == NULL)
04350 {
04351 optimization->solution[solIdx]->variables = new VariableSolution();
04352 }
04353 if (optimization->solution[solIdx]->variables->values == NULL)
04354 {
04355 optimization->solution[solIdx]->variables->values = new VariableValues();
04356 }
04357 if (optimization->solution[solIdx]->variables->values->var == NULL)
04358 {
04359 optimization->solution[solIdx]->variables->values->var = new VarValue*[numberOfVar];
04360 }
04361 optimization->solution[solIdx]->variables->values->numberOfVar = numberOfVar;
04362 if(x.size() == 0)
04363 {
04364
04365 return true;
04366 }
04367 for(int i = 0; i < numberOfVar; i++)
04368 {
04369 optimization->solution[solIdx]->variables->values->var[i] = new VarValue();
04370 optimization->solution[solIdx]->variables->values->var[i]->idx = x[i]->idx;
04371 optimization->solution[solIdx]->variables->values->var[i]->value = x[i]->value;
04372 }
04373 return true;
04374 }
04375
04376 bool OSResult::setPrimalVariableValuesDense(int solIdx, double *x)
04377 {
04378 int numberOfVar = this->getVariableNumber();
04379 int nSols = this->getSolutionNumber();
04380 if(optimization == NULL) return false;
04381 if(nSols <= 0) return false;
04382 if(optimization->solution == NULL ||
04383 solIdx < 0 || solIdx >= nSols) return false;
04384 if(optimization->solution[solIdx] == NULL)
04385 {
04386 optimization->solution[solIdx] = new OptimizationSolution();
04387 }
04388 if(optimization->solution[solIdx]->variables == NULL)
04389 {
04390 optimization->solution[solIdx]->variables = new VariableSolution();
04391 }
04392 if(optimization->solution[solIdx]->variables->values == NULL)
04393 {
04394 optimization->solution[solIdx]->variables->values = new VariableValues();
04395 }
04396 if(optimization->solution[solIdx]->variables->values->var == NULL)
04397 {
04398 optimization->solution[solIdx]->variables->values->var = new VarValue*[numberOfVar];
04399 }
04400 optimization->solution[solIdx]->variables->values->numberOfVar = numberOfVar;
04401 if(x == NULL)
04402 {
04403
04404 return true;
04405 }
04406 for(int i = 0; i < numberOfVar; i++)
04407 {
04408 optimization->solution[solIdx]->variables->values->var[i] = new VarValue();
04409 optimization->solution[solIdx]->variables->values->var[i]->idx = i;
04410 optimization->solution[solIdx]->variables->values->var[i]->value = x[i];
04411 }
04412 return true;
04413 }
04414
04415 bool OSResult::setNumberOfVarValues(int solIdx, int numberOfVar)
04416 {
04417 if (optimization == NULL || optimization->solution == NULL)
04418 {
04419
04420 return false;
04421 }
04422 int nSols = optimization->numberOfSolutions;
04423 if (solIdx < 0 || solIdx >= nSols) return false;
04424 if (optimization->solution[solIdx] == NULL)
04425 optimization->solution[solIdx] = new OptimizationSolution();
04426 if (optimization->solution[solIdx]->variables == NULL)
04427 optimization->solution[solIdx]->variables = new VariableSolution();
04428 if (optimization->solution[solIdx]->variables->values == NULL)
04429 optimization->solution[solIdx]->variables->values = new VariableValues();
04430 if (optimization->solution[solIdx]->variables->values->numberOfVar > 0) return false;
04431 if (numberOfVar < 0) return false;
04432 if (optimization->solution[solIdx]->variables->values->var != NULL) return false;
04433 optimization->solution[solIdx]->variables->values->numberOfVar = numberOfVar;
04434 if (numberOfVar > 0)
04435 {
04436 optimization->solution[solIdx]->variables->values->var = new VarValue*[numberOfVar];
04437 for(int i = 0; i < numberOfVar; i++)
04438 optimization->solution[solIdx]->variables->values->var[i] = new VarValue();
04439 }
04440 return true;
04441 }
04442
04443 bool OSResult::setVarValue(int solIdx, int number, int idx, std::string name, double val)
04444 {
04445 if (optimization == NULL || optimization->solution == NULL)
04446 {
04447
04448 return false;
04449 }
04450 int nSols = optimization->numberOfSolutions;
04451 if (solIdx < 0 || solIdx >= nSols)
04452 {
04453
04454 return false;
04455 }
04456 if (optimization->solution[solIdx] == NULL)
04457 {
04458
04459 return false;
04460 }
04461 if (optimization->solution[solIdx]->variables == NULL)
04462 {
04463
04464 return false;
04465 }
04466 if (optimization->solution[solIdx]->variables->values == NULL)
04467 {
04468
04469 return false;
04470 }
04471 int nVar = optimization->solution[solIdx]->variables->values->numberOfVar;
04472 if (number < 0 || number >= nVar)
04473 {
04474
04475 return false;
04476 }
04477 if (idx < 0)
04478 {
04479
04480 return false;
04481 }
04482 optimization->solution[solIdx]->variables->values->var[number]->idx = idx;
04483 optimization->solution[solIdx]->variables->values->var[number]->name = name;
04484 optimization->solution[solIdx]->variables->values->var[number]->value = val;
04485 return true;
04486 }
04487
04488
04489 bool OSResult::setNumberOfVarValuesString(int solIdx, int numberOfVar)
04490 {
04491 if (optimization == NULL || optimization->solution == NULL)
04492 {
04493
04494 return false;
04495 }
04496 int nSols = optimization->numberOfSolutions;
04497 if (solIdx < 0 || solIdx >= nSols)
04498 {
04499
04500 return false;
04501 }
04502 if (optimization->solution[solIdx] == NULL)
04503 optimization->solution[solIdx] = new OptimizationSolution();
04504 if (optimization->solution[solIdx]->variables == NULL)
04505 optimization->solution[solIdx]->variables = new VariableSolution();
04506 if (optimization->solution[solIdx]->variables->valuesString == NULL)
04507 optimization->solution[solIdx]->variables->valuesString = new VariableValuesString();
04508 if (optimization->solution[solIdx]->variables->valuesString->numberOfVar > 0)
04509 return false;
04510 if (numberOfVar < 0) return false;
04511 if (optimization->solution[solIdx]->variables->valuesString->var != NULL) return false;
04512 optimization->solution[solIdx]->variables->valuesString->numberOfVar = numberOfVar;
04513 if (numberOfVar > 0)
04514 {
04515 optimization->solution[solIdx]->variables->valuesString->var = new VarValueString*[numberOfVar];
04516 for(int i = 0; i < numberOfVar; i++)
04517 optimization->solution[solIdx]->variables->valuesString->var[i] = new VarValueString();
04518 }
04519 return true;
04520 }
04521
04522 bool OSResult::setVarValueString(int solIdx, int number, int idx, std::string name, std::string str)
04523 {
04524 if (optimization == NULL || optimization->solution == NULL)
04525 {
04526
04527 return false;
04528 }
04529 int nSols = optimization->numberOfSolutions;
04530 if (solIdx < 0 || solIdx >= nSols)
04531 {
04532
04533 return false;
04534 }
04535 if (optimization->solution[solIdx] == NULL)
04536 {
04537
04538 return false;
04539 }
04540 if (optimization->solution[solIdx]->variables == NULL)
04541 {
04542
04543 return false;
04544 }
04545 if (optimization->solution[solIdx]->variables->valuesString == NULL)
04546 {
04547
04548 return false;
04549 }
04550 int nVar = optimization->solution[solIdx]->variables->valuesString->numberOfVar;
04551 if (number < 0 || number >= nVar)
04552 {
04553
04554 return false;
04555 }
04556 if (idx < 0)
04557 {
04558
04559 return false;
04560 }
04561 optimization->solution[solIdx]->variables->valuesString->var[number]->idx = idx;
04562 optimization->solution[solIdx]->variables->valuesString->var[number]->name = name;
04563 optimization->solution[solIdx]->variables->valuesString->var[number]->value = str;
04564 return true;
04565 }
04566
04567 bool OSResult::setBasisStatus(int solIdx, int object, int status, int *i, int ni)
04568 {
04569 if (optimization == NULL || optimization->solution == NULL)
04570 return false;
04571 int nSols = optimization->numberOfSolutions;
04572 if (solIdx < 0 || solIdx >= nSols)
04573 return false;
04574 if (optimization->solution[solIdx] == NULL)
04575 optimization->solution[solIdx] = new OptimizationSolution();
04576
04577 switch (object)
04578 {
04579 case ENUM_PROBLEM_COMPONENT_variables:
04580 {
04581 if (optimization->solution[solIdx]->variables == NULL)
04582 optimization->solution[solIdx]->variables = new VariableSolution();
04583 if (optimization->solution[solIdx]->variables->basisStatus == NULL)
04584 optimization->solution[solIdx]->variables->basisStatus = new BasisStatus();
04585 for (int j=0; j<ni; j++) if (i[j] < 0) return false;
04586 return optimization->solution[solIdx]->variables->basisStatus->setIntVector(status, i, ni);
04587 }
04588 case ENUM_PROBLEM_COMPONENT_objectives:
04589 {
04590 if (optimization->solution[solIdx]->objectives == NULL)
04591 optimization->solution[solIdx]->objectives = new ObjectiveSolution();
04592 if (optimization->solution[solIdx]->objectives->basisStatus == NULL)
04593 optimization->solution[solIdx]->objectives->basisStatus = new BasisStatus();
04594 for (int j=0; j<ni; j++) if (i[j] >= 0) return false;
04595 return optimization->solution[solIdx]->objectives->basisStatus->setIntVector(status, i, ni);
04596 }
04597 case ENUM_PROBLEM_COMPONENT_constraints:
04598 {
04599 if (optimization->solution[solIdx]->constraints == NULL)
04600 optimization->solution[solIdx]->constraints = new ConstraintSolution();
04601 if (optimization->solution[solIdx]->constraints->basisStatus == NULL)
04602 optimization->solution[solIdx]->constraints->basisStatus = new BasisStatus();
04603 for (int j=0; j<ni; j++) if (i[j] < 0) return false;
04604 return optimization->solution[solIdx]->constraints->basisStatus->setIntVector(status, i, ni);
04605 }
04606 default:
04607 throw ErrorClass("target object not implemented in setBasisStatus");
04608 }
04609 }
04610
04611 bool OSResult::setNumberOfOtherVariableResults(int solIdx, int num)
04612 {
04613
04614
04615 int nSols = this->getSolutionNumber();
04616 if (nSols <= 0) return false;
04617 if (optimization == NULL) return false;
04618 if (optimization->solution == NULL ||
04619 solIdx < 0 || solIdx >= nSols) return false;
04620 if (optimization->solution[solIdx] == NULL)
04621 optimization->solution[solIdx] = new OptimizationSolution();
04622 if (optimization->solution[solIdx]->variables == NULL)
04623 optimization->solution[solIdx]->variables = new VariableSolution();
04624 if (num < 0) return false;
04625 if (optimization->solution[solIdx]->variables->other != NULL) return false;
04626 optimization->solution[solIdx]->variables->numberOfOtherVariableResults = num;
04627 if (num > 0)
04628 {
04629 optimization->solution[solIdx]->variables->other = new OtherVariableResult*[num];
04630 for(int i = 0; i < num; i++)
04631 optimization->solution[solIdx]->variables->other[ i] = new OtherVariableResult();
04632 }
04633 return true;
04634 }
04635
04636
04637 bool OSResult::setAnOtherVariableResultSparse(int solIdx, int otherIdx, string name, string value, string description, int *idx, string *s, int numberOfVar)
04638 {
04639 int iNumberOfVariables = numberOfVar;
04640 if(iNumberOfVariables <= -1) return false;
04641 int nSols = this->getSolutionNumber();
04642 if(optimization == NULL) return false;
04643 if(nSols <= 0) return false;
04644 if(optimization == NULL) return false;
04645 if(optimization->solution == NULL ||
04646 solIdx < 0 || solIdx >= nSols) return false;
04647 if(optimization->solution[solIdx] == NULL) return false;
04648 if(optimization->solution[solIdx]->variables == NULL)return false;
04649 if(optimization->solution[solIdx]->variables->other == NULL) return false;
04650 if(optimization->solution[solIdx]->variables->other[ otherIdx] == NULL) return false;
04651 optimization->solution[solIdx]->variables->other[ otherIdx]->name = name;
04652 optimization->solution[solIdx]->variables->other[ otherIdx]->value = value;
04653 optimization->solution[solIdx]->variables->other[ otherIdx]->description = description;
04654 optimization->solution[solIdx]->variables->other[ otherIdx]->numberOfVar = numberOfVar;
04655 if (optimization->solution[solIdx]->variables->other[ otherIdx]->var == NULL)
04656 optimization->solution[solIdx]->variables->other[ otherIdx]->var = new OtherVarResult*[numberOfVar];
04657 for(int i = 0; i < numberOfVar; i++)
04658 {
04659 optimization->solution[solIdx]->variables->other[ otherIdx]->var[i] = new OtherVarResult();
04660 optimization->solution[solIdx]->variables->other[ otherIdx]->var[i]->idx = idx[i];
04661 optimization->solution[solIdx]->variables->other[ otherIdx]->var[i]->value = s[i];
04662 }
04663 return true;
04664 }
04665
04666
04667 bool OSResult::setAnOtherVariableResultDense(int solIdx, int otherIdx, string name, string value, string description, string *s)
04668 {
04669 int numberOfVar = this->getVariableNumber();
04670 int iNumberOfVariables = numberOfVar;
04671 if(iNumberOfVariables <= -1) return false;
04672 int nSols = this->getSolutionNumber();
04673 if(optimization == NULL) return false;
04674 if(nSols <= 0) return false;
04675 if(optimization == NULL) return false;
04676 if(optimization->solution == NULL ||
04677 solIdx < 0 || solIdx >= nSols) return false;
04678 if(optimization->solution[solIdx] == NULL) return false;
04679 if(optimization->solution[solIdx]->variables == NULL)return false;
04680 if(optimization->solution[solIdx]->variables->other == NULL) return false;
04681 if(optimization->solution[solIdx]->variables->other[ otherIdx] == NULL) return false;
04682 optimization->solution[solIdx]->variables->other[ otherIdx]->name = name;
04683 optimization->solution[solIdx]->variables->other[ otherIdx]->value = value;
04684 optimization->solution[solIdx]->variables->other[ otherIdx]->description = description;
04685 optimization->solution[solIdx]->variables->other[ otherIdx]->numberOfVar = numberOfVar;
04686 if(optimization->solution[solIdx]->variables->other[ otherIdx]->var == NULL)
04687 optimization->solution[solIdx]->variables->other[ otherIdx]->var = new OtherVarResult*[numberOfVar];
04688 for(int i = 0; i < numberOfVar; i++)
04689 {
04690 optimization->solution[solIdx]->variables->other[ otherIdx]->var[i] = new OtherVarResult();
04691 optimization->solution[solIdx]->variables->other[ otherIdx]->var[i]->idx = i;
04692 optimization->solution[solIdx]->variables->other[ otherIdx]->var[i]->value = s[i];
04693 ;
04694 }
04695 return true;
04696 }
04697
04698 bool OSResult::setOtherVariableResultNumberOfVar(int solIdx, int otherIdx, int numberOfVar)
04699 {
04700 int iNumberOfVariables = numberOfVar;
04701 if (iNumberOfVariables <= -1) return false;
04702 int nSols = this->getSolutionNumber();
04703 if (nSols <= 0) return false;
04704 if (optimization == NULL) return false;
04705 if (optimization->solution == NULL ||
04706 solIdx < 0 || solIdx >= nSols) return false;
04707 if (optimization->solution[solIdx] == NULL) return false;
04708 if (optimization->solution[solIdx]->variables == NULL) return false;
04709 if (optimization->solution[solIdx]->variables->other == NULL) return false;
04710 if (optimization->solution[solIdx]->variables->other[ otherIdx] == NULL) return false;
04711 if (optimization->solution[solIdx]->variables->other[ otherIdx]->var == NULL)
04712 optimization->solution[solIdx]->variables->other[ otherIdx]->var = new OtherVarResult*[numberOfVar];
04713 for(int i = 0; i < numberOfVar; i++)
04714 optimization->solution[solIdx]->variables->other[ otherIdx]->var[i] = new OtherVarResult();
04715 optimization->solution[solIdx]->variables->other[ otherIdx]->numberOfVar = numberOfVar;
04716 return true;
04717 }
04718
04719
04720 bool OSResult::setOtherVariableResultNumberOfEnumerations(int solIdx, int otherIdx, int numberOfEnumerations)
04721 {
04722 int iNumberOfEnumerations = numberOfEnumerations;
04723 if (iNumberOfEnumerations <= -1) return false;
04724 int nSols = this->getSolutionNumber();
04725 if (nSols <= 0) return false;
04726 if (optimization == NULL) return false;
04727 if (optimization->solution == NULL ||
04728 solIdx < 0 || solIdx >= nSols) return false;
04729 if (optimization->solution[solIdx] == NULL) return false;
04730 if (optimization->solution[solIdx]->variables == NULL) return false;
04731 if (optimization->solution[solIdx]->variables->other == NULL) return false;
04732 if (optimization->solution[solIdx]->variables->other[ otherIdx] == NULL) return false;
04733 if (optimization->solution[solIdx]->variables->other[ otherIdx]->enumeration == NULL)
04734 optimization->solution[solIdx]->variables->other[ otherIdx]->enumeration = new OtherOptionEnumeration*[numberOfEnumerations];
04735 for(int i = 0; i < numberOfEnumerations; i++)
04736 optimization->solution[solIdx]->variables->other[ otherIdx]->enumeration[i] = new OtherOptionEnumeration();
04737 optimization->solution[solIdx]->variables->other[ otherIdx]->numberOfEnumerations = numberOfEnumerations;
04738 return true;
04739 }
04740
04741 bool OSResult::setOtherVariableResultName(int solIdx, int otherIdx, std::string name)
04742 {
04743 int numberOfVar = this->getVariableNumber();
04744 int iNumberOfVariables = numberOfVar;
04745 if (iNumberOfVariables <= -1) return false;
04746 int nSols = this->getSolutionNumber();
04747 if (optimization == NULL) return false;
04748 if (nSols <= 0) return false;
04749 if (optimization == NULL) return false;
04750 if (optimization->solution == NULL ||
04751 solIdx < 0 || solIdx >= nSols) return false;
04752 if (optimization->solution[solIdx] == NULL) return false;
04753 if (optimization->solution[solIdx]->variables == NULL)return false;
04754 if (optimization->solution[solIdx]->variables->other == NULL) return false;
04755 if (optimization->solution[solIdx]->variables->other[ otherIdx] == NULL) return false;
04756 optimization->solution[solIdx]->variables->other[ otherIdx]->name = name;
04757 return true;
04758 }
04759
04760 bool OSResult::setOtherVariableResultValue(int solIdx, int otherIdx, std::string value)
04761 {
04762 int numberOfVar = this->getVariableNumber();
04763 int iNumberOfVariables = numberOfVar;
04764 if (iNumberOfVariables <= -1) return false;
04765 int nSols = this->getSolutionNumber();
04766 if (optimization == NULL) return false;
04767 if (nSols <= 0) return false;
04768 if (optimization == NULL) return false;
04769 if (optimization->solution == NULL ||
04770 solIdx < 0 || solIdx >= nSols) return false;
04771 if (optimization->solution[solIdx] == NULL) return false;
04772 if (optimization->solution[solIdx]->variables == NULL)return false;
04773 if (optimization->solution[solIdx]->variables->other == NULL) return false;
04774 if (optimization->solution[solIdx]->variables->other[ otherIdx] == NULL) return false;
04775 optimization->solution[solIdx]->variables->other[ otherIdx]->value = value;
04776 return true;
04777 }
04778
04779 bool OSResult::setOtherVariableResultDescription(int solIdx, int otherIdx, std::string description)
04780 {
04781 int numberOfVar = this->getVariableNumber();
04782 int iNumberOfVariables = numberOfVar;
04783 if (iNumberOfVariables <= -1) return false;
04784 int nSols = this->getSolutionNumber();
04785 if (optimization == NULL) return false;
04786 if (nSols <= 0) return false;
04787 if (optimization == NULL) return false;
04788 if (optimization->solution == NULL ||
04789 solIdx < 0 || solIdx >= nSols) return false;
04790 if (optimization->solution[solIdx] == NULL) return false;
04791 if (optimization->solution[solIdx]->variables == NULL)return false;
04792 if (optimization->solution[solIdx]->variables->other == NULL) return false;
04793 if (optimization->solution[solIdx]->variables->other[ otherIdx] == NULL) return false;
04794 optimization->solution[solIdx]->variables->other[ otherIdx]->description = description;
04795 return true;
04796 }
04797
04798 bool OSResult::setOtherVariableResultVarIdx(int solIdx, int otherIdx, int varIdx, int idx)
04799 {
04800 int nSols = this->getSolutionNumber();
04801 if(nSols <= 0) return false;
04802 if(optimization == NULL) return false;
04803 if(optimization->solution == NULL ||
04804 solIdx < 0 || solIdx >= nSols) return false;
04805 if(optimization->solution[solIdx] == NULL) return false;
04806 if(optimization->solution[solIdx]->variables == NULL) return false;
04807 if(optimization->solution[solIdx]->variables->other[otherIdx] == NULL) return false;
04808 if(optimization->solution[solIdx]->variables->other[otherIdx]->var == NULL) return false;
04809 if (idx < 0) return false;
04810 optimization->solution[solIdx]->variables->other[otherIdx]->var[varIdx]->idx = idx;
04811 return true;
04812 }
04813
04814 bool OSResult::setOtherVariableResultVarName(int solIdx, int otherIdx, int varIdx, std::string name)
04815 {
04816 int nSols = this->getSolutionNumber();
04817 if(nSols <= 0) return false;
04818 if(optimization == NULL) return false;
04819 if(optimization->solution == NULL ||
04820 solIdx < 0 || solIdx >= nSols) return false;
04821 if(optimization->solution[solIdx] == NULL) return false;
04822 if(optimization->solution[solIdx]->variables == NULL) return false;
04823 if(optimization->solution[solIdx]->variables->other[otherIdx] == NULL) return false;
04824 if(optimization->solution[solIdx]->variables->other[otherIdx]->var == NULL) return false;
04825 optimization->solution[solIdx]->variables->other[otherIdx]->var[varIdx]->name = name;
04826 return true;
04827 }
04828
04829 bool OSResult::setOtherVariableResultVar(int solIdx, int otherIdx, int varIdx, std::string value)
04830 {
04831 int nSols = this->getSolutionNumber();
04832 if(nSols <= 0) return false;
04833 if(optimization == NULL) return false;
04834 if(optimization->solution == NULL ||
04835 solIdx < 0 || solIdx >= nSols) return false;
04836 if(optimization->solution[solIdx] == NULL) return false;
04837 if(optimization->solution[solIdx]->variables == NULL) return false;
04838 if(optimization->solution[solIdx]->variables->other[otherIdx] == NULL) return false;
04839 if(optimization->solution[solIdx]->variables->other[otherIdx]->var == NULL) return false;
04840 optimization->solution[solIdx]->variables->other[otherIdx]->var[varIdx]->value = value;
04841 return true;
04842 }
04843
04844 bool OSResult::setOtherOptionEnumeration(int solIdx, int otherIdx, int object, int enumIdx, std::string value, std::string description, int *i, int ni)
04845 {
04846 if (optimization == NULL || optimization->solution == NULL)
04847 return false;
04848 int nSols = optimization->numberOfSolutions;
04849 if (solIdx < 0 || solIdx >= nSols)
04850 return false;
04851 if (optimization->solution[solIdx] == NULL) return false;
04852
04853 switch (object)
04854 {
04855 case ENUM_PROBLEM_COMPONENT_variables:
04856 {
04857 if (optimization->solution[solIdx]->variables == NULL) return false;
04858 if (optimization->solution[solIdx]->variables->other == NULL) return false;
04859 int n_other = optimization->solution[solIdx]->variables->numberOfOtherVariableResults;
04860 if (otherIdx < 0 || otherIdx >= n_other) return false;
04861 if (optimization->solution[solIdx]->variables->other[ otherIdx] == NULL) return false;
04862 if (optimization->solution[solIdx]->variables->other[ otherIdx]->enumeration == NULL) return false;
04863 int n_enum = optimization->solution[solIdx]->variables->other[ otherIdx]->numberOfEnumerations;
04864 if (enumIdx < 0 || enumIdx >= n_enum) return false;
04865 if (optimization->solution[solIdx]->variables->other[ otherIdx]->enumeration[enumIdx] == NULL)
04866 optimization->solution[solIdx]->variables->other[ otherIdx]->enumeration[enumIdx] = new OtherOptionEnumeration();
04867 for (int j=0; j<ni; j++) if (i[j] < 0) return false;
04868 return optimization->solution[solIdx]->variables->other[ otherIdx]->enumeration[enumIdx]->setOtherOptionEnumeration(value, description, i, ni);
04869 }
04870 case ENUM_PROBLEM_COMPONENT_objectives:
04871 {
04872 if (optimization->solution[solIdx]->objectives == NULL) return false;
04873 if (optimization->solution[solIdx]->objectives->other == NULL) return false;
04874 if (optimization->solution[solIdx]->objectives->other[ otherIdx] == NULL) return false;
04875 if (optimization->solution[solIdx]->objectives->other[ otherIdx]->enumeration == NULL) return false;
04876 int n_enum = optimization->solution[solIdx]->objectives->other[ otherIdx]->numberOfEnumerations;
04877 if (enumIdx < 0 || enumIdx >= n_enum) return false;
04878 if (optimization->solution[solIdx]->objectives->other[ otherIdx]->enumeration[enumIdx] == NULL)
04879 optimization->solution[solIdx]->objectives->other[ otherIdx]->enumeration[enumIdx] = new OtherOptionEnumeration();
04880 for (int j=0; j<ni; j++) if (i[j] >= 0) return false;
04881 return optimization->solution[solIdx]->objectives->other[ otherIdx]->enumeration[enumIdx]->setOtherOptionEnumeration(value, description, i, ni);
04882 }
04883 case ENUM_PROBLEM_COMPONENT_constraints:
04884 {
04885 if (optimization->solution[solIdx]->constraints == NULL) return false;
04886 if (optimization->solution[solIdx]->constraints->other == NULL) return false;
04887 if (optimization->solution[solIdx]->constraints->other[ otherIdx] == NULL) return false;
04888 if (optimization->solution[solIdx]->constraints->other[ otherIdx]->enumeration == NULL) return false;
04889 int n_enum = optimization->solution[solIdx]->constraints->other[ otherIdx]->numberOfEnumerations;
04890 if (enumIdx < 0 || enumIdx >= n_enum) return false;
04891 if (optimization->solution[solIdx]->constraints->other[ otherIdx]->enumeration[enumIdx] == NULL)
04892 optimization->solution[solIdx]->constraints->other[ otherIdx]->enumeration[enumIdx] = new OtherOptionEnumeration();
04893 for (int j=0; j<ni; j++) if (i[j] < 0) return false;
04894 return optimization->solution[solIdx]->constraints->other[ otherIdx]->enumeration[enumIdx]->setOtherOptionEnumeration(value, description, i, ni);
04895 }
04896
04897 default:
04898 throw ErrorClass("target object not implemented in setOtherOptionEnumeration");
04899 }
04900 }
04901
04902
04903 bool OSResult::setNumberOfOtherObjectiveResults(int solIdx, int num)
04904 {
04905 int nSols = this->getSolutionNumber();
04906 if (nSols <= 0) return false;
04907 if (optimization == NULL) return false;
04908 if (optimization->solution == NULL ||
04909 solIdx < 0 || solIdx >= nSols) return false;
04910 if (optimization->solution[solIdx] == NULL)
04911 {
04912 optimization->solution[solIdx] = new OptimizationSolution();
04913 }
04914 if (optimization->solution[solIdx]->objectives == NULL)
04915 {
04916 optimization->solution[solIdx]->objectives = new ObjectiveSolution();
04917 }
04918 if (num < 0) return false;
04919 if (optimization->solution[solIdx]->objectives->other != NULL) return false;
04920 optimization->solution[solIdx]->objectives->numberOfOtherObjectiveResults = num;
04921 if (num > 0)
04922 {
04923 optimization->solution[solIdx]->objectives->other = new OtherObjectiveResult*[num];
04924 for(int i = 0; i < num; i++)
04925 {
04926 optimization->solution[solIdx]->objectives->other[ i] = new OtherObjectiveResult();
04927 }
04928 }
04929 return true;
04930 }
04931
04932 bool OSResult::setNumberOfObjValues(int solIdx, int numberOfObj)
04933 {
04934 if (optimization == NULL || optimization->solution == NULL)
04935 {
04936
04937 return false;
04938 }
04939 int nSols = optimization->numberOfSolutions;
04940 if (solIdx < 0 || solIdx >= nSols)
04941 {
04942
04943 return false;
04944 }
04945 if (optimization->solution[solIdx] == NULL)
04946 optimization->solution[solIdx] = new OptimizationSolution();
04947 if (optimization->solution[solIdx]->objectives == NULL)
04948 optimization->solution[solIdx]->objectives = new ObjectiveSolution();
04949 if (optimization->solution[solIdx]->objectives->values == NULL)
04950 optimization->solution[solIdx]->objectives->values = new ObjectiveValues();
04951 if (optimization->solution[solIdx]->objectives->values->numberOfObj > 0)
04952 return false;
04953 if (numberOfObj < 0) return false;
04954 if (optimization->solution[solIdx]->objectives->values->obj != NULL) return false;
04955 optimization->solution[solIdx]->objectives->values->numberOfObj = numberOfObj;
04956 if (numberOfObj > 0)
04957 {
04958 optimization->solution[solIdx]->objectives->values->obj = new ObjValue*[numberOfObj];
04959 for(int i = 0; i < numberOfObj; i++)
04960 optimization->solution[solIdx]->objectives->values->obj[i] = new ObjValue();
04961 }
04962 return true;
04963 }
04964
04965
04966 bool OSResult::setNumberOfObjectiveValues(int solIdx, int numberOfObj)
04967 {
04968 int nSols = this->getSolutionNumber();
04969 int nObj = this->getObjectiveNumber();
04970 if (numberOfObj <= 0 || numberOfObj > nObj) return false;
04971 if (optimization == NULL) return false;
04972 if (nSols <= 0) return false;
04973 if (optimization->solution == NULL ||
04974 solIdx < 0 || solIdx >= nSols) return false;
04975 if (optimization->solution[solIdx] == NULL)
04976 {
04977 optimization->solution[solIdx] = new OptimizationSolution();
04978 }
04979 if (optimization->solution[solIdx]->objectives == NULL)
04980 {
04981 optimization->solution[solIdx]->objectives = new ObjectiveSolution();
04982 }
04983 if (optimization->solution[solIdx]->objectives->values == NULL)
04984 {
04985 optimization->solution[solIdx]->objectives->values = new ObjectiveValues();
04986 }
04987 optimization->solution[solIdx]->objectives->values->numberOfObj = numberOfObj;
04988
04989
04990 return true;
04991 }
04992
04993
04994
04995 bool OSResult::setObjectiveValuesSparse(int solIdx, std::vector<IndexValuePair*> x)
04996 {
04997 int numberOfObj = x.size();
04998 int iNumberOfObjectives = numberOfObj;
04999 if(iNumberOfObjectives < 0) return false;
05000 if(iNumberOfObjectives == 0) return true;
05001 if(x.size() == 0) return false;
05002 int nSols = this->getSolutionNumber();
05003 if(optimization == NULL) return false;
05004 if(nSols <= 0) return false;
05005 if(optimization == NULL) return false;
05006 if(optimization->solution == NULL ||
05007 solIdx < 0 || solIdx >= nSols) return false;
05008 if(optimization->solution[solIdx] == NULL)
05009 {
05010 optimization->solution[solIdx] = new OptimizationSolution();
05011 }
05012 if(optimization->solution[solIdx]->objectives == NULL)
05013 {
05014 optimization->solution[solIdx]->objectives = new ObjectiveSolution();
05015 }
05016 if(optimization->solution[solIdx]->objectives->values == NULL)
05017 {
05018 optimization->solution[solIdx]->objectives->values = new ObjectiveValues();
05019 }
05020 if(optimization->solution[solIdx]->objectives->values->obj == NULL)
05021 {
05022 optimization->solution[solIdx]->objectives->values->obj = new ObjValue*[iNumberOfObjectives];
05023 }
05024 optimization->solution[solIdx]->objectives->values->numberOfObj = iNumberOfObjectives;
05025 for(int i = 0; i < iNumberOfObjectives; i++)
05026 {
05027 optimization->solution[solIdx]->objectives->values->obj[i] = new ObjValue();
05028 optimization->solution[solIdx]->objectives->values->obj[i]->idx = x[i]->idx;
05029 optimization->solution[solIdx]->objectives->values->obj[i]->value = x[i]->value;
05030 }
05031 return true;
05032 }
05033
05034
05035 bool OSResult::setObjectiveValuesDense(int solIdx, double *objectiveValues)
05036 {
05037 int numberOfObj = this->getObjectiveNumber();
05038 int iNumberOfObjectives = numberOfObj;
05039 if (iNumberOfObjectives < 0) return false;
05040 if (iNumberOfObjectives == 0) return true;
05041 if (objectiveValues == NULL) return false;
05042 int nSols = this->getSolutionNumber();
05043 if (optimization == NULL) return false;
05044 if (nSols <= 0) return false;
05045 if (optimization == NULL) return false;
05046 if (optimization->solution == NULL ||
05047 solIdx < 0 || solIdx >= nSols) return false;
05048 if (optimization->solution[solIdx] == NULL)
05049 {
05050 optimization->solution[solIdx] = new OptimizationSolution();
05051 }
05052 if (optimization->solution[solIdx]->objectives == NULL)
05053 {
05054 optimization->solution[solIdx]->objectives = new ObjectiveSolution();
05055 }
05056 if (optimization->solution[solIdx]->objectives->values == NULL)
05057 {
05058 optimization->solution[solIdx]->objectives->values = new ObjectiveValues();
05059 }
05060 if (optimization->solution[solIdx]->objectives->values->obj == NULL)
05061 {
05062 optimization->solution[solIdx]->objectives->values->obj = new ObjValue*[iNumberOfObjectives];
05063 }
05064
05065 optimization->solution[solIdx]->objectives->values->numberOfObj = iNumberOfObjectives;
05066 for(int i = 0; i < iNumberOfObjectives; i++)
05067 {
05068 optimization->solution[solIdx]->objectives->values->obj[i] = new ObjValue();
05069 optimization->solution[solIdx]->objectives->values->obj[i]->idx = -(i+1);
05070 optimization->solution[solIdx]->objectives->values->obj[i]->value = objectiveValues[i];
05071 }
05072
05073 return true;
05074 }
05075
05076
05077
05078 bool OSResult::setObjValue(int solIdx, int number, int idx, std::string name, double val)
05079 {
05080 if (optimization == NULL || optimization->solution == NULL)
05081 {
05082
05083 return false;
05084 }
05085 int nSols = optimization->numberOfSolutions;
05086 if (solIdx < 0 || solIdx >= nSols)
05087 {
05088
05089 return false;
05090 }
05091 if (optimization->solution[solIdx] == NULL)
05092 {
05093
05094 return false;
05095 }
05096 if (optimization->solution[solIdx]->objectives == NULL)
05097 {
05098
05099 return false;
05100 }
05101 if (optimization->solution[solIdx]->objectives->values == NULL)
05102 {
05103
05104 return false;
05105 }
05106 int nObj = optimization->solution[solIdx]->objectives->values->numberOfObj;
05107 if (number < 0 || number >= nObj)
05108 {
05109
05110 return false;
05111 }
05112 if (idx >= 0)
05113 {
05114
05115 return false;
05116 }
05117 optimization->solution[solIdx]->objectives->values->obj[number]->idx = idx;
05118 optimization->solution[solIdx]->objectives->values->obj[number]->name = name;
05119 optimization->solution[solIdx]->objectives->values->obj[number]->value = val;
05120 return true;
05121 }
05122
05123 bool OSResult::setOtherObjectiveResultNumberOfObj(int solIdx, int otherIdx, int numberOfObj)
05124 {
05125 int iNumberOfObjectives = numberOfObj;
05126 if (iNumberOfObjectives <= -1) return false;
05127 int nSols = this->getSolutionNumber();
05128 if (optimization == NULL) return false;
05129 if (nSols <= 0) return false;
05130 if (optimization == NULL) return false;
05131 if (optimization->solution == NULL ||
05132 solIdx < 0 || solIdx >= nSols) return false;
05133 if (optimization->solution[solIdx] == NULL) return false;
05134 if (optimization->solution[solIdx]->objectives == NULL)return false;
05135 if (optimization->solution[solIdx]->objectives->other == NULL) return false;
05136 if (optimization->solution[solIdx]->objectives->other[ otherIdx] == NULL) return false;
05137 if (optimization->solution[solIdx]->objectives->other[ otherIdx]->obj == NULL)
05138 optimization->solution[solIdx]->objectives->other[ otherIdx]->obj = new OtherObjResult*[numberOfObj];
05139 for(int i = 0; i < numberOfObj; i++)
05140 {
05141 optimization->solution[solIdx]->objectives->other[ otherIdx]->obj[i] = new OtherObjResult();
05142 }
05143 optimization->solution[solIdx]->objectives->other[ otherIdx]->numberOfObj = numberOfObj;
05144 return true;
05145 }
05146
05147
05148 bool OSResult::setOtherObjectiveResultNumberOfEnumerations(int solIdx, int otherIdx, int numberOfEnumerations)
05149 {
05150 int iNumberOfEnumerations = numberOfEnumerations;
05151 if (iNumberOfEnumerations <= -1) return false;
05152 int nSols = this->getSolutionNumber();
05153 if (nSols <= 0) return false;
05154 if (optimization == NULL) return false;
05155 if (optimization->solution == NULL ||
05156 solIdx < 0 || solIdx >= nSols) return false;
05157 if (optimization->solution[solIdx] == NULL) return false;
05158 if (optimization->solution[solIdx]->objectives == NULL) return false;
05159 if (optimization->solution[solIdx]->objectives->other == NULL) return false;
05160 if (optimization->solution[solIdx]->objectives->other[ otherIdx] == NULL) return false;
05161 if (optimization->solution[solIdx]->objectives->other[ otherIdx]->enumeration == NULL)
05162 optimization->solution[solIdx]->objectives->other[ otherIdx]->enumeration = new OtherOptionEnumeration*[numberOfEnumerations];
05163 for(int i = 0; i < numberOfEnumerations; i++)
05164 optimization->solution[solIdx]->objectives->other[ otherIdx]->enumeration[i] = new OtherOptionEnumeration();
05165 optimization->solution[solIdx]->objectives->other[ otherIdx]->numberOfEnumerations = numberOfEnumerations;
05166 return true;
05167 }
05168
05169 bool OSResult::setOtherObjectiveResultName(int solIdx, int otherIdx, std::string name)
05170 {
05171 int numberOfObj = this->getObjectiveNumber();
05172 int iNumberOfObjectives = numberOfObj;
05173 if (iNumberOfObjectives <= -1) return false;
05174 int nSols = this->getSolutionNumber();
05175 if (optimization == NULL) return false;
05176 if (nSols <= 0) return false;
05177 if (optimization == NULL) return false;
05178 if (optimization->solution == NULL ||
05179 solIdx < 0 || solIdx >= nSols) return false;
05180 if (optimization->solution[solIdx] == NULL) return false;
05181 if (optimization->solution[solIdx]->objectives == NULL)return false;
05182 if (optimization->solution[solIdx]->objectives->other == NULL) return false;
05183 if (optimization->solution[solIdx]->objectives->other[ otherIdx] == NULL) return false;
05184 optimization->solution[solIdx]->objectives->other[ otherIdx]->name = name;
05185 return true;
05186 }
05187
05188 bool OSResult::setOtherObjectiveResultValue(int solIdx, int otherIdx, std::string value)
05189 {
05190 int numberOfObj = this->getObjectiveNumber();
05191 int iNumberOfObjectives = numberOfObj;
05192 if (iNumberOfObjectives <= -1) return false;
05193 int nSols = this->getSolutionNumber();
05194 if (optimization == NULL) return false;
05195 if (nSols <= 0) return false;
05196 if (optimization == NULL) return false;
05197 if (optimization->solution == NULL ||
05198 solIdx < 0 || solIdx >= nSols) return false;
05199 if (optimization->solution[solIdx] == NULL) return false;
05200 if (optimization->solution[solIdx]->objectives == NULL)return false;
05201 if (optimization->solution[solIdx]->objectives->other == NULL) return false;
05202 if (optimization->solution[solIdx]->objectives->other[ otherIdx] == NULL) return false;
05203 optimization->solution[solIdx]->objectives->other[ otherIdx]->value = value;
05204 return true;
05205 }
05206
05207 bool OSResult::setOtherObjectiveResultDescription(int solIdx, int otherIdx, std::string description)
05208 {
05209 int numberOfObj = this->getObjectiveNumber();
05210 int iNumberOfObjectives = numberOfObj;
05211 if (iNumberOfObjectives <= -1) return false;
05212 int nSols = this->getSolutionNumber();
05213 if (optimization == NULL) return false;
05214 if (nSols <= 0) return false;
05215 if (optimization == NULL) return false;
05216 if (optimization->solution == NULL ||
05217 solIdx < 0 || solIdx >= nSols) return false;
05218 if (optimization->solution[solIdx] == NULL) return false;
05219 if (optimization->solution[solIdx]->objectives == NULL)return false;
05220 if (optimization->solution[solIdx]->objectives->other == NULL) return false;
05221 if (optimization->solution[solIdx]->objectives->other[ otherIdx] == NULL) return false;
05222 optimization->solution[solIdx]->objectives->other[ otherIdx]->description = description;
05223 return true;
05224 }
05225
05226 bool OSResult::setOtherObjectiveResultObjIdx(int solIdx, int otherIdx, int objIdx, int idx)
05227 {
05228 int nSols = this->getSolutionNumber();
05229 if (nSols <= 0) return false;
05230 if (optimization == NULL) return false;
05231 if (optimization->solution == NULL ||
05232 solIdx < 0 || solIdx >= nSols) return false;
05233 if (optimization->solution[solIdx] == NULL) return false;
05234 if (optimization->solution[solIdx]->objectives == NULL) return false;
05235 if (optimization->solution[solIdx]->objectives->other[otherIdx] == NULL) return false;
05236 if (optimization->solution[solIdx]->objectives->other[otherIdx]->obj == NULL) return false;
05237 if (idx >= 0) return false;
05238 optimization->solution[solIdx]->objectives->other[otherIdx]->obj[objIdx]->idx = idx;
05239 return true;
05240 }
05241
05242 bool OSResult::setOtherObjectiveResultObjName(int solIdx, int otherIdx, int objIdx, std::string name)
05243 {
05244 int nSols = this->getSolutionNumber();
05245 if (nSols <= 0) return false;
05246 if (optimization == NULL) return false;
05247 if (optimization->solution == NULL ||
05248 solIdx < 0 || solIdx >= nSols) return false;
05249 if (optimization->solution[solIdx] == NULL) return false;
05250 if (optimization->solution[solIdx]->objectives == NULL) return false;
05251 if (optimization->solution[solIdx]->objectives->other[otherIdx] == NULL) return false;
05252 if (optimization->solution[solIdx]->objectives->other[otherIdx]->obj == NULL) return false;
05253 optimization->solution[solIdx]->objectives->other[otherIdx]->obj[objIdx]->name = name;
05254 return true;
05255 }
05256
05257 bool OSResult::setOtherObjectiveResultObj(int solIdx, int otherIdx, int objIdx, std::string value)
05258 {
05259 int nSols = this->getSolutionNumber();
05260 if (nSols <= 0) return false;
05261 if (optimization == NULL) return false;
05262 if (optimization->solution == NULL ||
05263 solIdx < 0 || solIdx >= nSols) return false;
05264 if (optimization->solution[solIdx] == NULL) return false;
05265 if (optimization->solution[solIdx]->objectives == NULL) return false;
05266 if (optimization->solution[solIdx]->objectives->other[otherIdx] == NULL) return false;
05267 if (optimization->solution[solIdx]->objectives->other[otherIdx]->obj == NULL) return false;
05268 optimization->solution[solIdx]->objectives->other[otherIdx]->obj[objIdx]->value = value;
05269 return true;
05270 }
05271
05272 bool OSResult::setNumberOfOtherConstraintResults(int solIdx, int num)
05273 {
05274 int nSols = this->getSolutionNumber();
05275 if (nSols <= 0) return false;
05276 if (optimization == NULL) return false;
05277 if (optimization->solution == NULL ||
05278 solIdx < 0 || solIdx >= nSols) return false;
05279 if (optimization->solution[solIdx] == NULL)
05280 {
05281 optimization->solution[solIdx] = new OptimizationSolution();
05282 }
05283 if (optimization->solution[solIdx]->constraints == NULL)
05284 {
05285 optimization->solution[solIdx]->constraints = new ConstraintSolution();
05286 }
05287 if (num < 0) return false;
05288 if (optimization->solution[solIdx]->constraints->other != NULL) return false;
05289 optimization->solution[solIdx]->constraints->numberOfOtherConstraintResults = num;
05290 if (num > 0)
05291 {
05292 optimization->solution[solIdx]->constraints->other = new OtherConstraintResult*[num];
05293 for(int i = 0; i < num; i++)
05294 {
05295 optimization->solution[solIdx]->constraints->other[ i] = new OtherConstraintResult();
05296 }
05297 }
05298 return true;
05299 }
05300
05301 bool OSResult::setNumberOfDualValues(int solIdx, int numberOfCon)
05302 {
05303 if (optimization == NULL || optimization->solution == NULL)
05304 {
05305
05306 return false;
05307 }
05308 int nSols = optimization->numberOfSolutions;
05309 if (solIdx < 0 || solIdx >= nSols)
05310 {
05311
05312 return false;
05313 }
05314 if (optimization->solution[solIdx] == NULL)
05315 optimization->solution[solIdx] = new OptimizationSolution();
05316 if (optimization->solution[solIdx]->constraints == NULL)
05317 optimization->solution[solIdx]->constraints = new ConstraintSolution();
05318 if (optimization->solution[solIdx]->constraints->dualValues == NULL)
05319 optimization->solution[solIdx]->constraints->dualValues = new DualVariableValues();
05320 if (optimization->solution[solIdx]->constraints->dualValues->numberOfCon > 0)
05321 return false;
05322 if (numberOfCon < 0) return false;
05323 if (optimization->solution[solIdx]->constraints->dualValues->con != NULL) return false;
05324 optimization->solution[solIdx]->constraints->dualValues->numberOfCon = numberOfCon;
05325 if (numberOfCon > 0)
05326 {
05327 optimization->solution[solIdx]->constraints->dualValues->con = new DualVarValue*[numberOfCon];
05328 for(int i = 0; i < numberOfCon; i++)
05329 optimization->solution[solIdx]->constraints->dualValues->con[i] = new DualVarValue();
05330 }
05331 return true;
05332 }
05333
05334
05335 bool OSResult::setNumberOfDualVariableValues(int solIdx, int numberOfCon)
05336 {
05337 int nSols = this->getSolutionNumber();
05338 int nCon = this->getConstraintNumber();
05339 if (numberOfCon <= 0 || numberOfCon > nCon) return false;
05340 if (optimization == NULL) return false;
05341 if (nSols <= 0) return false;
05342 if (optimization->solution == NULL ||
05343 solIdx < 0 || solIdx >= nSols) return false;
05344 if (optimization->solution[solIdx] == NULL)
05345 {
05346 optimization->solution[solIdx] = new OptimizationSolution();
05347 }
05348 if (optimization->solution[solIdx]->constraints == NULL)
05349 {
05350 optimization->solution[solIdx]->constraints = new ConstraintSolution();
05351 }
05352 if (optimization->solution[solIdx]->constraints->dualValues == NULL)
05353 {
05354 optimization->solution[solIdx]->constraints->dualValues = new DualVariableValues();
05355 }
05356 optimization->solution[solIdx]->constraints->dualValues->numberOfCon = numberOfCon;
05357
05358
05359 return true;
05360 }
05361
05362
05363
05364 bool OSResult::setDualVariableValuesSparse(int solIdx, std::vector<IndexValuePair*> x)
05365 {
05366 int numberOfCon = x.size();
05367 int iNumberOfConstraints = numberOfCon;
05368 if(iNumberOfConstraints < 0) return false;
05369 if(iNumberOfConstraints == 0) return true;
05370 int nSols = this->getSolutionNumber();
05371 if(optimization == NULL) return false;
05372 if(nSols <= 0) return false;
05373 if(optimization == NULL) return false;
05374 if(optimization->solution == NULL ||
05375 solIdx < 0 || solIdx >= nSols) return false;
05376 if(optimization->solution[solIdx] == NULL)
05377 {
05378 optimization->solution[solIdx] = new OptimizationSolution();
05379 }
05380 if(optimization->solution[solIdx]->constraints == NULL)
05381 {
05382 optimization->solution[solIdx]->constraints = new ConstraintSolution();
05383 }
05384 if(optimization->solution[solIdx]->constraints->dualValues == NULL)
05385 {
05386 optimization->solution[solIdx]->constraints->dualValues = new DualVariableValues();
05387 }
05388 if(optimization->solution[solIdx]->constraints->dualValues->con == NULL)
05389 {
05390 optimization->solution[solIdx]->constraints->dualValues->con = new DualVarValue*[numberOfCon];
05391 }
05392 if(x.size() == 0)
05393 {
05394 optimization->solution[solIdx]->constraints->dualValues = NULL;
05395 return true;
05396 }
05397 optimization->solution[solIdx]->constraints->dualValues->numberOfCon = numberOfCon;
05398 for(int i = 0; i < iNumberOfConstraints; i++)
05399 {
05400 optimization->solution[solIdx]->constraints->dualValues->con[i] = new DualVarValue();
05401 optimization->solution[solIdx]->constraints->dualValues->con[i]->idx = x[i]->idx;
05402 optimization->solution[solIdx]->constraints->dualValues->con[i]->value = x[i]->value;
05403 }
05404 return true;
05405 }
05406
05407 bool OSResult::setDualVariableValuesDense(int solIdx, double *y)
05408 {
05409 int numberOfCon = this->getConstraintNumber();
05410 int iNumberOfConstraints = numberOfCon;
05411 if (iNumberOfConstraints < 0) return false;
05412 if (iNumberOfConstraints == 0) return true;
05413 int nSols = this->getSolutionNumber();
05414 if (optimization == NULL) return false;
05415 if (nSols <= 0) return false;
05416 if (optimization == NULL) return false;
05417 if (optimization->solution == NULL ||
05418 solIdx < 0 || solIdx >= nSols) return false;
05419 if (optimization->solution[solIdx] == NULL)
05420 {
05421 optimization->solution[solIdx] = new OptimizationSolution();
05422 }
05423 if (optimization->solution[solIdx]->constraints == NULL)
05424 {
05425 optimization->solution[solIdx]->constraints = new ConstraintSolution();
05426 }
05427 if (optimization->solution[solIdx]->constraints->dualValues == NULL)
05428 {
05429 optimization->solution[solIdx]->constraints->dualValues = new DualVariableValues();
05430 }
05431 if (optimization->solution[solIdx]->constraints->dualValues->con == NULL)
05432 {
05433 optimization->solution[solIdx]->constraints->dualValues->con = new DualVarValue*[numberOfCon];
05434 }
05435 if (y == NULL)
05436 {
05437 optimization->solution[solIdx]->constraints->dualValues = NULL;
05438 return true;
05439 }
05440 optimization->solution[solIdx]->constraints->dualValues->numberOfCon = numberOfCon;
05441 for(int i = 0; i < iNumberOfConstraints; i++)
05442 {
05443 optimization->solution[solIdx]->constraints->dualValues->con[i] = new DualVarValue();
05444 optimization->solution[solIdx]->constraints->dualValues->con[i]->idx = i;
05445 optimization->solution[solIdx]->constraints->dualValues->con[i]->value = y[i];
05446 }
05447 return true;
05448 }
05449
05450 bool OSResult::setConstraintValuesDense(int solIdx, double *dualVarValues)
05451 {
05452 int numberOfCon = this->getConstraintNumber();
05453 int iNumberOfConstraints = numberOfCon;
05454 if (iNumberOfConstraints <= 0) return false;
05455 int nSols = this->getSolutionNumber();
05456 if (optimization == NULL) return false;
05457 if (nSols <= 0) return false;
05458 if (optimization == NULL) return false;
05459 if (optimization->solution == NULL ||
05460 solIdx < 0 || solIdx >= nSols) return false;
05461 if (optimization->solution[solIdx] == NULL)
05462 {
05463 optimization->solution[solIdx] = new OptimizationSolution();
05464 }
05465 if (optimization->solution[solIdx]->constraints == NULL)
05466 {
05467 optimization->solution[solIdx]->constraints = new ConstraintSolution();
05468 }
05469 if (optimization->solution[solIdx]->constraints->dualValues == NULL)
05470 {
05471 optimization->solution[solIdx]->constraints->dualValues = new DualVariableValues();
05472 }
05473 if (optimization->solution[solIdx]->constraints->dualValues->con == NULL)
05474 {
05475 optimization->solution[solIdx]->constraints->dualValues->con = new DualVarValue*[numberOfCon];
05476 }
05477 if (dualVarValues == NULL)
05478 {
05479 optimization->solution[solIdx]->constraints->dualValues = NULL;
05480 return true;
05481 }
05482
05483 optimization->solution[solIdx]->constraints->dualValues->numberOfCon = numberOfCon;
05484 for(int i = 0; i < iNumberOfConstraints; i++)
05485 {
05486 optimization->solution[solIdx]->constraints->dualValues->con[i] = new DualVarValue();
05487
05488 optimization->solution[solIdx]->constraints->dualValues->con[i]->idx = i;
05489 optimization->solution[solIdx]->constraints->dualValues->con[i]->value = dualVarValues[i];
05490 }
05491 return true;
05492 }
05493
05494 bool OSResult::setDualValue(int solIdx, int number, int idx, std::string name, double val)
05495 {
05496 if (optimization == NULL || optimization->solution == NULL)
05497 {
05498
05499 return false;
05500 }
05501 int nSols = optimization->numberOfSolutions;
05502 if (solIdx < 0 || solIdx >= nSols)
05503 {
05504
05505 return false;
05506 }
05507 if (optimization->solution[solIdx] == NULL)
05508 {
05509
05510 return false;
05511 }
05512 if (optimization->solution[solIdx]->constraints == NULL)
05513 {
05514
05515 return false;
05516 }
05517 if (optimization->solution[solIdx]->constraints->dualValues == NULL)
05518 {
05519
05520 return false;
05521 }
05522 int nCon = optimization->solution[solIdx]->constraints->dualValues->numberOfCon;
05523 if (number < 0 || number >= nCon)
05524 {
05525
05526 return false;
05527 }
05528 if (idx < 0)
05529 {
05530
05531 return false;
05532 }
05533 optimization->solution[solIdx]->constraints->dualValues->con[number]->idx = idx;
05534 optimization->solution[solIdx]->constraints->dualValues->con[number]->name = name;
05535 optimization->solution[solIdx]->constraints->dualValues->con[number]->value = val;
05536 return true;
05537 }
05538
05539 bool OSResult::setOtherConstraintResultNumberOfCon(int solIdx, int otherIdx, int numberOfCon)
05540 {
05541 int iNumberOfConstraints = numberOfCon;
05542 if (iNumberOfConstraints <= -1) return false;
05543 int nSols = this->getSolutionNumber();
05544 if (optimization == NULL) return false;
05545 if (nSols <= 0) return false;
05546 if (optimization == NULL) return false;
05547 if (optimization->solution == NULL ||
05548 solIdx < 0 || solIdx >= nSols) return false;
05549 if (optimization->solution[solIdx] == NULL) return false;
05550 if (optimization->solution[solIdx]->constraints == NULL)return false;
05551 if (optimization->solution[solIdx]->constraints->other == NULL) return false;
05552 if (optimization->solution[solIdx]->constraints->other[ otherIdx] == NULL) return false;
05553 if (optimization->solution[solIdx]->constraints->other[ otherIdx]->con == NULL)
05554 optimization->solution[solIdx]->constraints->other[ otherIdx]->con = new OtherConResult*[numberOfCon];
05555 for(int i = 0; i < numberOfCon; i++)
05556 optimization->solution[solIdx]->constraints->other[ otherIdx]->con[i] = new OtherConResult();
05557 optimization->solution[solIdx]->constraints->other[ otherIdx]->numberOfCon = numberOfCon;
05558 return true;
05559 }
05560
05561
05562 bool OSResult::setOtherConstraintResultNumberOfEnumerations(int solIdx, int otherIdx, int numberOfEnumerations)
05563 {
05564 int iNumberOfEnumerations = numberOfEnumerations;
05565 if (iNumberOfEnumerations <= -1) return false;
05566 int nSols = this->getSolutionNumber();
05567 if (nSols <= 0) return false;
05568 if (optimization == NULL) return false;
05569 if (optimization->solution == NULL ||
05570 solIdx < 0 || solIdx >= nSols) return false;
05571 if (optimization->solution[solIdx] == NULL) return false;
05572 if (optimization->solution[solIdx]->constraints == NULL) return false;
05573 if (optimization->solution[solIdx]->constraints->other == NULL) return false;
05574 if (optimization->solution[solIdx]->constraints->other[ otherIdx] == NULL) return false;
05575 if (optimization->solution[solIdx]->constraints->other[ otherIdx]->enumeration == NULL)
05576 optimization->solution[solIdx]->constraints->other[ otherIdx]->enumeration = new OtherOptionEnumeration*[numberOfEnumerations];
05577 for(int i = 0; i < numberOfEnumerations; i++)
05578 optimization->solution[solIdx]->constraints->other[ otherIdx]->enumeration[i] = new OtherOptionEnumeration();
05579 optimization->solution[solIdx]->constraints->other[ otherIdx]->numberOfEnumerations = numberOfEnumerations;
05580 return true;
05581 }
05582
05583 bool OSResult::setOtherConstraintResultName(int solIdx, int otherIdx, std::string name)
05584 {
05585 int numberOfCon = this->getConstraintNumber();
05586 int iNumberOfConstraints = numberOfCon;
05587 if (iNumberOfConstraints <= -1) return false;
05588 int nSols = this->getSolutionNumber();
05589 if (optimization == NULL) return false;
05590 if (nSols <= 0) return false;
05591 if (optimization == NULL) return false;
05592 if (optimization->solution == NULL ||
05593 solIdx < 0 || solIdx >= nSols) return false;
05594 if (optimization->solution[solIdx] == NULL) return false;
05595 if (optimization->solution[solIdx]->constraints == NULL)return false;
05596 if (optimization->solution[solIdx]->constraints->other == NULL) return false;
05597 if (optimization->solution[solIdx]->constraints->other[ otherIdx] == NULL) return false;
05598 optimization->solution[solIdx]->constraints->other[ otherIdx]->name = name;
05599 return true;
05600 }
05601
05602 bool OSResult::setOtherConstraintResultValue(int solIdx, int otherIdx, std::string value)
05603 {
05604 int numberOfCon = this->getConstraintNumber();
05605 int iNumberOfConstraints = numberOfCon;
05606 if (iNumberOfConstraints <= -1) return false;
05607 int nSols = this->getSolutionNumber();
05608 if (optimization == NULL) return false;
05609 if (nSols <= 0) return false;
05610 if (optimization == NULL) return false;
05611 if (optimization->solution == NULL ||
05612 solIdx < 0 || solIdx >= nSols) return false;
05613 if (optimization->solution[solIdx] == NULL) return false;
05614 if (optimization->solution[solIdx]->constraints == NULL)return false;
05615 if (optimization->solution[solIdx]->constraints->other == NULL) return false;
05616 if (optimization->solution[solIdx]->constraints->other[ otherIdx] == NULL) return false;
05617 optimization->solution[solIdx]->constraints->other[ otherIdx]->value = value;
05618 return true;
05619 }
05620
05621 bool OSResult::setOtherConstraintResultDescription(int solIdx, int otherIdx, std::string description)
05622 {
05623 int numberOfCon = this->getConstraintNumber();
05624 int iNumberOfConstraints = numberOfCon;
05625 if (iNumberOfConstraints <= -1) return false;
05626 int nSols = this->getSolutionNumber();
05627 if (optimization == NULL) return false;
05628 if (nSols <= 0) return false;
05629 if (optimization == NULL) return false;
05630 if (optimization->solution == NULL ||
05631 solIdx < 0 || solIdx >= nSols) return false;
05632 if (optimization->solution[solIdx] == NULL) return false;
05633 if (optimization->solution[solIdx]->constraints == NULL)return false;
05634 if (optimization->solution[solIdx]->constraints->other == NULL) return false;
05635 if (optimization->solution[solIdx]->constraints->other[ otherIdx] == NULL) return false;
05636 optimization->solution[solIdx]->constraints->other[ otherIdx]->description = description;
05637 return true;
05638 }
05639
05640 bool OSResult::setOtherConstraintResultConIdx(int solIdx, int otherIdx, int conIdx, int idx)
05641 {
05642 int nSols = this->getSolutionNumber();
05643 if (nSols <= 0) return false;
05644 if (optimization == NULL) return false;
05645 if (optimization->solution == NULL ||
05646 solIdx < 0 || solIdx >= nSols) return false;
05647 if (optimization->solution[solIdx] == NULL) return false;
05648 if (optimization->solution[solIdx]->constraints == NULL) return false;
05649 if (optimization->solution[solIdx]->constraints->other[otherIdx] == NULL) return false;
05650 if (optimization->solution[solIdx]->constraints->other[otherIdx]->con == NULL) return false;
05651 if (idx < 0) return false;
05652 optimization->solution[solIdx]->constraints->other[otherIdx]->con[conIdx]->idx = idx;
05653 return true;
05654 }
05655
05656 bool OSResult::setOtherConstraintResultConName(int solIdx, int otherIdx, int conIdx, std::string name)
05657 {
05658 int nSols = this->getSolutionNumber();
05659 if (nSols <= 0) return false;
05660 if (optimization == NULL) return false;
05661 if (optimization->solution == NULL ||
05662 solIdx < 0 || solIdx >= nSols) return false;
05663 if (optimization->solution[solIdx] == NULL) return false;
05664 if (optimization->solution[solIdx]->constraints == NULL) return false;
05665 if (optimization->solution[solIdx]->constraints->other[otherIdx] == NULL) return false;
05666 if (optimization->solution[solIdx]->constraints->other[otherIdx]->con == NULL) return false;
05667 optimization->solution[solIdx]->constraints->other[otherIdx]->con[conIdx]->name = name;
05668 return true;
05669 }
05670
05671 bool OSResult::setOtherConstraintResultCon(int solIdx, int otherIdx, int conIdx, std::string value)
05672 {
05673 int nSols = this->getSolutionNumber();
05674 if (nSols <= 0) return false;
05675 if (optimization == NULL) return false;
05676 if (optimization->solution == NULL ||
05677 solIdx < 0 || solIdx >= nSols) return false;
05678 if (optimization->solution[solIdx] == NULL) return false;
05679 if (optimization->solution[solIdx]->constraints == NULL) return false;
05680 if (optimization->solution[solIdx]->constraints->other[otherIdx] == NULL) return false;
05681 if (optimization->solution[solIdx]->constraints->other[otherIdx]->con == NULL) return false;
05682 optimization->solution[solIdx]->constraints->other[otherIdx]->con[conIdx]->value = value;
05683 return true;
05684 }
05685
05686 bool OSResult::setNumberOfOtherSolutionResults(int solIdx, int num)
05687 {
05688 int nSols = this->getSolutionNumber();
05689 if (nSols <= 0) return false;
05690 if (optimization == NULL) return false;
05691 if (optimization->solution == NULL ||
05692 solIdx < 0 || solIdx >= nSols) return false;
05693 if (optimization->solution[solIdx] == NULL)
05694 {
05695 optimization->solution[solIdx] = new OptimizationSolution();
05696 }
05697 if (optimization->solution[solIdx]->otherSolutionResults == NULL)
05698 {
05699 optimization->solution[solIdx]->otherSolutionResults = new OtherSolutionResults();
05700 }
05701 if (num < 0) return false;
05702 if (optimization->solution[solIdx]->otherSolutionResults->otherSolutionResult != NULL) return false;
05703 optimization->solution[solIdx]->otherSolutionResults->numberOfOtherSolutionResults = num;
05704 if (num > 0)
05705 {
05706 optimization->solution[solIdx]->otherSolutionResults->otherSolutionResult = new OtherSolutionResult*[num];
05707 for(int i = 0; i < num; i++)
05708 {
05709 optimization->solution[solIdx]->otherSolutionResults->otherSolutionResult[i] = new OtherSolutionResult();
05710 }
05711 }
05712 return true;
05713 }
05714
05715 bool OSResult::setOtherSolutionResultName(int solIdx, int otherIdx, std::string name)
05716 {
05717 int nSols = this->getSolutionNumber();
05718 if (nSols <= 0) return false;
05719 if (optimization == NULL) return false;
05720 if (optimization->solution == NULL ||
05721 solIdx < 0 || solIdx >= nSols) return false;
05722 if (optimization->solution[solIdx] == NULL) return false;
05723 if (optimization->solution[solIdx]->otherSolutionResults == NULL) return false;
05724 if (optimization->solution[solIdx]->otherSolutionResults->otherSolutionResult[otherIdx] == NULL) return false;
05725 optimization->solution[solIdx]->otherSolutionResults->otherSolutionResult[otherIdx]->name = name;
05726 return true;
05727 }
05728
05729 bool OSResult::setOtherSolutionResultCategory(int solIdx, int otherIdx, std::string category)
05730 {
05731 int nSols = this->getSolutionNumber();
05732 if (nSols <= 0) return false;
05733 if (optimization == NULL) return false;
05734 if (optimization->solution == NULL ||
05735 solIdx < 0 || solIdx >= nSols) return false;
05736 if (optimization->solution[solIdx] == NULL) return false;
05737 if (optimization->solution[solIdx]->otherSolutionResults == NULL) return false;
05738 if (optimization->solution[solIdx]->otherSolutionResults->otherSolutionResult[otherIdx] == NULL) return false;
05739 optimization->solution[solIdx]->otherSolutionResults->otherSolutionResult[otherIdx]->category = category;
05740 return true;
05741 }
05742
05743
05744 bool OSResult::setOtherSolutionResultDescription(int solIdx, int otherIdx, std::string description)
05745 {
05746 int nSols = this->getSolutionNumber();
05747 if (nSols <= 0) return false;
05748 if (optimization == NULL) return false;
05749 if (optimization->solution == NULL ||
05750 solIdx < 0 || solIdx >= nSols) return false;
05751 if (optimization->solution[solIdx] == NULL) return false;
05752 if (optimization->solution[solIdx]->otherSolutionResults == NULL) return false;
05753 if (optimization->solution[solIdx]->otherSolutionResults->otherSolutionResult[otherIdx] == NULL) return false;
05754 optimization->solution[solIdx]->otherSolutionResults->otherSolutionResult[otherIdx]->description = description;
05755 return true;
05756 }
05757
05758
05759 bool OSResult::setOtherSolutionResultNumberOfItems(int solIdx, int otherIdx, int numberOfItems)
05760 {
05761 int nSols = this->getSolutionNumber();
05762 if (nSols <= 0) return false;
05763 if (optimization == NULL) return false;
05764 if (optimization->solution == NULL ||
05765 solIdx < 0 || solIdx >= nSols) return false;
05766 if (optimization->solution[solIdx] == NULL) return false;
05767 if (optimization->solution[solIdx]->otherSolutionResults == NULL) return false;
05768 if (optimization->solution[solIdx]->otherSolutionResults->otherSolutionResult[otherIdx] == NULL)
05769 optimization->solution[solIdx]->otherSolutionResults->otherSolutionResult[otherIdx] = new OtherSolutionResult();
05770 if (numberOfItems < 0) return false;
05771 if (optimization->solution[solIdx]->otherSolutionResults->otherSolutionResult[otherIdx]->item != NULL) return false;
05772 optimization->solution[solIdx]->otherSolutionResults->otherSolutionResult[otherIdx]->numberOfItems = numberOfItems;
05773 if (numberOfItems > 0)
05774 optimization->solution[solIdx]->otherSolutionResults->otherSolutionResult[otherIdx]->item = new std::string[numberOfItems];
05775 return true;
05776 }
05777
05778 bool OSResult::setOtherSolutionResultItem(int solIdx, int otherIdx, int itemIdx, std::string item)
05779 {
05780 int nSols = this->getSolutionNumber();
05781 if (nSols <= 0) return false;
05782 if (optimization == NULL) return false;
05783 if (optimization->solution == NULL ||
05784 solIdx < 0 || solIdx >= nSols) return false;
05785 if (optimization->solution[solIdx] == NULL) return false;
05786 if (optimization->solution[solIdx]->otherSolutionResults == NULL) return false;
05787 if (optimization->solution[solIdx]->otherSolutionResults->otherSolutionResult[otherIdx] == NULL) return false;
05788 if (optimization->solution[solIdx]->otherSolutionResults->otherSolutionResult[otherIdx]->item == NULL) return false;
05789 optimization->solution[solIdx]->otherSolutionResults->otherSolutionResult[otherIdx]->item[itemIdx] = item;
05790 return true;
05791 }
05792
05793 bool OSResult::setNumberOfSolverOutputs(int num)
05794 {
05795 if (optimization == NULL) return false;
05796 if (optimization->otherSolverOutput == NULL)
05797 {
05798 optimization->otherSolverOutput = new OtherSolverOutput();
05799 }
05800 if (num < 0) return false;
05801 if (optimization->otherSolverOutput->solverOutput != NULL) return false;
05802 optimization->otherSolverOutput->numberOfSolverOutputs = num;
05803 if (num > 0)
05804 {
05805 optimization->otherSolverOutput->solverOutput = new SolverOutput*[num];
05806 for(int i = 0; i < num; i++)
05807 {
05808 optimization->otherSolverOutput->solverOutput[ i] = new SolverOutput();
05809 }
05810 }
05811 return true;
05812 }
05813
05814 bool OSResult::setSolverOutputName(int otherIdx, std::string name)
05815 {
05816 if (optimization == NULL) return false;
05817 if (optimization->otherSolverOutput == NULL) return false;
05818 if (optimization->otherSolverOutput->solverOutput[otherIdx] == NULL) return false;
05819 optimization->otherSolverOutput->solverOutput[otherIdx]->name = name;
05820 return true;
05821 }
05822
05823 bool OSResult::setSolverOutputCategory(int otherIdx, std::string category)
05824 {
05825 if (optimization == NULL) return false;
05826 if (optimization->otherSolverOutput == NULL) return false;
05827 if (optimization->otherSolverOutput->solverOutput[otherIdx] == NULL) return false;
05828 optimization->otherSolverOutput->solverOutput[otherIdx]->category = category;
05829 return true;
05830 }
05831
05832 bool OSResult::setSolverOutputDescription(int otherIdx, std::string description)
05833 {
05834 if (optimization == NULL) return false;
05835 if (optimization->otherSolverOutput == NULL) return false;
05836 if (optimization->otherSolverOutput->solverOutput[otherIdx] == NULL) return false;
05837 optimization->otherSolverOutput->solverOutput[otherIdx]->description = description;
05838 return true;
05839 }
05840
05841 bool OSResult::setSolverOutputNumberOfItems(int otherIdx, int numberOfItems)
05842 {
05843 if (optimization == NULL) return false;
05844 if (optimization->otherSolverOutput == NULL) return false;
05845 if (optimization->otherSolverOutput->solverOutput[otherIdx] == NULL)
05846 optimization->otherSolverOutput->solverOutput[otherIdx] = new SolverOutput();
05847 if (numberOfItems < 0) return false;
05848 if (optimization->otherSolverOutput->solverOutput[otherIdx]->item != NULL) return false;
05849 optimization->otherSolverOutput->solverOutput[otherIdx]->numberOfItems = numberOfItems;
05850 if (numberOfItems > 0)
05851 optimization->otherSolverOutput->solverOutput[otherIdx]->item = new std::string[numberOfItems];
05852 return true;
05853 }
05854
05855 bool OSResult::setSolverOutputItem(int otherIdx, int itemIdx, std::string item)
05856 {
05857 if (optimization == NULL) return false;
05858 if (optimization->otherSolverOutput == NULL) return false;
05859 if (optimization->otherSolverOutput->solverOutput == NULL) return false;
05860 if (optimization->otherSolverOutput->solverOutput[otherIdx] == NULL) return false;
05861 if (optimization->otherSolverOutput->solverOutput[otherIdx]->item == NULL) return false;
05862 optimization->otherSolverOutput->solverOutput[otherIdx]->item[itemIdx] = item;
05863 return true;
05864 }
05865
05866
05867
05868
05869
05870
05871
05872 bool OSResult::IsEqual(OSResult *that)
05873 {
05874 #if DEBUG_ISEQUAL_ROUTINES == 2
05875 cout << "Start comparing in OSResult" << endl;
05876 #endif
05877 if (this == NULL)
05878 {
05879 if (that == NULL)
05880 return true;
05881 else
05882 {
05883 #if DEBUG_ISEQUAL_ROUTINES > 0
05884 cout << "Differences in OSResult" << endl;
05885 cout << "First object is NULL, second is not" << endl;
05886 #endif
05887 return false;
05888 }
05889 }
05890 else
05891 {
05892 if (that == NULL)
05893 {
05894 #if DEBUG_ISEQUAL_ROUTINES > 0
05895 cout << "Differences in OSResult" << endl;
05896 cout << "Second object is NULL, first is not" << endl;
05897 #endif
05898 return false;
05899 }
05900 else
05901 {
05902 if (!this->general->IsEqual(that->general))
05903 return false;
05904 if (!this->system->IsEqual(that->system))
05905 return false;
05906 if (!this->service->IsEqual(that->service))
05907 return false;
05908 if (!this->job->IsEqual(that->job))
05909 return false;
05910 if (!this->optimization->IsEqual(that->optimization))
05911 return false;
05912
05913 return true;
05914 }
05915 }
05916 }
05917
05918 bool GeneralResult::IsEqual(GeneralResult *that)
05919 {
05920 #if DEBUG_ISEQUAL_ROUTINES == 2
05921 cout << "Start comparing in GeneralResult" << endl;
05922 #endif
05923 if (this == NULL)
05924 {
05925 if (that == NULL)
05926 return true;
05927 else
05928 {
05929 #if DEBUG_ISEQUAL_ROUTINES > 0
05930 cout << "Differences in GeneralResult" << endl;
05931 cout << "First object is NULL, second is not" << endl;
05932 #endif
05933 return false;
05934 }
05935 }
05936 else
05937 {
05938 if (that == NULL)
05939 {
05940 #if DEBUG_ISEQUAL_ROUTINES > 0
05941 cout << "Differences in GeneralResult" << endl;
05942 cout << "Second object is NULL, first is not" << endl;
05943 #endif
05944 return false;
05945 }
05946 else
05947 {
05948 if (this->message != that->message ||
05949 this->serviceURI != that->serviceURI ||
05950 this->serviceName != that->serviceName ||
05951 this->instanceName != that->instanceName ||
05952 this->jobID != that->jobID ||
05953 this->solverInvoked != that->solverInvoked ||
05954 this->timeStamp != that->timeStamp )
05955 {
05956 #if DEBUG_ISEQUAL_ROUTINES > 0
05957 cout << "Differences in GeneralResult" << endl;
05958 cout << "message: " << this->message << " vs. " << that->message << endl;
05959 cout << "serviceURI: " << this->serviceURI << " vs. " << that->serviceURI << endl;
05960 cout << "serviceName: " << this->serviceName << " vs. " << that->serviceName << endl;
05961 cout << "instanceName: " << this->instanceName << " vs. " << that->instanceName << endl;
05962 cout << "jobID: " << this->jobID << " vs. " << that->jobID << endl;
05963 cout << "solverInvoked: " << this->solverInvoked << " vs. " << that->solverInvoked << endl;
05964 cout << "timeStamp: " << this->timeStamp << " vs. " << that->timeStamp << endl;
05965 #endif
05966
05967 return false;
05968 }
05969 if (!this->generalStatus->IsEqual(that->generalStatus))
05970 return false;
05971 if (!this->otherResults->IsEqual(that->otherResults))
05972 return false;
05973 return true;
05974 }
05975 }
05976 }
05977
05978
05979 bool GeneralStatus::IsEqual(GeneralStatus *that)
05980 {
05981 #if DEBUG_ISEQUAL_ROUTINES == 2
05982 cout << "Start comparing in GeneralStatus" << endl;
05983 #endif
05984 if (this == NULL)
05985 {
05986 if (that == NULL)
05987 return true;
05988 else
05989 {
05990 #if DEBUG_ISEQUAL_ROUTINES > 0
05991 cout << "Differences in GeneralStatus" << endl;
05992 cout << "First object is NULL, second is not" << endl;
05993 #endif
05994 return false;
05995 }
05996 }
05997 else
05998 {
05999 if (that == NULL)
06000 {
06001 #if DEBUG_ISEQUAL_ROUTINES > 0
06002 cout << "Differences in GeneralStatus" << endl;
06003 cout << "Second object is NULL, first is not" << endl;
06004 #endif
06005 return false;
06006 }
06007 else
06008 {
06009 if (this->numberOfSubstatuses != that->numberOfSubstatuses ||
06010 this->type != that->type ||
06011 this->description != that->description )
06012 {
06013 #if DEBUG_ISEQUAL_ROUTINES > 0
06014 cout << "Differences in GeneralStatus" << endl;
06015 cout << "numberOfSubstatuses: " << this->numberOfSubstatuses << " vs. " << that->numberOfSubstatuses << endl;
06016 cout << "type: " << this->type << " vs. " << that->type << endl;
06017 cout << "description: " << this->description << " vs. " << that->description << endl;
06018 #endif
06019 return false;
06020 }
06021
06022 for (int i = 0; i < numberOfSubstatuses; i++)
06023 if (!this->substatus[i]->IsEqual(that->substatus[i]))
06024 return false;
06025 }
06026 return true;
06027 }
06028 }
06029
06030 bool GeneralSubstatus::IsEqual(GeneralSubstatus *that)
06031 {
06032 #if DEBUG_ISEQUAL_ROUTINES == 2
06033 cout << "Start comparing in GeneralSubstatus" << endl;
06034 #endif
06035 if (this == NULL)
06036 {
06037 if (that == NULL)
06038 return true;
06039 else
06040 {
06041 #if DEBUG_ISEQUAL_ROUTINES > 0
06042 cout << "Differences in GeneralSubstatus" << endl;
06043 cout << "First object is NULL, second is not" << endl;
06044 #endif
06045 return false;
06046 }
06047 }
06048 else
06049 {
06050 if (that == NULL)
06051 {
06052 #if DEBUG_ISEQUAL_ROUTINES > 0
06053 cout << "Differences in GeneralSubstatus" << endl;
06054 cout << "Second object is NULL, first is not" << endl;
06055 #endif
06056 return false;
06057 }
06058 else
06059 {
06060 if (this->name != that->name ||
06061 this->description != that->description )
06062 {
06063 #if DEBUG_ISEQUAL_ROUTINES > 0
06064 cout << "Differences in GeneralSubstatus" << endl;
06065 cout << "name: " << this->name << " vs. " << that->name << endl;
06066 cout << "description: " << this->description << " vs. " << that->description << endl;
06067 #endif
06068 return false;
06069 }
06070 }
06071 return true;
06072 }
06073 }
06074
06075
06076 bool OtherResults::IsEqual(OtherResults *that)
06077 {
06078 #if DEBUG_ISEQUAL_ROUTINES == 2
06079 cout << "Start comparing in OtherResults" << endl;
06080 #endif
06081 if (this == NULL)
06082 {
06083 if (that == NULL)
06084 return true;
06085 else
06086 {
06087 #if DEBUG_ISEQUAL_ROUTINES > 0
06088 cout << "Differences in OtherResults" << endl;
06089 cout << "First object is NULL, second is not" << endl;
06090 #endif
06091 return false;
06092 }
06093 }
06094 else
06095 {
06096 if (that == NULL)
06097 {
06098 #if DEBUG_ISEQUAL_ROUTINES > 0
06099 cout << "Differences in OtherResults" << endl;
06100 cout << "Second object is NULL, first is not" << endl;
06101 #endif
06102 return false;
06103 }
06104 else
06105 {
06106 if (this->numberOfOtherResults != that->numberOfOtherResults)
06107 {
06108 #if DEBUG_ISEQUAL_ROUTINES > 0
06109 cout << "Differences in OtherResults" << endl;
06110 cout << "numberOfOtherResults: " << this->numberOfOtherResults << " vs. " << that->numberOfOtherResults << endl;
06111 #endif
06112
06113 return false;
06114 }
06115
06116 for (int i = 0; i < numberOfOtherResults; i++)
06117 if (!this->other[i]->IsEqual(that->other[i]))
06118 return false;
06119 return true;
06120 }
06121 }
06122 }
06123
06124
06125 bool OtherResult::IsEqual(OtherResult *that)
06126 {
06127 #if DEBUG_ISEQUAL_ROUTINES == 2
06128 cout << "Start comparing in OtherResult" << endl;
06129 #endif
06130 if (this == NULL)
06131 {
06132 if (that == NULL)
06133 return true;
06134 else
06135 {
06136 #if DEBUG_ISEQUAL_ROUTINES > 0
06137 cout << "Differences in OtherResult" << endl;
06138 cout << "First object is NULL, second is not" << endl;
06139 #endif
06140 return false;
06141 }
06142 }
06143 else
06144 {
06145 if (that == NULL)
06146 {
06147 #if DEBUG_ISEQUAL_ROUTINES > 0
06148 cout << "Differences in OtherResult" << endl;
06149 cout << "Second object is NULL, first is not" << endl;
06150 #endif
06151 return false;
06152 }
06153 else
06154 {
06155 if (this->name != that->name ||
06156 this->value != that->value ||
06157 this->description != that->description )
06158 {
06159 #if DEBUG_ISEQUAL_ROUTINES > 0
06160 cout << "Differences in OtherResult" << endl;
06161 cout << "name: " << this->name << " vs. " << that->name << endl;
06162 cout << "value: " << this->value << " vs. " << that->value << endl;
06163 cout << "description: " << this->description << " vs. " << that->description << endl;
06164 #endif
06165 return false;
06166 }
06167 return true;
06168 }
06169 }
06170 }
06171
06172
06173 bool SystemResult::IsEqual(SystemResult *that)
06174 {
06175 #if DEBUG_ISEQUAL_ROUTINES == 2
06176 cout << "Start comparing in SystemResult" << endl;
06177 #endif
06178 if (this == NULL)
06179 {
06180 if (that == NULL)
06181 return true;
06182 else
06183 {
06184 #if DEBUG_ISEQUAL_ROUTINES > 0
06185 cout << "Differences in SystemResult" << endl;
06186 cout << "First object is NULL, second is not" << endl;
06187 #endif
06188 return false;
06189 }
06190 }
06191 else
06192 {
06193 if (that == NULL)
06194 {
06195 #if DEBUG_ISEQUAL_ROUTINES > 0
06196 cout << "Differences in SystemResult" << endl;
06197 cout << "Second object is NULL, first is not" << endl;
06198 #endif
06199 return false;
06200 }
06201 else
06202 {
06203 if (this->systemInformation != that->systemInformation)
06204 {
06205 #if DEBUG_ISEQUAL_ROUTINES > 0
06206 cout << "Differences in SystemResult" << endl;
06207 cout << "systemInformation: " << this->systemInformation << " vs. " << that->systemInformation << endl;
06208 #endif
06209 return false;
06210 }
06211
06212 if (!this->availableDiskSpace->IsEqual(that->availableDiskSpace))
06213 return false;
06214 if (!this->availableMemory->IsEqual(that->availableMemory))
06215 return false;
06216 if (!this->availableCPUSpeed->IsEqual(that->availableCPUSpeed))
06217 return false;
06218 if (!this->availableCPUNumber->IsEqual(that->availableCPUNumber))
06219 return false;
06220 if (!this->otherResults->IsEqual(that->otherResults))
06221 return false;
06222
06223 return true;
06224 }
06225 }
06226 }
06227
06228
06229
06230 bool ServiceResult::IsEqual(ServiceResult *that)
06231 {
06232 #if DEBUG_ISEQUAL_ROUTINES == 2
06233 cout << "Start comparing in ServiceResult" << endl;
06234 #endif
06235 if (this == NULL)
06236 {
06237 if (that == NULL)
06238 return true;
06239 else
06240 {
06241 #if DEBUG_ISEQUAL_ROUTINES > 0
06242 cout << "Differences in ServiceResult" << endl;
06243 cout << "First object is NULL, second is not" << endl;
06244 #endif
06245 return false;
06246 }
06247 }
06248 else
06249 {
06250 if (that == NULL)
06251 {
06252 #if DEBUG_ISEQUAL_ROUTINES > 0
06253 cout << "Differences in ServiceResult" << endl;
06254 cout << "Second object is NULL, first is not" << endl;
06255 #endif
06256 return false;
06257 }
06258 else
06259 {
06260 if (this->currentState != that->currentState ||
06261 this->currentJobCount != that->currentJobCount ||
06262 this->totalJobsSoFar != that->totalJobsSoFar ||
06263 this->timeServiceStarted != that->timeServiceStarted ||
06264 !isEqual(this->serviceUtilization, that->serviceUtilization) )
06265 {
06266 #if DEBUG_ISEQUAL_ROUTINES > 0
06267 cout << "Differences in ServiceResult" << endl;
06268 cout << "currentState: " << this->currentState << " vs. " << that->currentState << endl;
06269 cout << "currentJobCount: " << this->currentJobCount << " vs. " << that->currentJobCount << endl;
06270 cout << "totalJobsSoFar: " << this->totalJobsSoFar << " vs. " << that->totalJobsSoFar << endl;
06271 cout << "timeServiceStarted: " << this->timeServiceStarted << " vs. " << that->timeServiceStarted << endl;
06272 cout << "serviceUtilization: " << this->serviceUtilization << " vs. " << that->serviceUtilization << endl;
06273 #endif
06274 return false;
06275 }
06276
06277 if (!this->otherResults->IsEqual(that->otherResults))
06278 return false;
06279 }
06280 return true;
06281 }
06282 }
06283
06284
06285 bool JobResult::IsEqual(JobResult *that)
06286 {
06287 #if DEBUG_ISEQUAL_ROUTINES == 2
06288 cout << "Start comparing in JobResult" << endl;
06289 #endif
06290 if (this == NULL)
06291 {
06292 if (that == NULL)
06293 return true;
06294 else
06295 {
06296 #if DEBUG_ISEQUAL_ROUTINES > 0
06297 cout << "Differences in JobResult" << endl;
06298 cout << "First object is NULL, second is not" << endl;
06299 #endif
06300 return false;
06301 }
06302 }
06303 else
06304 {
06305 if (that == NULL)
06306 {
06307 #if DEBUG_ISEQUAL_ROUTINES > 0
06308 cout << "Differences in JobResult" << endl;
06309 cout << "Second object is NULL, first is not" << endl;
06310 #endif
06311 return false;
06312 }
06313 else
06314 {
06315 if (this->status != that->status ||
06316 this->submitTime != that->submitTime ||
06317 this->scheduledStartTime != that->scheduledStartTime ||
06318 this->actualStartTime != that->actualStartTime ||
06319 this->endTime != that->endTime )
06320 {
06321 #if DEBUG_ISEQUAL_ROUTINES > 0
06322 cout << "Differences in JobResult" << endl;
06323 cout << "status: " << this->status << " vs. " << that->status << endl;
06324 cout << "submitTime: " << this->submitTime << " vs. " << that->submitTime << endl;
06325 cout << "scheduledStartTime: " << this->scheduledStartTime << " vs. " << that->scheduledStartTime << endl;
06326 cout << "actualStartTime: " << this->actualStartTime << " vs. " << that->actualStartTime << endl;
06327 cout << "endTime: " << this->endTime << " vs. " << that->endTime << endl;
06328 #endif
06329 return false;
06330 }
06331
06332 if (!this->timingInformation->IsEqual(that->timingInformation))
06333 return false;
06334 if (!this->usedDiskSpace->IsEqual(that->usedDiskSpace))
06335 return false;
06336 if (!this->usedMemory->IsEqual(that->usedMemory))
06337 return false;
06338 if (!this->usedCPUSpeed->IsEqual(that->usedCPUSpeed))
06339 return false;
06340 if (!this->usedCPUNumber->IsEqual(that->usedCPUNumber))
06341 return false;
06342 if (!this->otherResults->IsEqual(that->otherResults))
06343 return false;
06344
06345 return true;
06346 }
06347 }
06348 }
06349
06350
06351 bool TimingInformation::IsEqual(TimingInformation *that)
06352 {
06353 #if DEBUG_ISEQUAL_ROUTINES == 2
06354 cout << "Start comparing in TimingInformation" << endl;
06355 #endif
06356 if (this == NULL)
06357 {
06358 if (that == NULL)
06359 return true;
06360 else
06361 {
06362 #if DEBUG_ISEQUAL_ROUTINES > 0
06363 cout << "Differences in TimingInformation" << endl;
06364 cout << "First object is NULL, second is not" << endl;
06365 #endif
06366 return false;
06367 }
06368 }
06369 else
06370 {
06371 if (that == NULL)
06372 {
06373 #if DEBUG_ISEQUAL_ROUTINES > 0
06374 cout << "Differences in TimingInformation" << endl;
06375 cout << "Second object is NULL, first is not" << endl;
06376 #endif
06377 return false;
06378 }
06379 else
06380 {
06381 if (this->numberOfTimes != that->numberOfTimes)
06382 {
06383 #if DEBUG_ISEQUAL_ROUTINES > 0
06384 cout << "Differences in TimingInformation" << endl;
06385 cout << "numberOfTimes: " << this->numberOfTimes << " vs. " << that->numberOfTimes << endl;
06386 #endif
06387
06388 return false;
06389 }
06390
06391 for (int i = 0; i < numberOfTimes; i++)
06392 if (!this->time[i]->IsEqual(that->time[i]))
06393 return false;
06394 return true;
06395 }
06396 }
06397 }
06398
06399 #if 0
06400 bool Time::IsEqual(Time *that)
06401 {
06402 #if DEBUG_ISEQUAL_ROUTINES == 2
06403 cout << "Start comparing in Time" << endl;
06404 #endif
06405 if (this == NULL)
06406 {
06407 if (that == NULL)
06408 return true;
06409 else
06410 {
06411 #if DEBUG_ISEQUAL_ROUTINES > 0
06412 cout << "Differences in Time" << endl;
06413 cout << "First object is NULL, second is not" << endl;
06414 #endif
06415 return false;
06416 }
06417 }
06418 else
06419 {
06420 if (that == NULL)
06421 {
06422 #if DEBUG_ISEQUAL_ROUTINES > 0
06423 cout << "Differences in Time" << endl;
06424 cout << "Second object is NULL, first is not" << endl;
06425 #endif
06426 return false;
06427 }
06428 else
06429 {
06430 if (!isEqual(this->value, that->value) ||
06431 this->unit != that->unit ||
06432 this->type != that->type ||
06433 this->category != that->category ||
06434 this->description != that->description )
06435 {
06436 #if DEBUG_ISEQUAL_ROUTINES > 0
06437 cout << "Differences in Time" << endl;
06438 cout << "unit: " << this->unit << " vs. " << that->unit << endl;
06439 cout << "type: " << this->type << " vs. " << that->type << endl;
06440 cout << "value: " << this->value << " vs. " << that->value << endl;
06441 cout << "category: " << this->category << " vs. " << that->category << endl;
06442 cout << "description: " << this->description << " vs. " << that->description << endl;
06443 #endif
06444 return false;
06445 }
06446 return true;
06447 }
06448 }
06449 }
06450 #endif
06451
06452
06453
06454 bool TimeMeasurement::IsEqual(TimeMeasurement *that)
06455 {
06456 #if DEBUG_ISEQUAL_ROUTINES == 2
06457 cout << "Start comparing in TimeMeasurement" << endl;
06458 #endif
06459 if (this == NULL)
06460 {
06461 if (that == NULL)
06462 return true;
06463 else
06464 {
06465 #if DEBUG_ISEQUAL_ROUTINES > 0
06466 cout << "Differences in Time" << endl;
06467 cout << "First object is NULL, second is not" << endl;
06468 #endif
06469 return false;
06470 }
06471 }
06472 else
06473 {
06474 if (that == NULL)
06475 {
06476 #if DEBUG_ISEQUAL_ROUTINES > 0
06477 cout << "Differences in Time" << endl;
06478 cout << "Second object is NULL, first is not" << endl;
06479 #endif
06480 return false;
06481 }
06482 else
06483 {
06484 if (this->type != that->type ||
06485 this->category != that->category ||
06486 this->description != that->description )
06487 {
06488 #if DEBUG_ISEQUAL_ROUTINES > 0
06489 cout << "Differences in TimeMeasurement" << endl;
06490 cout << "type: " << this->type << " vs. " << that->type << endl;
06491 cout << "category: " << this->category << " vs. " << that->category << endl;
06492 cout << "description: " << this->description << " vs. " << that->description << endl;
06493 #endif
06494 return false;
06495 }
06496 return this->TimeSpan::IsEqual(that);
06497 }
06498 }
06499 }
06500
06501
06502 bool OptimizationResult::IsEqual(OptimizationResult *that)
06503 {
06504 #if DEBUG_ISEQUAL_ROUTINES == 2
06505 cout << "Start comparing in OptimizationResult" << endl;
06506 #endif
06507 if (this == NULL)
06508 {
06509 if (that == NULL)
06510 return true;
06511 else
06512 {
06513 #if DEBUG_ISEQUAL_ROUTINES > 0
06514 cout << "Differences in OptimizationResult" << endl;
06515 cout << "First object is NULL, second is not" << endl;
06516 #endif
06517 return false;
06518 }
06519 }
06520 else
06521 {
06522 if (that == NULL)
06523 {
06524 #if DEBUG_ISEQUAL_ROUTINES > 0
06525 cout << "Differences in OptimizationResult" << endl;
06526 cout << "Second object is NULL, first is not" << endl;
06527 #endif
06528 return false;
06529 }
06530 else
06531 {
06532 if (this->numberOfSolutions != that->numberOfSolutions ||
06533 this->numberOfVariables != that->numberOfVariables ||
06534 this->numberOfObjectives != that->numberOfObjectives ||
06535 this->numberOfConstraints != that->numberOfConstraints )
06536 {
06537 #if DEBUG_ISEQUAL_ROUTINES > 0
06538 cout << "Differences in OptimizationResult" << endl;
06539 cout << "numberOfSolutions: " << this->numberOfSolutions << " vs. " << that->numberOfSolutions << endl;
06540 cout << "numberOfVariables: " << this->numberOfVariables << " vs. " << that->numberOfVariables << endl;
06541 cout << "numberOfObjectives: " << this->numberOfObjectives << " vs. " << that->numberOfObjectives << endl;
06542 cout << "numberOfConstraints: " << this->numberOfConstraints << " vs. " << that->numberOfConstraints << endl;
06543 #endif
06544 return false;
06545 }
06546
06547 for (int i = 0; i < numberOfSolutions; i++)
06548 if (!this->solution[i]->IsEqual(that->solution[i]))
06549 return false;
06550
06551 if (!this->otherSolverOutput->IsEqual(that->otherSolverOutput))
06552 return false;
06553
06554 return true;
06555 }
06556 }
06557 }
06558
06559
06560 bool OptimizationSolution::IsEqual(OptimizationSolution *that)
06561 {
06562 #if DEBUG_ISEQUAL_ROUTINES == 2
06563 cout << "Start comparing in OptimizationSolution " << endl;
06564 #endif
06565 if (this == NULL)
06566 {
06567 if (that == NULL)
06568 return true;
06569 else
06570 {
06571 #if DEBUG_ISEQUAL_ROUTINES > 0
06572 cout << "Differences in OptimizationSolution" << endl;
06573 cout << "First object is NULL, second is not" << endl;
06574 #endif
06575 return false;
06576 }
06577 }
06578 else
06579 {
06580 if (that == NULL)
06581 {
06582 #if DEBUG_ISEQUAL_ROUTINES > 0
06583 cout << "Differences in OptimizationSolution" << endl;
06584 cout << "Second object is NULL, first is not" << endl;
06585 #endif
06586 return false;
06587 }
06588 else
06589 {
06590 if (this->targetObjectiveIdx != that->targetObjectiveIdx)
06591 {
06592 #if DEBUG_ISEQUAL_ROUTINES > 0
06593 cout << "Differences in OptimizationSolution" << endl;
06594 cout << "targetObjectiveIdx: " << this->targetObjectiveIdx << " vs. " << that->targetObjectiveIdx << endl;
06595 #endif
06596 return false;
06597 }
06598
06599 if (this->targetObjectiveName != that->targetObjectiveName)
06600 {
06601 #if DEBUG_ISEQUAL_ROUTINES > 0
06602 cout << "Differences in OptimizationSolution" << endl;
06603 cout << "targetObjectiveName: " << this->targetObjectiveName << " vs. " << that->targetObjectiveName << endl;
06604 #endif
06605 return false;
06606 }
06607
06608 if (this->weightedObjectives != that->weightedObjectives)
06609 {
06610 #if DEBUG_ISEQUAL_ROUTINES > 0
06611 cout << "Differences in OptimizationSolution" << endl;
06612 cout << "weightedObjectives: " << this->weightedObjectives << " vs. " << that->weightedObjectives << endl;
06613 #endif
06614 return false;
06615 }
06616
06617 if (this->message != that->message)
06618 {
06619 #if DEBUG_ISEQUAL_ROUTINES > 0
06620 cout << "Differences in OptimizationSolution" << endl;
06621 cout << "message: \'" << this->message << "\' vs. \'" << that->message << "\'" << endl;
06622 #endif
06623 return false;
06624 }
06625
06626 if (!this->status->IsEqual(that->status))
06627 return false;
06628 if (!this->variables->IsEqual(that->variables))
06629 return false;
06630 if (!this->objectives->IsEqual(that->objectives))
06631 return false;
06632 if (!this->constraints->IsEqual(that->constraints))
06633 return false;
06634 if (!this->otherSolutionResults->IsEqual(that->otherSolutionResults))
06635 return false;
06636
06637 return true;
06638 }
06639 }
06640 }
06641
06642
06643 bool OptimizationSolutionStatus::IsEqual(OptimizationSolutionStatus *that)
06644 {
06645 #if DEBUG_ISEQUAL_ROUTINES == 2
06646 cout << "Start comparing in OptimizationSolutionStatus" << endl;
06647 #endif
06648 if (this == NULL)
06649 {
06650 if (that == NULL)
06651 return true;
06652 else
06653 {
06654 #if DEBUG_ISEQUAL_ROUTINES > 0
06655 cout << "Differences in OptimizationSolutionStatus" << endl;
06656 cout << "First object is NULL, second is not" << endl;
06657 #endif
06658 return false;
06659 }
06660 }
06661 else
06662 {
06663 if (that == NULL)
06664 {
06665 #if DEBUG_ISEQUAL_ROUTINES > 0
06666 cout << "Differences in OptimizationSolutionStatus" << endl;
06667 cout << "Second object is NULL, first is not" << endl;
06668 #endif
06669 return false;
06670 }
06671 else
06672 {
06673 if (this->type != that->type ||
06674 this->description != that->description )
06675 {
06676 #if DEBUG_ISEQUAL_ROUTINES > 0
06677 cout << "Differences in OptimizationSolutionStatus" << endl;
06678 cout << "type: " << this->type << " vs. " << that->type << endl;
06679 cout << "description: " << this->description << " vs. " << that->description << endl;
06680 #endif
06681 return false;
06682 }
06683
06684 if (this->numberOfSubstatuses != that->numberOfSubstatuses)
06685 {
06686 #if DEBUG_ISEQUAL_ROUTINES > 0
06687 cout << "Differences in OptimizationSolutionStatus" << endl;
06688 cout << "numberOfSubstatuses: " << this->numberOfSubstatuses << " vs. " << that->numberOfSubstatuses << endl;
06689 #endif
06690
06691 return false;
06692 }
06693
06694 for (int i = 0; i < numberOfSubstatuses; i++)
06695 if (!this->substatus[i]->IsEqual(that->substatus[i]))
06696 return false;
06697
06698 return true;
06699 }
06700 }
06701 }
06702
06703
06704 bool OptimizationSolutionSubstatus::IsEqual(OptimizationSolutionSubstatus *that)
06705 {
06706 #if DEBUG_ISEQUAL_ROUTINES == 2
06707 cout << "Start comparing in OptimizationSolutionSubstatus" << endl;
06708 #endif
06709 if (this == NULL)
06710 {
06711 if (that == NULL)
06712 return true;
06713 else
06714 {
06715 #if DEBUG_ISEQUAL_ROUTINES > 0
06716 cout << "Differences in OptimizationSolutionSubstatus" << endl;
06717 cout << "First object is NULL, second is not" << endl;
06718 #endif
06719 return false;
06720 }
06721 }
06722 else
06723 {
06724 if (that == NULL)
06725 {
06726 #if DEBUG_ISEQUAL_ROUTINES > 0
06727 cout << "Differences in OptimizationSolutionSubstatus" << endl;
06728 cout << "Second object is NULL, first is not" << endl;
06729 #endif
06730 return false;
06731 }
06732 else
06733 {
06734 if (this->type != that->type ||
06735 this->description != that->description )
06736 {
06737 #if DEBUG_ISEQUAL_ROUTINES > 0
06738 cout << "Differences in OptimizationSolutionSubstatus" << endl;
06739 cout << "type: " << this->type << " vs. " << that->type << endl;
06740 cout << "description: " << this->description << " vs. " << that->description << endl;
06741 #endif
06742 return false;
06743 }
06744
06745 return true;
06746 }
06747 }
06748 }
06749
06750
06751 bool VariableSolution::IsEqual(VariableSolution *that)
06752 {
06753 #if DEBUG_ISEQUAL_ROUTINES == 2
06754 cout << "Start comparing in VariableSolution" << endl;
06755 #endif
06756 if (this == NULL)
06757 {
06758 if (that == NULL)
06759 return true;
06760 else
06761 {
06762 #if DEBUG_ISEQUAL_ROUTINES > 0
06763 cout << "Differences in VariableSolution" << endl;
06764 cout << "First object is NULL, second is not" << endl;
06765 #endif
06766 return false;
06767 }
06768 }
06769 else
06770 {
06771 if (that == NULL)
06772 {
06773 #if DEBUG_ISEQUAL_ROUTINES > 0
06774 cout << "Differences in VariableSolution" << endl;
06775 cout << "Second object is NULL, first is not" << endl;
06776 #endif
06777 return false;
06778 }
06779 else
06780 {
06781 if (this->numberOfOtherVariableResults != that->numberOfOtherVariableResults)
06782 {
06783 #if DEBUG_ISEQUAL_ROUTINES > 0
06784 cout << "Differences in VariableSolution" << endl;
06785 cout << "numberOfOtherVariableResults: " << this->numberOfOtherVariableResults << " vs. " << that->numberOfOtherVariableResults << endl;
06786 #endif
06787
06788 return false;
06789 }
06790
06791 for (int i = 0; i < numberOfOtherVariableResults; i++)
06792 if (!this->other[i]->IsEqual(that->other[i]))
06793 return false;
06794
06795 if (!this->values->IsEqual(that->values))
06796 return false;
06797 if (!this->valuesString->IsEqual(that->valuesString))
06798 return false;
06799 if (!this->basisStatus->IsEqual(that->basisStatus))
06800 return false;
06801
06802 return true;
06803 }
06804 }
06805 }
06806
06807 bool VariableValues::IsEqual(VariableValues *that)
06808 {
06809 #if DEBUG_ISEQUAL_ROUTINES == 2
06810 cout << "Start comparing in VariableValues" << endl;
06811 #endif
06812 if (this == NULL)
06813 {
06814 if (that == NULL)
06815 return true;
06816 else
06817 {
06818 #if DEBUG_ISEQUAL_ROUTINES > 0
06819 cout << "Differences in VariableValues" << endl;
06820 cout << "First object is NULL, second is not" << endl;
06821 #endif
06822 return false;
06823 }
06824 }
06825 else
06826 {
06827 if (that == NULL)
06828 {
06829 #if DEBUG_ISEQUAL_ROUTINES > 0
06830 cout << "Differences in VariableValues" << endl;
06831 cout << "Second object is NULL, first is not" << endl;
06832 #endif
06833 return false;
06834 }
06835 else
06836 {
06837 if (this->numberOfVar != that->numberOfVar)
06838 {
06839 #if DEBUG_ISEQUAL_ROUTINES > 0
06840 cout << "Differences in VariableValues" << endl;
06841 cout << "numberOfVar: " << this->numberOfVar << " vs. " << that->numberOfVar << endl;
06842 #endif
06843
06844 return false;
06845 }
06846
06847 for (int i = 0; i < numberOfVar; i++)
06848 if (!this->var[i]->IsEqual(that->var[i]))
06849 return false;
06850
06851 return true;
06852 }
06853 }
06854 }
06855
06856
06857 bool VarValue::IsEqual(VarValue *that)
06858 {
06859 #if DEBUG_ISEQUAL_ROUTINES == 2
06860 cout << "Start comparing in VarValue" << endl;
06861 #endif
06862 if (this == NULL)
06863 {
06864 if (that == NULL)
06865 return true;
06866 else
06867 {
06868 #if DEBUG_ISEQUAL_ROUTINES > 0
06869 cout << "Differences in VarValue" << endl;
06870 cout << "First object is NULL, second is not" << endl;
06871 #endif
06872 return false;
06873 }
06874 }
06875 else
06876 {
06877 if (that == NULL)
06878 {
06879 #if DEBUG_ISEQUAL_ROUTINES > 0
06880 cout << "Differences in VarValue" << endl;
06881 cout << "Second object is NULL, first is not" << endl;
06882 #endif
06883 return false;
06884 }
06885 else
06886 {
06887 if (this->idx != that->idx || this->name != that->name ||
06888 !isEqual(this->value, that->value) )
06889 {
06890 #if DEBUG_ISEQUAL_ROUTINES > 0
06891 cout << "Differences in VarValue" << endl;
06892 cout << "idx: " << this->idx << " vs. " << that->idx << endl;
06893 cout << "name: -" << this->name << "- vs. -" << that->name << "-" << endl;
06894 cout << "value: " << this->value << " vs. " << that->value << endl;
06895 #endif
06896 return false;
06897 }
06898
06899 return true;
06900 }
06901 }
06902 }
06903
06904
06905 bool VariableValuesString::IsEqual(VariableValuesString *that)
06906 {
06907 #if DEBUG_ISEQUAL_ROUTINES == 2
06908 cout << "Start comparing in VariableValuesString" << endl;
06909 #endif
06910 if (this == NULL)
06911 {
06912 if (that == NULL)
06913 return true;
06914 else
06915 {
06916 #if DEBUG_ISEQUAL_ROUTINES > 0
06917 cout << "Differences in VariableValuesString" << endl;
06918 cout << "First object is NULL, second is not" << endl;
06919 #endif
06920 return false;
06921 }
06922 }
06923 else
06924 {
06925 if (that == NULL)
06926 {
06927 #if DEBUG_ISEQUAL_ROUTINES > 0
06928 cout << "Differences in VariableValuesString" << endl;
06929 cout << "Second object is NULL, first is not" << endl;
06930 #endif
06931 return false;
06932 }
06933 else
06934 {
06935 if (this->numberOfVar != that->numberOfVar)
06936 {
06937 #if DEBUG_ISEQUAL_ROUTINES > 0
06938 cout << "Differences in VariableValuesString" << endl;
06939 cout << "numberOfVar: " << this->numberOfVar << " vs. " << that->numberOfVar << endl;
06940 #endif
06941
06942 return false;
06943 }
06944
06945 for (int i = 0; i < numberOfVar; i++)
06946 if (!this->var[i]->IsEqual(that->var[i]))
06947 return false;
06948
06949 return true;
06950 }
06951 }
06952 }
06953
06954
06955 bool VarValueString::IsEqual(VarValueString *that)
06956 {
06957 #if DEBUG_ISEQUAL_ROUTINES == 2
06958 cout << "Start comparing in VarValueString" << endl;
06959 #endif
06960 if (this == NULL)
06961 {
06962 if (that == NULL)
06963 return true;
06964 else
06965 {
06966 #if DEBUG_ISEQUAL_ROUTINES > 0
06967 cout << "Differences in VarValueString" << endl;
06968 cout << "First object is NULL, second is not" << endl;
06969 #endif
06970 return false;
06971 }
06972 }
06973 else
06974 {
06975 if (that == NULL)
06976 {
06977 #if DEBUG_ISEQUAL_ROUTINES > 0
06978 cout << "Differences in VarValueString" << endl;
06979 cout << "Second object is NULL, first is not" << endl;
06980 #endif
06981 return false;
06982 }
06983 else
06984 {
06985 if (this->idx != that->idx || this->name != that->name ||
06986 this->value != that->value )
06987 {
06988 #if DEBUG_ISEQUAL_ROUTINES > 0
06989 cout << "Differences in VarValueString" << endl;
06990 cout << "idx: " << this->idx << " vs. " << that->idx << endl;
06991 cout << "name: -" << this->name << "- vs. -" << that->name << "-" << endl;
06992 cout << "value: " << this->value << " vs. " << that->value << endl;
06993 #endif
06994 return false;
06995 }
06996
06997 return true;
06998 }
06999 }
07000 }
07001
07002
07003 bool OtherVariableResult::IsEqual(OtherVariableResult *that)
07004 {
07005 #if DEBUG_ISEQUAL_ROUTINES == 2
07006 cout << "Start comparing in OtherVariableResult" << endl;
07007 #endif
07008 if (this == NULL)
07009 {
07010 if (that == NULL)
07011 return true;
07012 else
07013 {
07014 #if DEBUG_ISEQUAL_ROUTINES > 0
07015 cout << "Differences in OtherVariableResult" << endl;
07016 cout << "First object is NULL, second is not" << endl;
07017 #endif
07018 return false;
07019 }
07020 }
07021 else
07022 {
07023 if (that == NULL)
07024 {
07025 #if DEBUG_ISEQUAL_ROUTINES > 0
07026 cout << "Differences in OtherVariableResult" << endl;
07027 cout << "Second object is NULL, first is not" << endl;
07028 #endif
07029 return false;
07030 }
07031 else
07032 {
07033 if (this->name != that->name ||
07034 this->value != that->value ||
07035 this->description != that->description )
07036 {
07037 #if DEBUG_ISEQUAL_ROUTINES > 0
07038 cout << "Differences in OtherVariableResult" << endl;
07039 cout << "name: " << this->name << " vs. " << that->name << endl;
07040 cout << "value: " << this->value << " vs. " << that->value << endl;
07041 cout << "description: " << this->description << " vs. " << that->description << endl;
07042 #endif
07043 return false;
07044 }
07045
07046 if (this->numberOfVar != that->numberOfVar)
07047 {
07048 #if DEBUG_ISEQUAL_ROUTINES == 2
07049 cout << "numberOfVar: " << this->numberOfVar << " vs. " << that->numberOfVar << endl;
07050 #endif
07051
07052 return false;
07053 }
07054
07055 for (int i = 0; i < numberOfVar; i++)
07056 if (!this->var[i]->IsEqual(that->var[i]))
07057 return false;
07058
07059 if (this->numberOfEnumerations != that->numberOfEnumerations)
07060 {
07061 #if DEBUG_ISEQUAL_ROUTINES > 0
07062 cout << "Differences in OtherVariableResult" << endl;
07063 cout << "numberOfEnumerations: " << this->numberOfEnumerations << " vs. " << that->numberOfEnumerations << endl;
07064 #endif
07065
07066 return false;
07067 }
07068
07069 for (int i = 0; i < numberOfEnumerations; i++)
07070 if (!this->enumeration[i]->IsEqual(that->enumeration[i]))
07071 return false;
07072
07073 return true;
07074 }
07075 }
07076 }
07077
07078
07079 bool OtherVarResult::IsEqual(OtherVarResult *that)
07080 {
07081 #if DEBUG_ISEQUAL_ROUTINES == 2
07082 cout << "Start comparing in OtherVarResult" << endl;
07083 #endif
07084 if (this == NULL)
07085 {
07086 if (that == NULL)
07087 return true;
07088 else
07089 {
07090 #if DEBUG_ISEQUAL_ROUTINES > 0
07091 cout << "Differences in OtherVarResult" << endl;
07092 cout << "First object is NULL, second is not" << endl;
07093 #endif
07094 return false;
07095 }
07096 }
07097 else
07098 {
07099 if (that == NULL)
07100 {
07101 #if DEBUG_ISEQUAL_ROUTINES > 0
07102 cout << "Differences in OtherVarResult" << endl;
07103 cout << "Second object is NULL, first is not" << endl;
07104 #endif
07105 return false;
07106 }
07107 else
07108 {
07109 if (this->idx != that->idx || this->name != that->name ||
07110 this->value != that->value )
07111 {
07112 #if DEBUG_ISEQUAL_ROUTINES > 0
07113 cout << "Differences in OtherVarResult" << endl;
07114 cout << "idx: " << this->idx << " vs. " << that->idx << endl;
07115 cout << "name: -" << this->name << "- vs. -" << that->name << "-" << endl;
07116 cout << "value: " << this->value << " vs. " << that->value << endl;
07117 #endif
07118 return false;
07119 }
07120
07121 return true;
07122 }
07123 }
07124 }
07125
07126
07127 bool ObjectiveSolution::IsEqual(ObjectiveSolution *that)
07128 {
07129 #if DEBUG_ISEQUAL_ROUTINES == 2
07130 cout << "Start comparing in ObjectiveSolution" << endl;
07131 #endif
07132 if (this == NULL)
07133 {
07134 if (that == NULL)
07135 return true;
07136 else
07137 {
07138 #if DEBUG_ISEQUAL_ROUTINES > 0
07139 cout << "Differences in ObjectiveSolution" << endl;
07140 cout << "First object is NULL, second is not" << endl;
07141 #endif
07142 return false;
07143 }
07144 }
07145 else
07146 {
07147 if (that == NULL)
07148 {
07149 #if DEBUG_ISEQUAL_ROUTINES > 0
07150 cout << "Differences in ObjectiveSolution" << endl;
07151 cout << "Second object is NULL, first is not" << endl;
07152 #endif
07153 return false;
07154 }
07155 else
07156 {
07157 if (this->numberOfOtherObjectiveResults != that->numberOfOtherObjectiveResults)
07158 {
07159 #if DEBUG_ISEQUAL_ROUTINES > 0
07160 cout << "Differences in ObjectiveSolution" << endl;
07161
07162 cout << "numberOfOtherObjectiveResults: " << this->numberOfOtherObjectiveResults << " vs. " << that->numberOfOtherObjectiveResults << endl;
07163 #endif
07164
07165 return false;
07166 }
07167
07168 for (int i = 0; i < numberOfOtherObjectiveResults; i++)
07169 if (!this->other[i]->IsEqual(that->other[i]))
07170 return false;
07171
07172 if (!this->values->IsEqual(that->values))
07173 return false;
07174 if (!this->basisStatus->IsEqual(that->basisStatus))
07175 return false;
07176
07177 return true;
07178 }
07179 }
07180 }
07181
07182
07183 bool ObjectiveValues::IsEqual(ObjectiveValues *that)
07184 {
07185 #if DEBUG_ISEQUAL_ROUTINES == 2
07186 cout << "Start comparing in ObjectiveValues" << endl;
07187 #endif
07188 if (this == NULL)
07189 {
07190 if (that == NULL)
07191 return true;
07192 else
07193 {
07194 #if DEBUG_ISEQUAL_ROUTINES > 0
07195 cout << "Differences in ObjectiveValues" << endl;
07196 cout << "First object is NULL, second is not" << endl;
07197 #endif
07198 return false;
07199 }
07200 }
07201 else
07202 {
07203 if (that == NULL)
07204 {
07205 #if DEBUG_ISEQUAL_ROUTINES > 0
07206 cout << "Differences in ObjectiveValues" << endl;
07207 cout << "Second object is NULL, first is not" << endl;
07208 #endif
07209 return false;
07210 }
07211 else
07212 {
07213 if (this->numberOfObj != that->numberOfObj)
07214 {
07215 #if DEBUG_ISEQUAL_ROUTINES > 0
07216 cout << "Differences in ObjectiveValues" << endl;
07217 cout << "numberOfObj: " << this->numberOfObj << " vs. " << that->numberOfObj << endl;
07218 #endif
07219
07220 return false;
07221 }
07222
07223 for (int i = 0; i < numberOfObj; i++)
07224 if (!this->obj[i]->IsEqual(that->obj[i]))
07225 return false;
07226
07227 return true;
07228 }
07229 }
07230 }
07231
07232
07233 bool ObjValue::IsEqual(ObjValue *that)
07234 {
07235 #if DEBUG_ISEQUAL_ROUTINES == 2
07236 cout << "Start comparing in ObjValue" << endl;
07237 #endif
07238 if (this == NULL)
07239 {
07240 if (that == NULL)
07241 return true;
07242 else
07243 {
07244 #if DEBUG_ISEQUAL_ROUTINES > 0
07245 cout << "Differences in ObjValue" << endl;
07246 cout << "First object is NULL, second is not" << endl;
07247 #endif
07248 return false;
07249 }
07250 }
07251 else
07252 {
07253 if (that == NULL)
07254 {
07255 #if DEBUG_ISEQUAL_ROUTINES > 0
07256 cout << "Differences in ObjValue" << endl;
07257 cout << "Second object is NULL, first is not" << endl;
07258 #endif
07259 return false;
07260 }
07261 else
07262 {
07263 if (this->idx != that->idx || this->name != that->name ||
07264 this->value != that->value )
07265 {
07266 #if DEBUG_ISEQUAL_ROUTINES > 0
07267 cout << "Differences in ObjValue" << endl;
07268 cout << "idx: " << this->idx << " vs. " << that->idx << endl;
07269 cout << "name: -" << this->name << "- vs. -" << that->name << "-" << endl;
07270 cout << "value: " << this->value << " vs. " << that->value << endl;
07271 #endif
07272 return false;
07273 }
07274
07275 return true;
07276 }
07277 }
07278 }
07279
07280
07281 bool OtherObjectiveResult::IsEqual(OtherObjectiveResult *that)
07282 {
07283 #if DEBUG_ISEQUAL_ROUTINES == 2
07284 cout << "Start comparing in OtherObjectiveResult" << endl;
07285 #endif
07286 if (this == NULL)
07287 {
07288 if (that == NULL)
07289 return true;
07290 else
07291 {
07292 #if DEBUG_ISEQUAL_ROUTINES > 0
07293 cout << "Differences in OtherObjectiveResult" << endl;
07294 cout << "First object is NULL, second is not" << endl;
07295 #endif
07296 return false;
07297 }
07298 }
07299 else
07300 {
07301 if (that == NULL)
07302 {
07303 #if DEBUG_ISEQUAL_ROUTINES > 0
07304 cout << "Differences in OtherObjectiveResult" << endl;
07305 cout << "Second object is NULL, first is not" << endl;
07306 #endif
07307 return false;
07308 }
07309 else
07310 {
07311 if (this->value != that->value ||
07312 this->name != that->name ||
07313 this->description != that->description )
07314 {
07315 #if DEBUG_ISEQUAL_ROUTINES > 0
07316 cout << "Differences in OtherObjectiveResult" << endl;
07317 cout << "name: " << this->name << " vs. " << that->name << endl;
07318 cout << "value: " << this->value << " vs. " << that->value << endl;
07319 cout << "description: " << this->description << " vs. " << that->description << endl;
07320 #endif
07321 return false;
07322 }
07323
07324 if (this->numberOfObj != that->numberOfObj)
07325 {
07326 #if DEBUG_ISEQUAL_ROUTINES > 0
07327 cout << "Differences in OtherObjectiveResult" << endl;
07328 cout << "numberOfObj: " << this->numberOfObj << " vs. " << that->numberOfObj << endl;
07329 #endif
07330
07331 return false;
07332 }
07333
07334 for (int i = 0; i < numberOfObj; i++)
07335 if (!this->obj[i]->IsEqual(that->obj[i]))
07336 return false;
07337
07338 if (this->numberOfEnumerations != that->numberOfEnumerations)
07339 {
07340 #if DEBUG_ISEQUAL_ROUTINES > 0
07341 cout << "Differences in OtherObjectiveResult" << endl;
07342 cout << "numberOfEnumerations: " << this->numberOfEnumerations << " vs. " << that->numberOfEnumerations << endl;
07343 #endif
07344
07345 return false;
07346 }
07347
07348 for (int i = 0; i < numberOfEnumerations; i++)
07349 if (!this->enumeration[i]->IsEqual(that->enumeration[i]))
07350 return false;
07351
07352 return true;
07353 }
07354 }
07355 }
07356
07357
07358 bool OtherObjResult::IsEqual(OtherObjResult *that)
07359 {
07360 #if DEBUG_ISEQUAL_ROUTINES == 2
07361 cout << "Start comparing in OtherObjResult" << endl;
07362 #endif
07363 if (this == NULL)
07364 {
07365 if (that == NULL)
07366 return true;
07367 else
07368 {
07369 #if DEBUG_ISEQUAL_ROUTINES > 0
07370 cout << "Differences in OtherObjResult" << endl;
07371 cout << "First object is NULL, second is not" << endl;
07372 #endif
07373 return false;
07374 }
07375 }
07376 else
07377 {
07378 if (that == NULL)
07379 {
07380 #if DEBUG_ISEQUAL_ROUTINES > 0
07381 cout << "Differences in OtherObjResult" << endl;
07382 cout << "Second object is NULL, first is not" << endl;
07383 #endif
07384 return false;
07385 }
07386 else
07387 {
07388 if (this->idx != that->idx || this->name != that->name ||
07389 this->value != that->value )
07390 {
07391 #if DEBUG_ISEQUAL_ROUTINES > 0
07392 cout << "Differences in OtherObjResult" << endl;
07393 cout << "idx: " << this->idx << " vs. " << that->idx << endl;
07394 cout << "name: -" << this->name << "- vs. -" << that->name << "-" << endl;
07395 cout << "value: " << this->value << " vs. " << that->value << endl;
07396 #endif
07397 return false;
07398 }
07399
07400 return true;
07401 }
07402 }
07403 }
07404
07405
07406 bool ConstraintSolution::IsEqual(ConstraintSolution *that)
07407 {
07408 #if DEBUG_ISEQUAL_ROUTINES == 2
07409 cout << "Start comparing in ConstraintSolution" << endl;
07410 #endif
07411 if (this == NULL)
07412 {
07413 if (that == NULL)
07414 return true;
07415 else
07416 {
07417 #if DEBUG_ISEQUAL_ROUTINES > 0
07418 cout << "Differences in ConstraintSolution" << endl;
07419 cout << "First object is NULL, second is not" << endl;
07420 #endif
07421 return false;
07422 }
07423 }
07424 else
07425 {
07426 if (that == NULL)
07427 {
07428 #if DEBUG_ISEQUAL_ROUTINES > 0
07429 cout << "Differences in ConstraintSolution" << endl;
07430 cout << "Second object is NULL, first is not" << endl;
07431 #endif
07432 return false;
07433 }
07434 else
07435 {
07436 if (this->numberOfOtherConstraintResults != that->numberOfOtherConstraintResults)
07437 {
07438 #if DEBUG_ISEQUAL_ROUTINES > 0
07439 cout << "Differences in ConstraintSolution" << endl;
07440 cout << "numberOfOtherConstraintResults: " << this->numberOfOtherConstraintResults << " vs. " << that->numberOfOtherConstraintResults << endl;
07441 #endif
07442
07443 return false;
07444 }
07445
07446 for (int i = 0; i < numberOfOtherConstraintResults; i++)
07447 if (!this->other[i]->IsEqual(that->other[i]))
07448 return false;
07449
07450 if (!this->dualValues->IsEqual(that->dualValues))
07451 return false;
07452 if (!this->basisStatus->IsEqual(that->basisStatus))
07453 return false;
07454
07455 return true;
07456 }
07457 }
07458 }
07459
07460
07461 bool DualVariableValues::IsEqual(DualVariableValues *that)
07462 {
07463 #if DEBUG_ISEQUAL_ROUTINES == 2
07464 cout << "Start comparing in DualVariableValues" << endl;
07465 #endif
07466 if (this == NULL)
07467 {
07468 if (that == NULL)
07469 return true;
07470 else
07471 {
07472 #if DEBUG_ISEQUAL_ROUTINES > 0
07473 cout << "Differences in DualVariableValues" << endl;
07474 cout << "First object is NULL, second is not" << endl;
07475 #endif
07476 return false;
07477 }
07478 }
07479 else
07480 {
07481 if (that == NULL)
07482 {
07483 #if DEBUG_ISEQUAL_ROUTINES > 0
07484 cout << "Differences in DualVariableValues" << endl;
07485 cout << "Second object is NULL, first is not" << endl;
07486 #endif
07487 return false;
07488 }
07489 else
07490 {
07491 if (this->numberOfCon != that->numberOfCon)
07492 {
07493 #if DEBUG_ISEQUAL_ROUTINES > 0
07494 cout << "Differences in DualVariableValues" << endl;
07495 cout << "numberOfCon: " << this->numberOfCon << " vs. " << that->numberOfCon << endl;
07496 #endif
07497
07498 return false;
07499 }
07500
07501 for (int i = 0; i < numberOfCon; i++)
07502 if (!this->con[i]->IsEqual(that->con[i]))
07503 return false;
07504
07505 return true;
07506 }
07507 }
07508 }
07509
07510 bool DualVarValue::IsEqual(DualVarValue *that)
07511 {
07512 #if DEBUG_ISEQUAL_ROUTINES == 2
07513 cout << "Start comparing in DualVarValue" << endl;
07514 #endif
07515 if (this == NULL)
07516 {
07517 if (that == NULL)
07518 return true;
07519 else
07520 {
07521 #if DEBUG_ISEQUAL_ROUTINES > 0
07522 cout << "Differences in DualVarValue" << endl;
07523 cout << "First object is NULL, second is not" << endl;
07524 #endif
07525 return false;
07526 }
07527 }
07528 else
07529 {
07530 if (that == NULL)
07531 {
07532 #if DEBUG_ISEQUAL_ROUTINES > 0
07533 cout << "Differences in DualVarValue" << endl;
07534 cout << "Second object is NULL, first is not" << endl;
07535 #endif
07536 return false;
07537 }
07538 else
07539 {
07540 if (this->idx != that->idx || this->name != that->name ||
07541 !isEqual(this->value, that->value) )
07542 {
07543 #if DEBUG_ISEQUAL_ROUTINES > 0
07544 cout << "Differences in DualVarValue" << endl;
07545 cout << "idx: " << this->idx << " vs. " << that->idx << endl;
07546 cout << "name: -" << this->name << "- vs. -" << that->name << "-" << endl;
07547 cout << "value: " << this->value << " vs. " << that->value << endl;
07548 #endif
07549 return false;
07550 }
07551
07552 return true;
07553 }
07554 }
07555 }
07556
07557 bool OtherConstraintResult::IsEqual(OtherConstraintResult *that)
07558 {
07559 #if DEBUG_ISEQUAL_ROUTINES == 2
07560 cout << "Start comparing in OtherConstraintResult" << endl;
07561 #endif
07562 if (this == NULL)
07563 {
07564 if (that == NULL)
07565 return true;
07566 else
07567 {
07568 #if DEBUG_ISEQUAL_ROUTINES > 0
07569 cout << "Differences in OtherConstraintResult" << endl;
07570 cout << "First object is NULL, second is not" << endl;
07571 #endif
07572 return false;
07573 }
07574 }
07575 else
07576 {
07577 if (that == NULL)
07578 {
07579 #if DEBUG_ISEQUAL_ROUTINES > 0
07580 cout << "Differences in OtherConstraintResult" << endl;
07581 cout << "Second object is NULL, first is not" << endl;
07582 #endif
07583 return false;
07584 }
07585 else
07586 {
07587 if (this->name != that->name ||
07588 this->value != that->value ||
07589 this->description != that->description )
07590 {
07591 #if DEBUG_ISEQUAL_ROUTINES > 0
07592 cout << "Differences in OtherConstraintResult" << endl;
07593 cout << "name: " << this->name << " vs. " << that->name << endl;
07594 cout << "value: " << this->value << " vs. " << that->value << endl;
07595 cout << "description: " << this->description << " vs. " << that->description << endl;
07596 #endif
07597 return false;
07598 }
07599
07600 if (this->numberOfCon != that->numberOfCon)
07601 {
07602 #if DEBUG_ISEQUAL_ROUTINES > 0
07603 cout << "Differences in OtherConstraintResult" << endl;
07604 cout << "numberOfCon: " << this->numberOfCon << " vs. " << that->numberOfCon << endl;
07605 #endif
07606
07607 return false;
07608 }
07609
07610 for (int i = 0; i < numberOfCon; i++)
07611 if (!this->con[i]->IsEqual(that->con[i]))
07612 return false;
07613
07614 if (this->numberOfEnumerations != that->numberOfEnumerations)
07615 {
07616 #if DEBUG_ISEQUAL_ROUTINES > 0
07617 cout << "Differences in OtherConstraintResult" << endl;
07618 cout << "numberOfEnumerations: " << this->numberOfEnumerations << " vs. " << that->numberOfEnumerations << endl;
07619 #endif
07620
07621 return false;
07622 }
07623
07624 for (int i = 0; i < numberOfEnumerations; i++)
07625 if (!this->enumeration[i]->IsEqual(that->enumeration[i]))
07626 return false;
07627
07628 return true;
07629 }
07630 }
07631 }
07632
07633
07634 bool OtherConResult::IsEqual(OtherConResult *that)
07635 {
07636 #if DEBUG_ISEQUAL_ROUTINES == 2
07637 cout << "Start comparing in OtherConResult" << endl;
07638 #endif
07639 if (this == NULL)
07640 {
07641 if (that == NULL)
07642 return true;
07643 else
07644 {
07645 #if DEBUG_ISEQUAL_ROUTINES > 0
07646 cout << "Differences in OtherConResult" << endl;
07647 cout << "First object is NULL, second is not" << endl;
07648 #endif
07649 return false;
07650 }
07651 }
07652 else
07653 {
07654 if (that == NULL)
07655 {
07656 #if DEBUG_ISEQUAL_ROUTINES > 0
07657 cout << "Differences in OtherConResult" << endl;
07658 cout << "Second object is NULL, first is not" << endl;
07659 #endif
07660 return false;
07661 }
07662 else
07663 {
07664 if (this->idx != that->idx || this->name != that->name ||
07665 this->value != that->value )
07666 {
07667 #if DEBUG_ISEQUAL_ROUTINES > 0
07668 cout << "Differences in OtherConResult" << endl;
07669 cout << "idx: " << this->idx << " vs. " << that->idx << endl;
07670 cout << "name: -" << this->name << "- vs. -" << that->name << "-" << endl;
07671 cout << "value: " << this->value << " vs. " << that->value << endl;
07672 #endif
07673 return false;
07674 }
07675
07676 return true;
07677 }
07678 }
07679 }
07680
07681
07682 bool OtherSolutionResults::IsEqual(OtherSolutionResults *that)
07683 {
07684 #if DEBUG_ISEQUAL_ROUTINES == 2
07685 cout << "Start comparing in OtherSolutionResults" << endl;
07686 #endif
07687 if (this == NULL)
07688 {
07689 if (that == NULL)
07690 return true;
07691 else
07692 {
07693 #if DEBUG_ISEQUAL_ROUTINES > 0
07694 cout << "Differences in OtherSolutionResults" << endl;
07695 cout << "First object is NULL, second is not" << endl;
07696 #endif
07697 return false;
07698 }
07699 }
07700 else
07701 {
07702 if (that == NULL)
07703 {
07704 #if DEBUG_ISEQUAL_ROUTINES > 0
07705 cout << "Differences in OtherSolutionResults" << endl;
07706 cout << "Second object is NULL, first is not" << endl;
07707 #endif
07708 return false;
07709 }
07710 else
07711 {
07712 if (this->numberOfOtherSolutionResults != that->numberOfOtherSolutionResults)
07713 {
07714 #if DEBUG_ISEQUAL_ROUTINES > 0
07715 cout << "Differences in OtherSolutionResults" << endl;
07716 cout << "numberOfOtherSolutionResults: " << this->numberOfOtherSolutionResults << " vs. " << that->numberOfOtherSolutionResults << endl;
07717 #endif
07718
07719 return false;
07720 }
07721
07722 for (int i = 0; i < numberOfOtherSolutionResults; i++)
07723 if (!this->otherSolutionResult[i]->IsEqual(that->otherSolutionResult[i]))
07724 return false;
07725
07726 return true;
07727 }
07728 }
07729 }
07730
07731 bool OtherSolutionResult::IsEqual(OtherSolutionResult *that)
07732 {
07733 #if DEBUG_ISEQUAL_ROUTINES == 2
07734 cout << "Start comparing in OtherSolutionResult" << endl;
07735 #endif
07736 if (this == NULL)
07737 {
07738 if (that == NULL)
07739 return true;
07740 else
07741 {
07742 #if DEBUG_ISEQUAL_ROUTINES > 0
07743 cout << "Differences in OtherSolutionResult" << endl;
07744 cout << "First object is NULL, second is not" << endl;
07745 #endif
07746 return false;
07747 }
07748 }
07749 else
07750 {
07751 if (that == NULL)
07752 {
07753 #if DEBUG_ISEQUAL_ROUTINES > 0
07754 cout << "Differences in OtherSolutionResult" << endl;
07755 cout << "Second object is NULL, first is not" << endl;
07756 #endif
07757 return false;
07758 }
07759 else
07760 {
07761
07762 if (this->name != that->name ||
07763 this->category != that->category ||
07764 this->description != that->description )
07765 {
07766 #if DEBUG_ISEQUAL_ROUTINES > 0
07767 cout << "Differences in OtherSolutionResult" << endl;
07768 cout << "name: " << this->name << " vs. " << that->name << endl;
07769 cout << "category: " << this->category << " vs. " << that->category << endl;
07770 cout << "description: " << this->description << " vs. " << that->description << endl;
07771 #endif
07772 return false;
07773 }
07774
07775 if (this->numberOfItems != that->numberOfItems)
07776 {
07777 #if DEBUG_ISEQUAL_ROUTINES > 0
07778 cout << "Differences in OtherSolutionResult" << endl;
07779 cout << "numberOfItems: " << this->numberOfItems << " vs. " << that->numberOfItems << endl;
07780 #endif
07781
07782 return false;
07783 }
07784
07785 for (int i = 0; i < numberOfItems; i++)
07786 if (this->item[i] != that->item[i])
07787 {
07788 #if DEBUG_ISEQUAL_ROUTINES > 0
07789 cout << "Differences in OtherSolutionResult" << endl;
07790 cout << "item: " << this->item[i] << " vs. " << that->item[i] << endl;
07791 #endif
07792 return false;
07793 }
07794
07795 return true;
07796 }
07797 }
07798 }
07799
07800
07801 bool OtherSolverOutput::IsEqual(OtherSolverOutput *that)
07802 {
07803 #if DEBUG_ISEQUAL_ROUTINES == 2
07804 cout << "Start comparing in OtherSolverOutput" << endl;
07805 #endif
07806 if (this == NULL)
07807 {
07808 if (that == NULL)
07809 return true;
07810 else
07811 {
07812 #if DEBUG_ISEQUAL_ROUTINES > 0
07813 cout << "Differences in OtherSolverOutput" << endl;
07814 cout << "First object is NULL, second is not" << endl;
07815 #endif
07816 return false;
07817 }
07818 }
07819 else
07820 {
07821 if (that == NULL)
07822 {
07823 #if DEBUG_ISEQUAL_ROUTINES > 0
07824 cout << "Differences in OtherSolverOutput" << endl;
07825 cout << "Second object is NULL, first is not" << endl;
07826 #endif
07827 return false;
07828 }
07829 else
07830 {
07831 if (this->numberOfSolverOutputs != that->numberOfSolverOutputs)
07832 {
07833 #if DEBUG_ISEQUAL_ROUTINES > 0
07834 cout << "Differences in OtherSolverOutput" << endl;
07835 cout << "numberOfSolverOutputs: " << this->numberOfSolverOutputs << " vs. " << that->numberOfSolverOutputs << endl;
07836 #endif
07837
07838 return false;
07839 }
07840
07841 for (int i = 0; i < numberOfSolverOutputs; i++)
07842 if (!this->solverOutput[i]->IsEqual(that->solverOutput[i]))
07843 return false;
07844
07845 return true;
07846 }
07847 }
07848 }
07849
07850
07851 bool SolverOutput::IsEqual(SolverOutput *that)
07852 {
07853 #if DEBUG_ISEQUAL_ROUTINES == 2
07854 cout << "Start comparing in SolverOutput" << endl;
07855 #endif
07856 if (this == NULL)
07857 {
07858 if (that == NULL)
07859 return true;
07860 else
07861 {
07862 #if DEBUG_ISEQUAL_ROUTINES > 0
07863 cout << "Differences in SolverOutput" << endl;
07864 cout << "First object is NULL, second is not" << endl;
07865 #endif
07866 return false;
07867 }
07868 }
07869 else
07870 {
07871 if (that == NULL)
07872 {
07873 #if DEBUG_ISEQUAL_ROUTINES > 0
07874 cout << "Differences in SolverOutput" << endl;
07875 cout << "Second object is NULL, first is not" << endl;
07876 #endif
07877 return false;
07878 }
07879 else
07880 {
07881 if (this->name != that->name ||
07882 this->category != that->category ||
07883 this->description != that->description )
07884 {
07885 #if DEBUG_ISEQUAL_ROUTINES > 0
07886 cout << "Differences in SolverOutput" << endl;
07887 cout << "name: " << this->name << " vs. " << that->name << endl;
07888 cout << "category: " << this->category << " vs. " << that->category << endl;
07889 cout << "description: " << this->description << " vs. " << that->description << endl;
07890 #endif
07891 return false;
07892 }
07893
07894 if (this->numberOfItems != that->numberOfItems)
07895 {
07896 #if DEBUG_ISEQUAL_ROUTINES > 0
07897 cout << "Differences in SolverOutput" << endl;
07898 cout << "numberOfItems: " << this->numberOfItems << " vs. " << that->numberOfItems << endl;
07899 #endif
07900
07901 return false;
07902 }
07903
07904 for (int i = 0; i < numberOfItems; i++)
07905 if (this->item[i] != that->item[i])
07906 {
07907 #if DEBUG_ISEQUAL_ROUTINES > 0
07908 cout << "Differences in SolverOutput" << endl;
07909 cout << "item: " << this->item[i] << " vs. " << that->item[i] << endl;
07910 #endif
07911 return false;
07912 }
07913
07914 return true;
07915 }
07916 }
07917 }
07918
07919
07920
07921
07922
07923 bool OSResult::setRandom(double density, bool conformant)
07924 {
07925 #ifdef DEBUG_OSRESULT
07926 cout << "Set random OSResult" << endl;
07927 #endif
07928 if (OSRand() <= density)
07929 {
07930 resultHeader = new GeneralFileHeader();
07931 resultHeader->setRandom(density, conformant);
07932 }
07933 if (OSRand() <= density)
07934 {
07935 general = new GeneralResult();
07936 general->setRandom(density, conformant);
07937 }
07938 if (OSRand() <= density)
07939 {
07940 system = new SystemResult();
07941 system->setRandom(density, conformant);
07942 }
07943 if (OSRand() <= density)
07944 {
07945 service = new ServiceResult();
07946 service->setRandom(density, conformant);
07947 }
07948 if (OSRand() <= density)
07949 {
07950 job = new JobResult();
07951 job->setRandom(density, conformant);
07952 }
07953 if (OSRand() <= density)
07954 {
07955 optimization = new OptimizationResult();
07956 optimization->setRandom(density, conformant);
07957 }
07958 return true;
07959 }
07960
07961
07962 bool GeneralResult::setRandom(double density, bool conformant)
07963 {
07964 #ifdef DEBUG_OSRESULT
07965 cout << "Set random GeneralResult" << endl;
07966 #endif
07967 if (OSRand() <= density) this->message = "random string";
07968 if (OSRand() <= density) this->serviceURI = "random string";
07969 if (OSRand() <= density) this->serviceName = "random string";
07970 if (OSRand() <= density) this->instanceName = "random string";
07971 if (OSRand() <= density) this->jobID = "random string";
07972 if (OSRand() <= density) this->solverInvoked = "random string";
07973 if (OSRand() <= density) this->timeStamp = "random string";
07974
07975 if (OSRand() <= density)
07976 {
07977 generalStatus = new GeneralStatus();
07978 generalStatus->setRandom(density, conformant);
07979 }
07980 if (OSRand() <= density)
07981 {
07982 otherResults = new OtherResults();
07983 otherResults->setRandom(density, conformant);
07984 }
07985 return true;
07986 }
07987
07988
07989 bool GeneralStatus::setRandom(double density, bool conformant)
07990 {
07991 #ifdef DEBUG_OSRESULT
07992 cout << "Set random GeneralStatus" << endl;
07993 #endif
07994 int n;
07995
07996 if (OSRand() <= density) numberOfSubstatuses = (int)(1+4*OSRand());
07997 if (OSRand() <= density) type = "normal";
07998 else type = "error";
07999 if (OSRand() <= density) description = "random string";
08000
08001 if (conformant) n = this->numberOfSubstatuses;
08002 else n = (int)(1+4*OSRand());
08003
08004 substatus = new GeneralSubstatus*[n];
08005
08006 for (int i = 0; i < n; i++)
08007 {
08008 substatus[i] = new GeneralSubstatus();
08009 substatus[i]->setRandom(density, conformant);
08010 }
08011
08012 return true;
08013 }
08014
08015 bool GeneralSubstatus::setRandom(double density, bool conformant)
08016 {
08017 #ifdef DEBUG_OSRESULT
08018 cout << "Set random GeneralSubstatus" << endl;
08019 #endif
08020 name = "substatus name";
08021 if (OSRand() <= density) description = "random string";
08022 return true;
08023 }
08024
08025
08026 bool OtherResults::setRandom(double density, bool conformant)
08027 {
08028 #ifdef DEBUG_OSRESULT
08029 cout << "Set random OtherResults" << endl;
08030 #endif
08031 int n;
08032
08033 this->numberOfOtherResults = (int)(1+4*OSRand());
08034
08035 if (conformant) n = this->numberOfOtherResults;
08036 else n = (int)(1+4*OSRand());
08037
08038 other = new OtherResult*[n];
08039
08040 for (int i = 0; i < n; i++)
08041 {
08042 other[i] = new OtherResult();
08043 other[i]->setRandom(density, conformant);
08044 }
08045
08046 return true;
08047 }
08048
08049
08050 bool OtherResult::setRandom(double density, bool conformant)
08051 {
08052 #ifdef DEBUG_OSRESULT
08053 cout << "Set random OtherResult" << endl;
08054 #endif
08055 name = "other result";
08056 value = "random string";
08057 description = "random string";
08058 return true;
08059 }
08060
08061
08062 bool SystemResult::setRandom(double density, bool conformant)
08063 {
08064 #ifdef DEBUG_OSRESULT
08065 cout << "Set random SystemResult" << endl;
08066 #endif
08067 if (OSRand() <= density) systemInformation = "random string";
08068
08069 if (OSRand() <= density)
08070 {
08071 availableDiskSpace = new StorageCapacity();
08072 availableDiskSpace->setRandom(density, conformant);
08073 }
08074
08075 if (OSRand() <= density)
08076 {
08077 availableMemory = new StorageCapacity();
08078 availableMemory->setRandom(density, conformant);
08079 }
08080 if (OSRand() <= density)
08081 {
08082 availableCPUSpeed = new CPUSpeed();
08083 availableCPUSpeed->setRandom(density, conformant);
08084 }
08085
08086 if (OSRand() <= density)
08087 {
08088 availableCPUNumber = new CPUNumber();
08089 availableCPUNumber->setRandom(density, conformant);
08090 }
08091
08092 if (OSRand() <= density)
08093 {
08094 otherResults = new OtherResults();
08095 otherResults->setRandom(density, conformant);
08096 }
08097 return true;
08098 }
08099
08100 bool ServiceResult::setRandom(double density, bool conformant)
08101 {
08102 #ifdef DEBUG_OSRESULT
08103 cout << "Set random ServiceResult" << endl;
08104 #endif
08105 if (OSRand() <= density)
08106 {
08107 double temp = OSRand();
08108 if (conformant) temp = 0.5*temp;
08109
08110 if (temp <= 0.25) this->currentState = "unknown";
08111 else if (temp <= 0.50) this->currentState = "busy";
08112 else if (temp <= 0.75) this->currentState = "";
08113 else this->currentState = "known";
08114 }
08115
08116 if (OSRand() <= density) currentJobCount = (int) (-1+4*OSRand());
08117 if (OSRand() <= density) totalJobsSoFar = (int) (-1+4*OSRand());
08118 if (OSRand() <= density) timeServiceStarted = "2010-07-12T01:23:45-03:00";
08119
08120 if (OSRand() <= density)
08121 {
08122 double temp = OSRand();
08123
08124 if (temp <= 0.25) this->serviceUtilization = OSRand();
08125 else if (temp <= 0.50) this->serviceUtilization = -1.0;
08126 else if (temp <= 0.75) this->serviceUtilization = OSDBL_MAX;
08127 else this->serviceUtilization = OSNaN();
08128 }
08129
08130 if (OSRand() <= density)
08131 {
08132 otherResults = new OtherResults();
08133 otherResults->setRandom(density, conformant);
08134 }
08135 return true;
08136 }
08137
08138
08139 bool JobResult::setRandom(double density, bool conformant)
08140 {
08141 #ifdef DEBUG_OSRESULT
08142 cout << "Set random SystemResult" << endl;
08143 #endif
08144 if (OSRand() <= density)
08145 {
08146 double temp = OSRand();
08147 if (conformant) temp = 0.5*temp;
08148
08149 if (temp <= 0.25) this->status = "finished";
08150 else if (temp <= 0.50) this->status = "running";
08151 else if (temp <= 0.75) this->status = "";
08152 else this->status = "walking";
08153 }
08154
08155 if (OSRand() <= density) submitTime = "1970-01-01T00:00:00-00:00";
08156 if (OSRand() <= density) scheduledStartTime = "1970-01-01T00:00:00-00:00";
08157 if (OSRand() <= density) actualStartTime = "1970-01-01T00:00:00-00:00";
08158 if (OSRand() <= density) endTime = "1970-01-01T00:00:00-00:00";
08159
08160 if (OSRand() <= density)
08161 {
08162 timingInformation = new TimingInformation();
08163 timingInformation->setRandom(density, conformant);
08164 }
08165
08166 if (OSRand() <= density)
08167 {
08168 usedDiskSpace = new StorageCapacity();
08169 usedDiskSpace->setRandom(density, conformant);
08170 }
08171
08172 if (OSRand() <= density)
08173 {
08174 usedMemory = new StorageCapacity();
08175 usedMemory->setRandom(density, conformant);
08176 }
08177
08178 if (OSRand() <= density)
08179 {
08180 usedCPUSpeed = new CPUSpeed();
08181 usedCPUSpeed->setRandom(density, conformant);
08182 }
08183
08184 if (OSRand() <= density)
08185 {
08186 usedCPUNumber = new CPUNumber();
08187 usedCPUNumber->setRandom(density, conformant);
08188 }
08189
08190 if (OSRand() <= density)
08191 {
08192 otherResults = new OtherResults();
08193 otherResults->setRandom(density, conformant);
08194 }
08195 return true;
08196 }
08197
08198
08199 bool TimingInformation::setRandom(double density, bool conformant)
08200 {
08201 #ifdef DEBUG_OSRESULT
08202 cout << "Set random TimingInformation" << endl;
08203 #endif
08204 int n;
08205
08206 this->numberOfTimes = (int)(1+4*OSRand());
08207
08208 if (conformant) n = this->numberOfTimes;
08209 else n = (int)(1+4*OSRand());
08210
08211 time = new TimeMeasurement*[n];
08212
08213 for (int i = 0; i < n; i++)
08214 {
08215 time[i] = new TimeMeasurement();
08216 time[i]->setRandom(density, conformant);
08217 }
08218
08219 return true;
08220 }
08221
08222 #if 0
08223 bool Time::setRandom(double density, bool conformant)
08224 {
08225 #ifdef DEBUG_OSRESULT
08226 cout << "Set random TimingInformation" << endl;
08227 #endif
08228 if (OSRand() <= density)
08229 this->description = "random string";
08230
08231 if (OSRand() <= density)
08232 {
08233 double temp = OSRand();
08234 if (conformant) temp = 0.5*temp;
08235
08236 if (temp <= 0.25) this->type = "elapsedTime";
08237 else if (temp <= 0.50) this->type = "cpuTime";
08238 else if (temp <= 0.75) this->type = "";
08239 else this->type = "dinnerTime";
08240 }
08241
08242 if (OSRand() <= density)
08243 {
08244 double temp = OSRand();
08245 if (conformant) temp = 0.5*temp;
08246
08247 if (temp <= 0.25) this->category = "total";
08248 else if (temp <= 0.50) this->category = "input";
08249 else if (temp <= 0.75) this->category = "";
08250 else this->category = "putin";
08251 }
08252
08253 if (OSRand() <= density)
08254 {
08255 double temp = OSRand();
08256 if (conformant) temp = 0.5*temp;
08257
08258 if (temp <= 0.25) this->unit = "second";
08259 else if (temp <= 0.50) this->unit = "tick";
08260 else if (temp <= 0.75) this->unit = "";
08261 else this->unit = "flea";
08262 }
08263
08264 if (OSRand() <= density)
08265 {
08266 if (OSRand() <= 0.5) this->value = 3.14156;
08267 else this->value = 2.71828;
08268 }
08269 return true;
08270 }
08271 #endif
08272
08273
08274 bool TimeMeasurement::setRandom(double density, bool conformant)
08275 {
08276 #ifdef DEBUG_OSRESULT
08277 cout << "Set random TimeMeasurement" << endl;
08278 #endif
08279 if (OSRand() <= density)
08280 this->description = "random string";
08281
08282 if (OSRand() <= density)
08283 {
08284 double temp = OSRand();
08285 if (conformant) temp = 0.5*temp;
08286
08287 if (temp <= 0.25) this->type = "elapsedTime";
08288 else if (temp <= 0.50) this->type = "cpuTime";
08289 else if (temp <= 0.75) this->type = "";
08290 else this->type = "dinnerTime";
08291 }
08292
08293 if (OSRand() <= density)
08294 {
08295 double temp = OSRand();
08296 if (conformant) temp = 0.5*temp;
08297
08298 if (temp <= 0.25) this->category = "total";
08299 else if (temp <= 0.50) this->category = "input";
08300 else if (temp <= 0.75) this->category = "";
08301 else this->category = "putin";
08302 }
08303
08304 if (OSRand() <= density) this->TimeSpan::setRandom(density,conformant);
08305
08306 return true;
08307 }
08308
08309 bool OptimizationResult::setRandom(double density, bool conformant)
08310 {
08311 #ifdef DEBUG_OSRESULT
08312 cout << "Set random OptimizationResult" << endl;
08313 #endif
08314 numberOfSolutions = (int)(1+4*OSRand());
08315
08316 numberOfVariables = 10;
08317 numberOfObjectives = 2;
08318 numberOfConstraints = 5;
08319
08320 int n;
08321
08322 if (conformant) n = this->numberOfSolutions;
08323 else n = (int)(1+4*OSRand());
08324
08325 solution = new OptimizationSolution*[n];
08326
08327 for (int i = 0; i < n; i++)
08328 {
08329 solution[i] = new OptimizationSolution();
08330 solution[i]->setRandom(density,conformant);
08331 }
08332
08333 return true;
08334 }
08335
08336 bool OptimizationSolution::setRandom(double density, bool conformant)
08337 {
08338 #ifdef DEBUG_OSRESULT
08339 cout << "Set random OptimizationSolution" << endl;
08340 #endif
08341 if (OSRand() <= density)
08342 {
08343 if (OSRand() <= density) targetObjectiveIdx = -1;
08344 else targetObjectiveIdx = -2;
08345 }
08346
08347 if (OSRand() <= density) targetObjectiveName = "random string";
08348 if (OSRand() <= density) weightedObjectives = (OSRand() < 0.5);
08349
08350 if (OSRand() <= density) message = "random string";
08351
08352 status = new OptimizationSolutionStatus();
08353 status->setRandom(density, conformant);
08354
08355 if (OSRand() <= density)
08356 {
08357 variables = new VariableSolution();
08358 variables->setRandom(density, conformant);
08359 }
08360
08361 if (OSRand() <= density)
08362 {
08363 objectives = new ObjectiveSolution();
08364 objectives->setRandom(density, conformant);
08365 }
08366
08367 if (OSRand() <= density)
08368 {
08369 constraints = new ConstraintSolution();
08370 constraints->setRandom(density, conformant);
08371 }
08372
08373 if (OSRand() <= density)
08374 {
08375 otherSolutionResults = new OtherSolutionResults();
08376 otherSolutionResults->setRandom(density, conformant);
08377 }
08378
08379 return true;
08380 }
08381
08382
08383 bool OptimizationSolutionStatus::setRandom(double density, bool conformant)
08384 {
08385 #ifdef DEBUG_OSRESULT
08386 cout << "Set random OptimizationSolutionStatus" << endl;
08387 #endif
08388 double temp = OSRand();
08389 if (conformant) temp = 0.5*temp;
08390
08391 if (temp <= 0.25) this->type = "optimal";
08392 else if (temp <= 0.50) this->type = "unsure";
08393 else if (temp <= 0.75) this->type = "";
08394 else this->type = "sure";
08395
08396 if (OSRand() <= density) this->description = "random string";
08397
08398 if (OSRand() <= density)
08399 {
08400 int n;
08401
08402 this->numberOfSubstatuses = (int)(1+4*OSRand());
08403
08404 if (conformant) n = this->numberOfSubstatuses;
08405 else n = (int)(1+4*OSRand());
08406
08407 substatus = new OptimizationSolutionSubstatus*[n];
08408
08409 for (int i = 0; i < n; i++)
08410 {
08411 substatus[i] = new OptimizationSolutionSubstatus();
08412 substatus[i]->setRandom(density, conformant);
08413 }
08414 }
08415
08416 return true;
08417 }
08418
08419
08420 bool OptimizationSolutionSubstatus::setRandom(double density, bool conformant)
08421 {
08422 #ifdef DEBUG_OSRESULT
08423 cout << "Set random OptimizationSolutionSubstatus" << endl;
08424 #endif
08425 double temp = OSRand();
08426 if (conformant) temp = 0.5*temp;
08427
08428 if (temp <= 0.25) this->type = "stoppedByLimit";
08429 else if (temp <= 0.50) this->type = "stoppedByBounds";
08430 else if (temp <= 0.75) this->type = "";
08431 else this->type = "stoppedByPolice";
08432
08433 if (OSRand() <= density) this->description = "random string";
08434
08435 return true;
08436 }
08437
08438
08439 bool VariableSolution::setRandom(double density, bool conformant)
08440 {
08441 #ifdef DEBUG_OSRESULT
08442 cout << "Set random VariableSolution" << endl;
08443 #endif
08444 if (OSRand() <= density)
08445 {
08446 int n;
08447
08448 this->numberOfOtherVariableResults = (int)(1+4*OSRand());
08449
08450 if (conformant) n = this->numberOfOtherVariableResults;
08451 else n = (int)(1+4*OSRand());
08452
08453 other = new OtherVariableResult*[n];
08454
08455 for (int i = 0; i < n; i++)
08456 {
08457 other[i] = new OtherVariableResult();
08458 other[i]->setRandom(density, conformant);
08459 }
08460 }
08461
08462 if (OSRand() <= density)
08463 {
08464 values = new VariableValues();
08465 values->setRandom(density, conformant);
08466 }
08467
08468 if (OSRand() <= density)
08469 {
08470 valuesString = new VariableValuesString();
08471 valuesString->setRandom(density, conformant);
08472 }
08473
08474 if (OSRand() <= density)
08475 {
08476 basisStatus = new BasisStatus();
08477 basisStatus->setRandom(density, conformant, 0, 9);
08478 }
08479
08480 return true;
08481 }
08482
08483 bool VariableValues::setRandom(double density, bool conformant)
08484 {
08485 #ifdef DEBUG_OSRESULT
08486 cout << "Set random VariableValues" << endl;
08487 #endif
08488 int n;
08489
08490 this->numberOfVar = (int)(1+4*OSRand());
08491
08492 if (conformant) n = this->numberOfVar;
08493 else n = (int)(1+4*OSRand());
08494
08495 var = new VarValue*[n];
08496
08497 for (int i = 0; i < n; i++)
08498 {
08499 var[i] = new VarValue();
08500 var[i]->setRandom(density, conformant);
08501 }
08502
08503 return true;
08504 }
08505
08506
08507 bool VarValue::setRandom(double density, bool conformant)
08508 {
08509 #ifdef DEBUG_OSRESULT
08510 cout << "Set random VarValue" << endl;
08511 #endif
08512 this->idx = (10*OSRand());
08513 if (OSRand() <= 0.5) this->value = 3.14156;
08514 else this->value = 2.71828;
08515
08516 if (OSRand() <= density) this->name = "random string";
08517
08518 return true;
08519 }
08520
08521
08522 bool VariableValuesString::setRandom(double density, bool conformant)
08523 {
08524 #ifdef DEBUG_OSRESULT
08525 cout << "Set random VariableValuesString" << endl;
08526 #endif
08527 int n;
08528
08529 this->numberOfVar = (int)(1+4*OSRand());
08530
08531 if (conformant) n = this->numberOfVar;
08532 else n = (int)(1+4*OSRand());
08533
08534 var = new VarValueString*[n];
08535
08536 for (int i = 0; i < n; i++)
08537 {
08538 var[i] = new VarValueString();
08539 var[i]->setRandom(density, conformant);
08540 }
08541
08542 return true;
08543 }
08544
08545
08546 bool VarValueString::setRandom(double density, bool conformant)
08547 {
08548 #ifdef DEBUG_OSRESULT
08549 cout << "Set random VarValueString" << endl;
08550 #endif
08551 this->idx = (10*OSRand());
08552 if (OSRand() <= 0.5) this->value = "random string";
08553 else this->value = "";
08554
08555 if (OSRand() <= density) this->name = "random string";
08556
08557 return true;
08558 }
08559
08560
08561 bool OtherVariableResult::setRandom(double density, bool conformant)
08562 {
08563 #ifdef DEBUG_OSRESULT
08564 cout << "Set random OtherVariableResult" << endl;
08565 #endif
08566 this->name = "random string";
08567 if (OSRand() <= density) this->value = "random string";
08568 if (OSRand() <= density) this->description = "random string";
08569
08570 if (OSRand() <= density)
08571 {
08572 if (OSRand() <= 0.5)
08573 {
08574 int n;
08575
08576 this->numberOfVar = (int)(1+4*OSRand());
08577
08578 if (conformant) n = this->numberOfVar;
08579 else n = (int)(1+4*OSRand());
08580
08581 var = new OtherVarResult*[n];
08582
08583 for (int i = 0; i < n; i++)
08584 {
08585 var[i] = new OtherVarResult();
08586 var[i]->setRandom(density, conformant);
08587 }
08588 }
08589 else
08590 {
08591 int n;
08592
08593 this->numberOfEnumerations = (int)(1+4*OSRand());
08594
08595 if (conformant) n = this->numberOfEnumerations;
08596 else n = (int)(1+4*OSRand());
08597
08598 enumeration = new OtherOptionEnumeration*[n];
08599
08600 for (int i = 0; i < n; i++)
08601 {
08602 enumeration[i] = new OtherOptionEnumeration();
08603 enumeration[i]->setRandom(density, conformant, 0, 9);
08604 }
08605 }
08606 }
08607
08608 return true;
08609 }
08610
08611
08612 bool OtherVarResult::setRandom(double density, bool conformant)
08613 {
08614 #ifdef DEBUG_OSRESULT
08615 cout << "Set random OtherVarResult" << endl;
08616 #endif
08617 this->idx = (10*OSRand());
08618 if (OSRand() <= 0.5) this->value = "random string";
08619 else this->value = "";
08620
08621 if (OSRand() <= density) this->name = "random string";
08622
08623 return true;
08624 }
08625
08626
08627 bool ObjectiveSolution::setRandom(double density, bool conformant)
08628 {
08629 #ifdef DEBUG_OSRESULT
08630 cout << "Set random ObjectiveSolution" << endl;
08631 #endif
08632 if (OSRand() <= density)
08633 {
08634 int n;
08635
08636 this->numberOfOtherObjectiveResults = (int)(1+4*OSRand());
08637
08638 if (conformant) n = this->numberOfOtherObjectiveResults;
08639 else n = (int)(1+4*OSRand());
08640
08641 other = new OtherObjectiveResult*[n];
08642
08643 for (int i = 0; i < n; i++)
08644 {
08645 other[i] = new OtherObjectiveResult();
08646 other[i]->setRandom(density, conformant);
08647 }
08648 }
08649
08650
08651 if (OSRand() <= density)
08652 {
08653 values = new ObjectiveValues();
08654 values->setRandom(density, conformant);
08655 }
08656
08657 if (OSRand() <= density)
08658 {
08659 basisStatus = new BasisStatus();
08660 basisStatus->setRandom(density, conformant, -2, -1);
08661 }
08662
08663 return true;
08664 }
08665
08666
08667 bool ObjectiveValues::setRandom(double density, bool conformant)
08668 {
08669 #ifdef DEBUG_OSRESULT
08670 cout << "Set random ObjectiveValues" << endl;
08671 #endif
08672 int n;
08673
08674 this->numberOfObj = (int)(1+4*OSRand());
08675
08676 if (conformant) n = this->numberOfObj;
08677 else n = (int)(1+4*OSRand());
08678
08679 obj = new ObjValue*[n];
08680
08681 for (int i = 0; i < n; i++)
08682 {
08683 obj[i] = new ObjValue();
08684 obj[i]->setRandom(density, conformant);
08685 }
08686
08687 return true;
08688 }
08689
08690
08691 bool ObjValue::setRandom(double density, bool conformant)
08692 {
08693 #ifdef DEBUG_OSRESULT
08694 cout << "Set random ObjValue" << endl;
08695 #endif
08696 if (OSRand() <= 0.5) this->idx = -1;
08697 else this->idx = -2;
08698
08699 if (OSRand() <= 0.5) this->value = 3.14156;
08700 else this->value = 2.71828;
08701
08702 if (OSRand() <= density) this->name = "random string";
08703
08704 return true;
08705 }
08706
08707
08708 bool OtherObjectiveResult::setRandom(double density, bool conformant)
08709 {
08710 #ifdef DEBUG_OSRESULT
08711 cout << "Set random OtherObjectiveResult" << endl;
08712 #endif
08713 this->name = "random string";
08714 if (OSRand() <= density) this->value = "random string";
08715 if (OSRand() <= density) this->description = "random string";
08716
08717 if (OSRand() <= density)
08718 {
08719 if (OSRand() <= 0.5)
08720 {
08721 int n;
08722
08723 this->numberOfObj = (int)(1+4*OSRand());
08724
08725 if (conformant) n = this->numberOfObj;
08726 else n = (int)(1+4*OSRand());
08727
08728 obj = new OtherObjResult*[n];
08729
08730 for (int i = 0; i < n; i++)
08731 {
08732 obj[i] = new OtherObjResult();
08733 obj[i]->setRandom(density, conformant);
08734 }
08735 }
08736 else
08737 {
08738 int n;
08739
08740 this->numberOfEnumerations = (int)(1+4*OSRand());
08741
08742 if (conformant) n = this->numberOfEnumerations;
08743 else n = (int)(1+4*OSRand());
08744
08745 enumeration = new OtherOptionEnumeration*[n];
08746
08747 for (int i = 0; i < n; i++)
08748 {
08749 enumeration[i] = new OtherOptionEnumeration();
08750 enumeration[i]->setRandom(density, conformant, -2, -1);
08751 }
08752 }
08753 }
08754
08755 return true;
08756 }
08757
08758
08759 bool OtherObjResult::setRandom(double density, bool conformant)
08760 {
08761 #ifdef DEBUG_OSRESULT
08762 cout << "Set random OtherObjResult" << endl;
08763 #endif
08764 if (OSRand() <= 0.5) this->idx = -1;
08765 else this->idx = -2;
08766
08767 if (OSRand() <= 0.5) this->value = "random string";
08768 else this->value = "";
08769
08770 if (OSRand() <= density) this->name = "random string";
08771
08772 return true;
08773 }
08774
08775
08776 bool ConstraintSolution::setRandom(double density, bool conformant)
08777 {
08778 #ifdef DEBUG_OSRESULT
08779 cout << "Set random ConstraintSolution" << endl;
08780 #endif
08781 if (OSRand() <= density)
08782 {
08783 int n;
08784
08785 this->numberOfOtherConstraintResults = (int)(1+4*OSRand());
08786
08787 if (conformant) n = this->numberOfOtherConstraintResults;
08788 else n = (int)(1+4*OSRand());
08789
08790 other = new OtherConstraintResult*[n];
08791
08792 for (int i = 0; i < n; i++)
08793 {
08794 other[i] = new OtherConstraintResult();
08795 other[i]->setRandom(density, conformant);
08796 }
08797 }
08798
08799 if (OSRand() <= density)
08800 {
08801 dualValues = new DualVariableValues();
08802 dualValues->setRandom(density, conformant);
08803 }
08804
08805 if (OSRand() <= density)
08806 {
08807 basisStatus = new BasisStatus();
08808 basisStatus->setRandom(density, conformant, 0 ,4);
08809 }
08810
08811 return true;
08812 }
08813
08814
08815 bool DualVariableValues::setRandom(double density, bool conformant)
08816 {
08817 #ifdef DEBUG_OSRESULT
08818 cout << "Set random DualVariableValues" << endl;
08819 #endif
08820 int n;
08821
08822 this->numberOfCon = (int)(1+4*OSRand());
08823
08824 if (conformant) n = this->numberOfCon;
08825 else n = (int)(1+4*OSRand());
08826
08827 con = new DualVarValue*[n];
08828
08829 for (int i = 0; i < n; i++)
08830 {
08831 con[i] = new DualVarValue();
08832 con[i]->setRandom(density, conformant);
08833 }
08834
08835 return true;
08836 }
08837
08838 bool DualVarValue::setRandom(double density, bool conformant)
08839 {
08840 #ifdef DEBUG_OSRESULT
08841 cout << "Set random DualVarValue" << endl;
08842 #endif
08843 this->idx = (5*OSRand());
08844 if (OSRand() <= 0.5) this->value = 3.14156;
08845 else this->value = 2.71828;
08846
08847 if (OSRand() <= density) this->name = "random string";
08848
08849 return true;
08850 }
08851
08852 bool OtherConstraintResult::setRandom(double density, bool conformant)
08853 {
08854 #ifdef DEBUG_OSRESULT
08855 cout << "Set random OtherConstraintResult" << endl;
08856 #endif
08857 this->name = "random string";
08858 if (OSRand() <= density) this->value = "random string";
08859 if (OSRand() <= density) this->description = "random string";
08860
08861 if (OSRand() <= density)
08862 {
08863 if (OSRand() <= 0.5)
08864 {
08865 int n;
08866
08867 this->numberOfCon = (int)(1+4*OSRand());
08868
08869 if (conformant) n = this->numberOfCon;
08870 else n = (int)(1+4*OSRand());
08871
08872 con = new OtherConResult*[n];
08873
08874 for (int i = 0; i < n; i++)
08875 {
08876 con[i] = new OtherConResult();
08877 con[i]->setRandom(density, conformant);
08878 }
08879 }
08880 else
08881 {
08882 int n;
08883
08884 this->numberOfEnumerations = (int)(1+4*OSRand());
08885
08886 if (conformant) n = this->numberOfEnumerations;
08887 else n = (int)(1+4*OSRand());
08888
08889 enumeration = new OtherOptionEnumeration*[n];
08890
08891 for (int i = 0; i < n; i++)
08892 {
08893 enumeration[i] = new OtherOptionEnumeration();
08894 enumeration[i]->setRandom(density, conformant, 0, 4);
08895 }
08896 }
08897 }
08898
08899 return true;
08900 }
08901
08902
08903 bool OtherConResult::setRandom(double density, bool conformant)
08904 {
08905 #ifdef DEBUG_OSRESULT
08906 cout << "Set random OtherConResult" << endl;
08907 #endif
08908 this->idx = (5*OSRand());
08909 if (OSRand() <= 0.5) this->value = "random string";
08910 else this->value = "";
08911
08912 if (OSRand() <= density) this->name = "random string";
08913
08914 return true;
08915 }
08916
08917
08918 bool OtherSolutionResults::setRandom(double density, bool conformant)
08919 {
08920 #ifdef DEBUG_OSRESULT
08921 cout << "Set random OtherSolutionResults" << endl;
08922 #endif
08923 numberOfOtherSolutionResults = (int)(4*OSRand());
08924
08925 int n;
08926
08927 if (conformant) n = this->numberOfOtherSolutionResults;
08928 else n = (int)(4*OSRand());
08929
08930 otherSolutionResult = new OtherSolutionResult*[n];
08931
08932 for (int i = 0; i < n; i++)
08933 {
08934 otherSolutionResult[i] = new OtherSolutionResult();
08935 otherSolutionResult[i]->setRandom(density, conformant);
08936 }
08937
08938 return true;
08939 }
08940
08941 bool OtherSolutionResult::setRandom(double density, bool conformant)
08942 {
08943 #ifdef DEBUG_OSRESULT
08944 cout << "Set random OtherSolutionResult" << endl;
08945 #endif
08946 name = "random string";
08947 numberOfItems = (int) (4*OSRand());
08948
08949 if (OSRand() <= density) category = "random string";
08950 if (OSRand() <= density) description = "random string";
08951
08952 int n;
08953
08954 if (conformant) n = this->numberOfItems;
08955 else n = (int)(1+4*OSRand());
08956
08957 if (n > 0 || OSRand() <= density)
08958 {
08959 item = new std::string[n];
08960
08961 for (int i = 0; i < n; i++)
08962 item[i] = "random string";
08963 }
08964
08965 return true;
08966 }
08967
08968
08969 bool OtherSolverOutput::setRandom(double density, bool conformant)
08970 {
08971 #ifdef DEBUG_OSRESULT
08972 cout << "Set random OtherSolverOutput" << endl;
08973 #endif
08974 int n;
08975
08976 this->numberOfSolverOutputs = (int)(1+4*OSRand());
08977
08978 if (conformant) n = this->numberOfSolverOutputs;
08979 else n = (int)(1+4*OSRand());
08980
08981 solverOutput = new SolverOutput*[n];
08982
08983 for (int i = 0; i < n; i++)
08984 {
08985 solverOutput[i] = new SolverOutput();
08986 solverOutput[i]->setRandom(density, conformant);
08987 }
08988
08989 return true;
08990 }
08991
08992
08993 bool SolverOutput::setRandom(double density, bool conformant)
08994 {
08995 #ifdef DEBUG_OSRESULT
08996 cout << "Set random SolverOutput" << endl;
08997 #endif
08998 name = "random string";
08999 numberOfItems = (int) (4*OSRand());
09000
09001 if (OSRand() <= density) category = "random string";
09002 if (OSRand() <= density) description = "random string";
09003
09004 int n;
09005
09006 if (conformant) n = this->numberOfItems;
09007 else n = (int)(1+4*OSRand());
09008
09009 if (n > 0 || OSRand() <= density)
09010 {
09011 item = new std::string[n];
09012
09013 for (int i = 0; i < n; i++)
09014 item[i] = "random string";
09015 }
09016
09017 return true;
09018 }