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