00001
00018 #include "OSResult.h"
00019 #include "OSParameters.h"
00020 #include "OSErrorClass.h"
00021 #include "OSGeneral.h"
00022 #include "OSParameters.h"
00023 #include "OSMathUtil.h"
00024
00025 #include<iostream>
00026 #include<sstream>
00027
00028
00029
00030
00031
00032
00033
00034 using namespace std;
00035
00041 GeneralSubstatus::GeneralSubstatus():
00042 name( ""),
00043 description( "")
00044 {
00045 #ifdef DEBUG_OSRESULT
00046 cout << "Inside the GeneralSubstatus Constructor" << endl;
00047 #endif
00048 }
00049
00050 GeneralSubstatus::~GeneralSubstatus(){
00051 #ifdef DEBUG_OSRESULT
00052 cout << "Inside the GeneralSubstatus Destructor" << endl;
00053 #endif
00054 }
00055
00056
00057 GeneralStatus::GeneralStatus():
00058 numberOfSubstatuses (0),
00059 type( ""),
00060 description( ""),
00061 substatus (NULL)
00062 {
00063 #ifdef DEBUG_OSRESULT
00064 cout << "Inside the GeneralStatus Constructor" << endl;
00065 #endif
00066 }
00067
00068 GeneralStatus::~GeneralStatus(){
00069 #ifdef DEBUG_OSRESULT
00070 cout << "Inside the GeneralStatus Destructor" << endl;
00071 #endif
00072 if (substatus != NULL)
00073 { for (int i = 0; i < numberOfSubstatuses; i++)
00074 {
00075 delete substatus[i];
00076 substatus[i] = NULL;
00077 }
00078 delete[] substatus;
00079 substatus = NULL;
00080 }
00081 }
00082
00083
00084 OtherResult::OtherResult():
00085 name( ""),
00086 value( ""),
00087 description( "")
00088 {
00089 #ifdef DEBUG_OSRESULT
00090 cout << "Inside the OtherResult Constructor" << endl;
00091 #endif
00092 }
00093
00094 OtherResult::~OtherResult()
00095 {
00096 #ifdef DEBUG_OSRESULT
00097 cout << "Inside the OtherResult Destructor" << endl;
00098 #endif
00099 }
00100
00101
00102 OtherResults::OtherResults():
00103 numberOfOtherResults( 0),
00104 other( NULL)
00105 {
00106 #ifdef DEBUG_OSRESULT
00107 cout << "Inside the OtherResults Constructor" << endl;
00108 #endif
00109 }
00110
00111 OtherResults::~OtherResults()
00112 {
00113 #ifdef DEBUG_OSRESULT
00114 cout << "Inside the OtherResults Destructor" << endl;
00115 #endif
00116 if (other != NULL)
00117 { for (int i = 0; i < numberOfOtherResults; i++)
00118 {
00119 delete other[i];
00120 other[i] = NULL;
00121 }
00122 delete[] other;
00123 other = NULL;
00124 }
00125 }
00126
00127
00128 GeneralResult::GeneralResult():
00129 generalStatus(NULL),
00130 message(""),
00131 serviceURI(""),
00132 serviceName(""),
00133 instanceName(""),
00134 jobID(""),
00135 solverInvoked(""),
00136 timeStamp(""),
00137 otherResults(NULL)
00138 {
00139 #ifdef DEBUG_OSRESULT
00140 cout << "Inside the GeneralResult Constructor" << endl;
00141 #endif
00142 }
00143
00144
00145 GeneralResult::~GeneralResult(){
00146 #ifdef DEBUG_OSRESULT
00147 cout << "GeneralResult Destructor Called" << endl;
00148 #endif
00149 if (generalStatus != NULL)
00150 { delete generalStatus;
00151 generalStatus = NULL;
00152 }
00153 if (otherResults != NULL)
00154 { delete otherResults;
00155 otherResults = NULL;
00156 }
00157 }
00158
00159
00160 DiskSpace::DiskSpace():
00161 unit( "byte"),
00162 description( ""),
00163 value( 0.0)
00164 {
00165 #ifdef DEBUG_OSRESULT
00166 cout << "Inside the DiskSpace Constructor" << endl;
00167 #endif
00168 }
00169
00170 DiskSpace::~DiskSpace()
00171 {
00172 #ifdef DEBUG_OSRESULT
00173 cout << "Inside the DiskSpace Destructor" << endl;
00174 #endif
00175 }
00176
00177
00178
00179 MemorySize::MemorySize():
00180 unit( "byte"),
00181 description( ""),
00182 value( 0.0)
00183 {
00184 #ifdef DEBUG_OSRESULT
00185 cout << "Inside the MemorySize Constructor" << endl;
00186 #endif
00187 }
00188
00189 MemorySize::~MemorySize()
00190 {
00191 #ifdef DEBUG_OSRESULT
00192 cout << "Inside the MemorySize Destructor" << endl;
00193 #endif
00194 }
00195
00196
00197 CPUSpeed::CPUSpeed():
00198 unit( "hertz"),
00199 description( ""),
00200 value( 0.0)
00201 {
00202 #ifdef DEBUG_OSRESULT
00203 cout << "Inside the CPUSpeed Constructor" << endl;
00204 #endif
00205 }
00206
00207 CPUSpeed::~CPUSpeed()
00208 {
00209 #ifdef DEBUG_OSRESULT
00210 cout << "Inside the CPUSpeed Destructor" << endl;
00211 #endif
00212 }
00213
00214
00215 CPUNumber::CPUNumber():
00216 description( ""),
00217 value( 1)
00218 {
00219 #ifdef DEBUG_OSRESULT
00220 cout << "Inside the CPUNumber Constructor" << endl;
00221 #endif
00222 }
00223
00224 CPUNumber::~CPUNumber()
00225 {
00226 #ifdef DEBUG_OSRESULT
00227 cout << "Inside the CPUNumber Destructor" << endl;
00228 #endif
00229 }
00230
00231
00232 SystemResult::SystemResult():
00233 systemInformation(""),
00234 availableDiskSpace(NULL),
00235 availableMemory(NULL),
00236 availableCPUSpeed(NULL),
00237 availableCPUNumber(NULL),
00238 otherResults(NULL)
00239 {
00240 #ifdef DEBUG_OSRESULT
00241 cout << "Inside the SystemResult Constructor" << endl;
00242 #endif
00243 }
00244
00245
00246 SystemResult::~SystemResult(){
00247 #ifdef DEBUG_OSRESULT
00248 cout << "SystemResult Destructor Called" << endl;
00249 #endif
00250 if (availableDiskSpace != NULL)
00251 { delete availableDiskSpace;
00252 availableDiskSpace = NULL;
00253 }
00254 if (availableMemory != NULL)
00255 { delete availableMemory;
00256 availableMemory = NULL;
00257 }
00258 if (availableCPUSpeed != NULL)
00259 { delete availableCPUSpeed;
00260 availableCPUSpeed = NULL;
00261 }
00262 if (availableCPUNumber != NULL)
00263 { delete availableCPUNumber;
00264 availableCPUNumber = NULL;
00265 }
00266 if (otherResults != NULL)
00267 { delete otherResults;
00268 otherResults = NULL;
00269 }
00270 }
00271
00272
00273 ServiceResult::ServiceResult():
00274 currentState("unknown"),
00275 currentJobCount(-1),
00276 totalJobsSoFar(-1),
00277 timeServiceStarted("1970-01-01T00:00:00-00:00"),
00278 serviceUtilization(-1.0),
00279 otherResults(NULL)
00280 {
00281 #ifdef DEBUG_OSRESULT
00282 cout << "Inside the ServiceResult Constructor" << endl;
00283 #endif
00284 }
00285
00286
00287 ServiceResult::~ServiceResult(){
00288 #ifdef DEBUG_OSRESULT
00289 cout << "ServiceResult Destructor Called" << endl;
00290 #endif
00291 if (otherResults != NULL)
00292 { delete otherResults;
00293 otherResults = NULL;
00294 }
00295 }
00296
00297
00298 Time::Time():
00299 type("elapsedTime"),
00300 category("total"),
00301 unit("second"),
00302 description(""),
00303 value(0.0)
00304 {
00305 #ifdef DEBUG_OSRESULT
00306 cout << "Inside the Time Constructor" << endl;
00307 #endif
00308 }
00309
00310
00311 Time::~Time(){
00312 #ifdef DEBUG_OSRESULT
00313 cout << "Inside the Time Destructor" << endl;
00314 #endif
00315
00316 }
00317
00318
00319 TimingInformation::TimingInformation():
00320 numberOfTimes(0),
00321 time(NULL)
00322 {
00323 #ifdef DEBUG_OSRESULT
00324 cout << "Inside the TimingInformation Constructor" << endl;
00325 #endif
00326 }
00327
00328
00329 TimingInformation::~TimingInformation(){
00330 #ifdef DEBUG_OSRESULT
00331 cout << "Inside the TimingInformation Destructor" << endl;
00332 #endif
00333 if (time != NULL)
00334 {
00335 for (int i = 0; i < numberOfTimes; i++)
00336 { delete time[i];
00337 time[i] = NULL;
00338 }
00339 delete[] time;
00340 time = NULL;
00341 }
00342 }
00343
00344 JobResult::JobResult():
00345 status("finished"),
00346 submitTime("1970-01-01T00:00:00-00:00"),
00347 scheduledStartTime("1970-01-01T00:00:00-00:00"),
00348 actualStartTime("1970-01-01T00:00:00-00:00"),
00349 endTime("1970-01-01T00:00:00-00:00"),
00350 timingInformation(NULL),
00351 usedDiskSpace(NULL),
00352 usedMemory(NULL),
00353 usedCPUSpeed(NULL),
00354 usedCPUNumber(NULL),
00355 otherResults(NULL)
00356 {
00357 #ifdef DEBUG_OSRESULT
00358 cout << "Inside the JobResult Constructor" << endl;
00359 #endif
00360 timingInformation = NULL;
00361 }
00362
00363
00364 JobResult::~JobResult(){
00365 #ifdef DEBUG_OSRESULT
00366 cout << "Inside the JobResult Destructor" << endl;
00367 #endif
00368 if (timingInformation != NULL)
00369 { delete timingInformation;
00370 timingInformation = NULL;
00371 }
00372 if (usedDiskSpace != NULL)
00373 { delete usedDiskSpace;
00374 usedDiskSpace = NULL;
00375 }
00376 if (usedMemory != NULL)
00377 { delete usedMemory;
00378 usedMemory = NULL;
00379 }
00380 if (usedCPUSpeed != NULL)
00381 { delete usedCPUSpeed;
00382 usedCPUSpeed = NULL;
00383 }
00384 if (usedCPUNumber != NULL)
00385 { delete usedCPUNumber;
00386 usedCPUNumber = NULL;
00387 }
00388 if (otherResults != NULL)
00389 { delete otherResults;
00390 otherResults = NULL;
00391 }
00392 }
00393
00394
00395 OptimizationSolutionSubstatus::OptimizationSolutionSubstatus():
00396 type(""),
00397 description("")
00398 {
00399 #ifdef DEBUG_OSRESULT
00400 cout << "Inside the OptimizationSolutionSubstatus Constructor" << endl;
00401 #endif
00402 }
00403
00404
00405 OptimizationSolutionSubstatus::~OptimizationSolutionSubstatus(){
00406 #ifdef DEBUG_OSRESULT
00407 cout << "Inside the OptimizationSolutionSubstatus Destructor" << endl;
00408 #endif
00409 }
00410
00411
00412 OptimizationSolutionStatus::OptimizationSolutionStatus():
00413 numberOfSubstatuses(0),
00414 type(""),
00415 description(""),
00416 substatus(NULL)
00417 {
00418 #ifdef DEBUG_OSRESULT
00419 cout << "Inside the OptimizationSolutionStatus Constructor" << endl;
00420 #endif
00421 }
00422
00423
00424 OptimizationSolutionStatus::~OptimizationSolutionStatus(){
00425 #ifdef DEBUG_OSRESULT
00426 cout << "Inside the OptimizationSolutionStatus Destructor" << endl;
00427 #endif
00428 if (substatus != NULL)
00429 {
00430 for (int i = 0; i < numberOfSubstatuses; i++)
00431 { delete substatus[i];
00432 substatus[i] = NULL;
00433 }
00434 delete[] substatus;
00435 substatus = NULL;
00436 }
00437 }
00438
00439
00440 VarValue::VarValue():
00441 idx( -1),
00442 value( 0)
00443 {
00444 #ifdef DEBUG_OSRESULT
00445 cout << "Inside the VarValue Constructor" << endl;
00446 #endif
00447 }
00448
00449
00450 VarValue::~VarValue(){
00451 #ifdef DEBUG_OSRESULT
00452 cout << "Inside the VarValue Destructor" << endl;
00453 #endif
00454 }
00455
00456
00457
00458 VariableValues::VariableValues():
00459 numberOfVar(0),
00460 var(NULL)
00461 {
00462 #ifdef DEBUG_OSRESULT
00463 cout << "Inside the VariableValues Constructor" << endl;
00464 #endif
00465 }
00466
00467
00468 VariableValues::~VariableValues(){
00469 #ifdef DEBUG_OSRESULT
00470 cout << "Inside the VariableValues Destructor" << endl;
00471 #endif
00472 if(var != NULL)
00473 { for(int i = 0; i < numberOfVar; i++)
00474 {
00475 delete var[i];
00476 var[i] = NULL;
00477 }
00478 delete[] var;
00479 var = NULL;
00480 }
00481 }
00482
00483
00484 VarValueString::VarValueString():
00485 idx( -1),
00486 value( "")
00487 {
00488 #ifdef DEBUG_OSRESULT
00489 cout << "Inside the VarValueString Constructor" << endl;
00490 #endif
00491 }
00492
00493
00494 VarValueString::~VarValueString(){
00495 #ifdef DEBUG_OSRESULT
00496 cout << "Inside the VarValueString Destructor" << endl;
00497 #endif
00498 }
00499
00500
00501
00502 VariableValuesString::VariableValuesString():
00503 numberOfVar(0),
00504 var(NULL)
00505 {
00506 #ifdef DEBUG_OSRESULT
00507 cout << "Inside the VariableValuesString Constructor" << endl;
00508 #endif
00509 }
00510
00511
00512 VariableValuesString::~VariableValuesString(){
00513 #ifdef DEBUG_OSRESULT
00514 cout << "Inside the VariableValuesString Destructor" << endl;
00515 #endif
00516 if(var != NULL)
00517 { for(int i = 0; i < numberOfVar; i++)
00518 {
00519 delete var[i];
00520 var[i] = NULL;
00521 }
00522 delete[] var;
00523 var = NULL;
00524 }
00525 }
00526
00527
00528 OtherVarResult::OtherVarResult():
00529 idx( -1),
00530 value( "")
00531 {
00532 #ifdef DEBUG_OSRESULT
00533 cout << "Inside the OtherVarResult Constructor" << endl;
00534 #endif
00535 }
00536
00537
00538 OtherVarResult::~OtherVarResult(){
00539 #ifdef DEBUG_OSRESULT
00540 cout << "Inside the OtherVarResult Destructor" << endl;
00541 #endif
00542 }
00543
00544
00545
00546 OtherVariableResult::OtherVariableResult():
00547 numberOfVar(0),
00548 numberOfEnumerations(0),
00549 name(""),
00550 value(""),
00551 description(""),
00552 var(NULL),
00553 enumeration(NULL)
00554 {
00555 #ifdef DEBUG_OSRESULT
00556 cout << "Inside the OtherVariableResult Constructor" << endl;
00557 #endif
00558
00559 }
00560
00561
00562 OtherVariableResult::~OtherVariableResult(){
00563 #ifdef DEBUG_OSRESULT
00564 cout << "Inside the OtherVariableResult Destructor" << endl;
00565 #endif
00566 if (var != NULL)
00567 { for(int i = 0; i < numberOfVar; i++){
00568 delete var[i];
00569 var[i] = NULL;
00570 }
00571 delete[] var;
00572 var = NULL;
00573 }
00574 if (enumeration != NULL)
00575 { for(int i = 0; i < numberOfEnumerations; i++){
00576 delete enumeration[i];
00577 enumeration[i] = NULL;
00578 }
00579 delete[] enumeration;
00580 enumeration = NULL;
00581 }
00582 #ifdef DEBUG_OSRESULT
00583 cout << "Inside the OtherVariableResult Destructor - Done" << endl;
00584 #endif
00585 }
00586
00587
00588 VariableSolution::VariableSolution():
00589 numberOfOtherVariableResults( 0),
00590 values( NULL),
00591 valuesString( NULL),
00592 basisStatus(NULL),
00593 other( NULL)
00594 {
00595 #ifdef DEBUG_OSRESULT
00596 cout << "Inside the VariableSolution Constructor" << endl;
00597 #endif
00598 }
00599
00600
00601 VariableSolution::~VariableSolution(){
00602 #ifdef DEBUG_OSRESULT
00603 cout << "Inside the VariableSolution Destructor" << endl;
00604 #endif
00605 if (values != NULL)
00606 { delete values;
00607 values = NULL;
00608 }
00609 if (valuesString != NULL)
00610 { delete valuesString;
00611 valuesString = NULL;
00612 }
00613 if (basisStatus != NULL)
00614 { delete basisStatus;
00615 basisStatus = NULL;
00616 }
00617 if(numberOfOtherVariableResults > 0 && other != NULL){
00618 for(int i = 0; i < numberOfOtherVariableResults; i++){
00619 delete other[i];
00620 other[i] = NULL;
00621 }
00622 delete[] other;
00623 other = NULL;
00624 }
00625 }
00626
00627
00628
00629 ObjValue::ObjValue():
00630 idx( -1),
00631 value(0.0)
00632
00633 {
00634 #ifdef DEBUG_OSRESULT
00635 cout << "Inside the ObjValue Constructor" << endl;
00636 #endif
00637 }
00638
00639 ObjValue::~ObjValue(){
00640 #ifdef DEBUG_OSRESULT
00641 cout << "Inside the ObjValue Destructor" << endl;
00642 #endif
00643 }
00644
00645
00646
00647 ObjectiveValues::ObjectiveValues():
00648 numberOfObj(0),
00649 obj(NULL)
00650 {
00651 #ifdef DEBUG_OSRESULT
00652 cout << "Inside the ObjectiveValues Constructor" << endl;
00653 #endif
00654
00655 }
00656
00657
00658 ObjectiveValues::~ObjectiveValues(){
00659 #ifdef DEBUG_OSRESULT
00660 cout << "Inside the ObjectiveValues Destructor" << endl;
00661 #endif
00662 if((obj != NULL) && (numberOfObj > 0) ){
00663 for(int i = 0; i < numberOfObj; i++){
00664 delete obj[i];
00665 obj[i] = NULL;
00666 }
00667 delete[] obj;
00668 obj = NULL;
00669 }
00670 }
00671
00672
00673 OtherObjResult::OtherObjResult():
00674 idx(-1),
00675 value( "")
00676 {
00677 #ifdef DEBUG_OSRESULT
00678 cout << "Inside the OtherObjResult Constructor" << endl;
00679 #endif
00680 }
00681
00682
00683 OtherObjResult::~OtherObjResult(){
00684 #ifdef DEBUG_OSRESULT
00685 cout << "Inside the OtherObjResult Destructor" << endl;
00686 #endif
00687 }
00688
00689
00690 OtherObjectiveResult::OtherObjectiveResult():
00691 numberOfObj(0),
00692 numberOfEnumerations(0),
00693 name(""),
00694 value(""),
00695 description(""),
00696 obj(NULL),
00697 enumeration(NULL)
00698 {
00699 #ifdef DEBUG_OSRESULT
00700 cout << "Inside the OtherObjectiveResult Constructor" << endl;
00701 #endif
00702 }
00703
00704
00705 OtherObjectiveResult::~OtherObjectiveResult(){
00706 #ifdef DEBUG_OSRESULT
00707 cout << "Inside the OtherObjectiveResult Destructor" << endl;
00708 #endif
00709 if(obj != NULL) {
00710 for(int i = 0; i < numberOfObj; i++){
00711 delete obj[i];
00712 obj[i] = NULL;
00713 }
00714 delete[] obj;
00715 obj = NULL;
00716 }
00717 }
00718
00719
00720 ObjectiveSolution::ObjectiveSolution():
00721 numberOfOtherObjectiveResults( 0),
00722 values( NULL),
00723 basisStatus(NULL),
00724 other( NULL)
00725 {
00726 #ifdef DEBUG_OSRESULT
00727 cout << "Inside the ObjectiveSolution Constructor" << endl;
00728 #endif
00729 }
00730
00731
00732 ObjectiveSolution::~ObjectiveSolution(){
00733 #ifdef DEBUG_OSRESULT
00734 cout << "Inside the ObjectiveSolution Destructor" << endl;
00735 #endif
00736 if (values != NULL)
00737 { delete values;
00738 values = NULL;
00739 }
00740 if (basisStatus != NULL)
00741 { delete basisStatus;
00742 basisStatus = NULL;
00743 }
00744 if(numberOfOtherObjectiveResults > 0 && other != NULL){
00745 for(int i = 0; i < numberOfOtherObjectiveResults; i++){
00746 delete other[i];
00747 other[i] = NULL;
00748 }
00749 delete[] other;
00750 other = NULL;
00751 }
00752 }
00753
00754
00755 DualVarValue::DualVarValue():
00756 idx( -1),
00757
00758
00759 value( 0)
00760 {
00761 #ifdef DEBUG_OSRESULT
00762 cout << "Inside the DualVarValue Constructor" << endl;
00763 #endif
00764 }
00765
00766
00767 DualVarValue::~DualVarValue(){
00768 #ifdef DEBUG_OSRESULT
00769 cout << "Inside the DualVarValue Destructor" << endl;
00770 #endif
00771 }
00772
00773
00774 DualVariableValues::DualVariableValues():
00775 numberOfCon(0),
00776 con(NULL)
00777 {
00778 #ifdef DEBUG_OSRESULT
00779 cout << "Inside the DualVariableValues Constructor" << endl;
00780 #endif
00781
00782 }
00783
00784
00785 DualVariableValues::~DualVariableValues(){
00786 #ifdef DEBUG_OSRESULT
00787 cout << "Inside the DualVariableValues Destructor" << endl;
00788 #endif
00789 if (con != NULL){
00790 for(int i = 0; i < numberOfCon; i++){
00791 delete con[i];
00792 con[i] = NULL;
00793 }
00794 delete[] con;
00795 con = NULL;
00796 }
00797 }
00798
00799
00800 OtherConResult::OtherConResult():
00801 idx( -1),
00802 value( "")
00803 {
00804 #ifdef DEBUG_OSRESULT
00805 cout << "Inside the OtherConResult Constructor" << endl;
00806 #endif
00807 }
00808
00809
00810 OtherConResult::~OtherConResult(){
00811 #ifdef DEBUG_OSRESULT
00812 cout << "Inside the OtherConResult Destructor" << endl;
00813 #endif
00814 }
00815
00816
00817
00818 OtherConstraintResult::OtherConstraintResult():
00819 numberOfCon(0),
00820 numberOfEnumerations(0),
00821 name(""),
00822 value(""),
00823 description(""),
00824 con(NULL),
00825 enumeration(NULL)
00826 {
00827 #ifdef DEBUG_OSRESULT
00828 cout << "Inside the OtherConstraintResult Constructor" << endl;
00829 #endif
00830 }
00831
00832
00833 OtherConstraintResult::~OtherConstraintResult(){
00834 #ifdef DEBUG_OSRESULT
00835 cout << "Inside the OtherConstraintResult Destructor" << endl;
00836 #endif
00837 if (con != NULL){
00838 for(int i = 0; i < numberOfCon; i++){
00839 delete con[i];
00840 con[i] = NULL;
00841 }
00842 delete[] con;
00843 con = NULL;
00844 }
00845 }
00846
00847
00848
00849 ConstraintSolution::ConstraintSolution():
00850 numberOfOtherConstraintResults( 0),
00851 dualValues( NULL),
00852 basisStatus(NULL),
00853 other( NULL)
00854 {
00855 #ifdef DEBUG_OSRESULT
00856 cout << "Inside the ConstraintSolution Constructor" << endl;
00857 #endif
00858 }
00859
00860
00861 ConstraintSolution::~ConstraintSolution(){
00862 #ifdef DEBUG_OSRESULT
00863 cout << "Inside the ConstraintSolution Destructor" << endl;
00864 #endif
00865 if (dualValues != NULL)
00866 { delete dualValues;
00867 dualValues = NULL;
00868 }
00869 if (basisStatus != NULL)
00870 { delete basisStatus;
00871 basisStatus = NULL;
00872 }
00873 if(numberOfOtherConstraintResults > 0 && other != NULL){
00874 for(int i = 0; i < numberOfOtherConstraintResults; i++){
00875 delete other[i];
00876 other[i] = NULL;
00877 }
00878 delete[] other;
00879 other = NULL;
00880 }
00881 }
00882
00883
00884
00885 OtherSolutionResult::OtherSolutionResult():
00886 name( ""),
00887 category (""),
00888 description (""),
00889 numberOfItems (0),
00890 item( NULL)
00891 {
00892 #ifdef DEBUG_OSRESULT
00893 cout << "Inside the OtherSolutionResult Constructor" << endl;
00894 #endif
00895 }
00896
00897
00898 OtherSolutionResult::~OtherSolutionResult(){
00899 #ifdef DEBUG_OSRESULT
00900 cout << "Inside the OtherSolutionResult Destructor" << endl;
00901 #endif
00902 if (item != NULL)
00903 {
00904
00905
00906
00907 delete[] item;
00908 item = NULL;
00909 }
00910 }
00911
00912
00913
00914 OtherSolutionResults::OtherSolutionResults():
00915 numberOfOtherSolutionResults( 0),
00916 otherSolutionResult( NULL)
00917 {
00918 #ifdef DEBUG_OSRESULT
00919 cout << "Inside the OtherSolutionResults Constructor" << endl;
00920 #endif
00921 }
00922
00923
00924 OtherSolutionResults::~OtherSolutionResults(){
00925 #ifdef DEBUG_OSRESULT
00926 cout << "Inside the OtherSolutionResults Destructor" << endl;
00927 #endif
00928 if(numberOfOtherSolutionResults > 0 && otherSolutionResult != NULL){
00929 for(int i = 0; i < numberOfOtherSolutionResults; i++){
00930 delete otherSolutionResult[i];
00931 otherSolutionResult[i] = NULL;
00932 }
00933 delete[] otherSolutionResult;
00934 otherSolutionResult = NULL;
00935 }
00936 }
00937
00938
00939
00940 OptimizationSolution::OptimizationSolution():
00941 targetObjectiveIdx( -1),
00942 weightedObjectives(false),
00943 status(NULL),
00944 message( ""),
00945 variables( NULL),
00946 objectives( NULL),
00947 constraints( NULL),
00948 otherSolutionResults( NULL)
00949
00950 {
00951 #ifdef DEBUG_OSRESULT
00952 cout << "Inside the OptimizationSolution Constructor" << endl;
00953 #endif
00954 }
00955
00956
00957 OptimizationSolution::~OptimizationSolution(){
00958 #ifdef DEBUG_OSRESULT
00959 cout << "Inside the OptimzationSolution Destructor" << endl;
00960 #endif
00961 if(status != NULL){
00962 delete status;
00963 status = NULL;
00964 }
00965 if(variables != NULL){
00966 delete variables;
00967 variables = NULL;
00968 }
00969 if(constraints != NULL) {
00970 delete constraints;
00971 constraints = NULL;
00972 }
00973 if(objectives != NULL){
00974 delete objectives;
00975 objectives = NULL;
00976 }
00977 if(otherSolutionResults != NULL){
00978 delete otherSolutionResults;
00979 otherSolutionResults = NULL;
00980 }
00981 }
00982
00983
00984 SolverOutput::SolverOutput():
00985 name( ""),
00986 category (""),
00987 description (""),
00988 numberOfItems (0),
00989 item( NULL)
00990 {
00991 #ifdef DEBUG_OSRESULT
00992 cout << "Inside the SolverOutput Constructor" << endl;
00993 #endif
00994 }
00995
00996
00997 SolverOutput::~SolverOutput(){
00998 #ifdef DEBUG_OSRESULT
00999 cout << "Inside the SolverOutput Destructor" << endl;
01000 #endif
01001 if (item != NULL)
01002 {
01003
01004
01005
01006 delete[] item;
01007 item = NULL;
01008 }
01009 }
01010
01011
01012
01013 OtherSolverOutput::OtherSolverOutput():
01014 numberOfSolverOutputs(0),
01015 solverOutput(NULL)
01016 {
01017 #ifdef DEBUG_OSRESULT
01018 cout << "Inside the OtherSolverOutput Constructor" << endl;
01019 #endif
01020
01021 }
01022
01023
01024 OtherSolverOutput::~OtherSolverOutput(){
01025 #ifdef DEBUG_OSRESULT
01026 cout << "Inside the OtherSolverOutput Destructor" << endl;
01027 #endif
01028 if (solverOutput != NULL){
01029 for(int i = 0; i < numberOfSolverOutputs; i++){
01030 delete solverOutput[i];
01031 solverOutput[i] = NULL;
01032 }
01033 delete[] solverOutput;
01034 solverOutput = NULL;
01035 }
01036 }
01037
01038
01039
01040 OptimizationResult::OptimizationResult():
01041 numberOfSolutions( -1),
01042 numberOfVariables( -1),
01043 numberOfObjectives( -1),
01044 numberOfConstraints(-1),
01045 solution(NULL),
01046 otherSolverOutput(NULL)
01047 {
01048 #ifdef DEBUG_OSRESULT
01049 cout << "Inside the OptimizationResult Constructor" << endl;
01050 #endif
01051 }
01052
01053
01054 OptimizationResult::~OptimizationResult(){
01055 #ifdef DEBUG_OSRESULT
01056 cout << "OptimizationResult Destructor Called" << endl;
01057 #endif
01058 if( solution != NULL){
01059 for(int i = 0; i < this->numberOfSolutions; i++){
01060 delete solution[i];
01061 solution[i] = NULL;
01062 #ifdef DEBUG_OSRESULT
01063 cout << "Deleting Solution: " << i << endl;
01064 #endif
01065 }
01066 delete[] solution;
01067 solution = NULL;
01068 if( otherSolverOutput != NULL){
01069 delete otherSolverOutput;
01070 otherSolverOutput = NULL;
01071 }
01072 }
01073 }
01074
01075
01076 OSResult::OSResult():
01077 m_iVariableNumber( -1),
01078 m_iObjectiveNumber( -1),
01079 m_iConstraintNumber( -1),
01080 m_iNumberOfOtherVariableResults( -1),
01081 m_mdPrimalValues( NULL),
01082 m_mdDualValues( NULL)
01083
01084 {
01085 #ifdef DEBUG_OSRESULT
01086 cout << "Inside the OSResult Constructor" << endl;
01087 #endif
01088 this->general = new GeneralResult();
01089 this->system = new SystemResult();
01090 this->service = new ServiceResult();
01091 this->job = new JobResult();
01092 this->optimization = new OptimizationResult();
01093 }
01094
01095 OSResult::~OSResult(){
01096 #ifdef DEBUG_OSRESULT
01097 cout << "OSResult Destructor Called" << endl;
01098 #endif
01099
01100
01101 if(general != NULL) delete general;
01102 general = NULL;
01103
01104 if(system != NULL) delete system;
01105 system = NULL;
01106
01107 if(service != NULL) delete service;
01108 service = NULL;
01109
01110 if(job != NULL) delete job;
01111 job = NULL;
01112
01113 if(optimization != NULL) delete optimization;
01114 optimization = NULL;
01115
01116 int k;
01117
01118 if(m_mdPrimalValues != NULL) delete[] m_mdPrimalValues;
01119 m_mdPrimalValues = 0;
01120 if(m_mdDualValues != NULL) delete[] m_mdDualValues;
01121 m_mdDualValues = 0;
01122
01123 int numPrimalVals = this->primalVals.size();
01124 for(k = 0; k < numPrimalVals; k++){
01125 if( this->primalVals[ k] != NULL )
01126 delete this->primalVals[ k];
01127 }
01128 this->primalVals.clear();
01129
01130
01131 int numDualVals = this->dualVals.size();
01132 for(k = 0; k < numDualVals; k++){
01133 if( this->dualVals[ k] != NULL )
01134 delete this->dualVals[ k];
01135 }
01136 this->dualVals.clear();
01137 }
01138
01139
01140
01141
01142 GeneralStatus* OSResult::getGeneralStatus(){
01143 if (general == NULL) return NULL;
01144 return general->generalStatus;
01145 }
01146
01147 string OSResult::getGeneralStatusType(){
01148 if (general == NULL) return "";
01149 if (general->generalStatus == NULL) return "";
01150 return general->generalStatus->type;
01151 }
01152
01153 string OSResult::getGeneralStatusDescription(){
01154 if (general == NULL) return "";
01155 if (general->generalStatus == NULL) return "";
01156 return general->generalStatus->description;
01157 }
01158
01159 int OSResult::getNumberOfGeneralSubstatuses(){
01160 if (general == NULL) return -1;
01161 if (general->generalStatus == NULL) return -1;
01162 return general->generalStatus->numberOfSubstatuses;
01163 }
01164
01165 string OSResult::getGeneralSubstatusName(int i){
01166 if (general == NULL) return "";
01167 if (general->generalStatus == NULL) return "";
01168 if (i < 0 || i >= general->generalStatus->numberOfSubstatuses)
01169 throw ErrorClass("idx is outside of range in routine getGeneralSubstatusName()");
01170 if (general->generalStatus->substatus[i] == NULL) return "";
01171 return general->generalStatus->substatus[i]->name;
01172 }
01173
01174 string OSResult::getGeneralSubstatusDescription(int i){
01175 if (general == NULL) return "";
01176 if (general->generalStatus == NULL) return "";
01177 if (i < 0 || i >= general->generalStatus->numberOfSubstatuses)
01178 throw ErrorClass("idx is outside of range in routine getGeneralSubstatusDescription()");
01179 if (general->generalStatus->substatus[i] == NULL) return "";
01180 return general->generalStatus->substatus[i]->description;
01181 }
01182
01183 string OSResult::getGeneralMessage(){
01184 if (general == NULL) return "";
01185 return general->message;
01186 }
01187
01188 string OSResult::getServiceName(){
01189 if (general == NULL) return "";
01190 return general->serviceName;
01191 }
01192
01193 string OSResult::getServiceURI(){
01194 if (general == NULL) return "";
01195 return general->serviceURI;
01196 }
01197
01198 string OSResult::getInstanceName(){
01199 if (general == NULL) return "";
01200 return general->instanceName;
01201 }
01202
01203 string OSResult::getJobID(){
01204 if (general == NULL) return "";
01205 return general->jobID;
01206 }
01207
01208 string OSResult::getSolverInvoked(){
01209 if (general == NULL) return "";
01210 return general->solverInvoked;
01211 }
01212
01213 string OSResult::getTimeStamp(){
01214 if (general == NULL) return "";
01215 return general->timeStamp;
01216 }
01217
01218 int OSResult::getNumberOfOtherGeneralResults(){
01219 if (general == NULL) return -1;
01220 if (general->otherResults == NULL) return -1;
01221 return general->otherResults->numberOfOtherResults;
01222 }
01223
01224 string OSResult::getOtherGeneralResultName(int idx){
01225 if (general == NULL) return "";
01226 if (general->otherResults == NULL) return "";
01227 if (idx < 0 || idx >= general->otherResults->numberOfOtherResults)
01228 throw ErrorClass("idx is outside of range in routine getOtherGeneralResultName()");
01229 if (general->otherResults->other[idx] == NULL) return "";
01230 return general->otherResults->other[idx]->name;
01231 }
01232
01233 string OSResult::getOtherGeneralResultValue(int idx){
01234 if (general == NULL) return "";
01235 if (general->otherResults == NULL) return "";
01236 if (idx < 0 || idx >= general->otherResults->numberOfOtherResults)
01237 throw ErrorClass("idx is outside of range in routine getOtherGeneralResultValue()");
01238 if (general->otherResults->other[idx] == NULL) return "";
01239 return general->otherResults->other[idx]->value;
01240 }
01241
01242 string OSResult::getOtherGeneralResultDescription(int idx){
01243 if (general == NULL) return "";
01244 if (general->otherResults == NULL) return "";
01245 if (idx < 0 || idx >= general->otherResults->numberOfOtherResults)
01246 throw ErrorClass("idx is outside of range in routine getOtherGeneralResultDescription()");
01247 if (general->otherResults->other[idx] == NULL) return "";
01248 return general->otherResults->other[idx]->description;
01249 }
01250
01251 string OSResult::getSystemInformation(){
01252 if (system == NULL) return "";
01253 return system->systemInformation;
01254 }
01255
01256 string OSResult::getAvailableDiskSpaceUnit(){
01257 if (system == NULL) return "";
01258 if (system->availableDiskSpace == NULL) return "";
01259 return system->availableDiskSpace->unit;
01260 }
01261
01262 string OSResult::getAvailableDiskSpaceDescription(){
01263 if (system == NULL) return "";
01264 if (system->availableDiskSpace == NULL) return "";
01265 return system->availableDiskSpace->description;
01266 }
01267
01268 double OSResult::getAvailableDiskSpaceValue(){
01269 if (system == NULL) return -1.;
01270 if (system->availableDiskSpace == NULL) return -1.;
01271 return system->availableDiskSpace->value;
01272 }
01273
01274 string OSResult::getAvailableMemoryUnit(){
01275 if (system == NULL) return "";
01276 if (system->availableMemory == NULL) return "";
01277 return system->availableMemory->unit;
01278 }
01279
01280 string OSResult::getAvailableMemoryDescription(){
01281 if (system == NULL) return "";
01282 if (system->availableMemory == NULL) return "";
01283 return system->availableMemory->description;
01284 }
01285
01286 double OSResult::getAvailableMemoryValue(){
01287 if (system == NULL) return -1.;
01288 if (system->availableMemory == NULL) return -1.;
01289 return system->availableMemory->value;
01290 }
01291
01292 string OSResult::getAvailableCPUSpeedUnit(){
01293 if (system == NULL) return "";
01294 if (system->availableCPUSpeed == NULL) return "";
01295 return system->availableCPUSpeed->unit;
01296 }
01297
01298 string OSResult::getAvailableCPUSpeedDescription(){
01299 if (system == NULL) return "";
01300 if (system->availableCPUSpeed == NULL) return "";
01301 return system->availableCPUSpeed->description;
01302 }
01303
01304 double OSResult::getAvailableCPUSpeedValue(){
01305 if (system == NULL) return -1.;
01306 if (system->availableCPUSpeed == NULL) return -1.;
01307 return system->availableCPUSpeed->value;
01308 }
01309
01310 string OSResult::getAvailableCPUNumberDescription(){
01311 if (system == NULL) return "";
01312 if (system->availableCPUNumber == NULL) return "";
01313 return system->availableCPUNumber->description;
01314 }
01315
01316 int OSResult::getAvailableCPUNumberValue(){
01317 if (system == NULL) return -1;
01318 if (system->availableCPUNumber == NULL) return -1;
01319 return system->availableCPUNumber->value;
01320 }
01321
01322 int OSResult::getNumberOfOtherSystemResults(){
01323 if (system == NULL) return -1;
01324 if (system->otherResults == NULL) return -1;
01325 return system->otherResults->numberOfOtherResults;
01326 }
01327
01328 string OSResult::getOtherSystemResultName(int idx){
01329 if (system == NULL) return "";
01330 if (system->otherResults == NULL) return "";
01331 if (idx < 0 || idx >= system->otherResults->numberOfOtherResults)
01332 throw ErrorClass("idx is outside of range in routine getOtherSystemResultName()");
01333 if (system->otherResults->other[idx] == NULL) return "";
01334 return system->otherResults->other[idx]->name;
01335 }
01336
01337 string OSResult::getOtherSystemResultValue(int idx){
01338 if (system == NULL) return "";
01339 if (system->otherResults == NULL) return "";
01340 if (idx < 0 || idx >= system->otherResults->numberOfOtherResults)
01341 throw ErrorClass("idx is outside of range in routine getOtherSystemResultValue()");
01342 if (system->otherResults->other[idx] == NULL) return "";
01343 return system->otherResults->other[idx]->value;
01344 }
01345
01346 string OSResult::getOtherSystemResultDescription(int idx){
01347 if (system == NULL) return "";
01348 if (system->otherResults == NULL) return "";
01349 if (idx < 0 || idx >= system->otherResults->numberOfOtherResults)
01350 throw ErrorClass("idx is outside of range in routine getOtherSystemResultDescription()");
01351 if (system->otherResults->other[idx] == NULL) return "";
01352 return system->otherResults->other[idx]->description;
01353 }
01354
01355 string OSResult::getCurrentState(){
01356 if (service == NULL) return "";
01357 return service->currentState;
01358 }
01359
01360 int OSResult::getCurrentJobCount(){
01361 if (service == NULL) return -1;
01362 return service->currentJobCount;
01363 }
01364
01365 int OSResult::getTotalJobsSoFar(){
01366 if (service == NULL) return -1;
01367 return service->totalJobsSoFar;
01368 }
01369
01370 string OSResult::getTimeServiceStarted(){
01371 if (service == NULL) return "";
01372 return service->timeServiceStarted;
01373 }
01374
01375 double OSResult::getServiceUtilization(){
01376 if (service == NULL) return -1.;
01377 return service->serviceUtilization;
01378 }
01379
01380 int OSResult::getNumberOfOtherServiceResults(){
01381 if (service == NULL) return -1;
01382 if (service->otherResults == NULL) return -1;
01383 return service->otherResults->numberOfOtherResults;
01384 }
01385
01386 string OSResult::getOtherServiceResultName(int idx){
01387 if (service == NULL) return "";
01388 if (service->otherResults == NULL) return "";
01389 if (idx < 0 || idx >= service->otherResults->numberOfOtherResults)
01390 throw ErrorClass("idx is outside of range in routine getOtherServiceResultName()");
01391 if (service->otherResults->other[idx] == NULL) return "";
01392 return service->otherResults->other[idx]->name;
01393 }
01394
01395 string OSResult::getOtherServiceResultValue(int idx){
01396 if (service == NULL) return "";
01397 if (service->otherResults == NULL) return "";
01398 if (idx < 0 || idx >= service->otherResults->numberOfOtherResults)
01399 throw ErrorClass("idx is outside of range in routine getOtherServiceResultValue()");
01400 if (service->otherResults->other[idx] == NULL) return "";
01401 return service->otherResults->other[idx]->value;
01402 }
01403
01404 string OSResult::getOtherServiceResultDescription(int idx){
01405 if (service == NULL) return "";
01406 if (service->otherResults == NULL) return "";
01407 if (idx < 0 || idx >= service->otherResults->numberOfOtherResults)
01408 throw ErrorClass("idx is outside of range in routine getOtherServiceResultDescription()");
01409 if (service->otherResults->other[idx] == NULL) return "";
01410 return service->otherResults->other[idx]->description;
01411 }
01412
01413 string OSResult::getJobStatus(){
01414 if (job == NULL) return "";
01415 return job->status;
01416 }
01417
01418 string OSResult::getJobSubmitTime(){
01419 if (job == NULL) return "";
01420 return job->submitTime;
01421 }
01422
01423 string OSResult::getScheduledStartTime(){
01424 if (job == NULL) return "";
01425 return job->scheduledStartTime;
01426 }
01427
01428 string OSResult::getActualStartTime(){
01429 if (job == NULL) return "";
01430 return job->actualStartTime;
01431 }
01432
01433 string OSResult::getJobEndTime(){
01434 if (job == NULL) return "";
01435 return job->endTime;
01436 }
01437
01438 int OSResult::getNumberOfTimes(){
01439 if (job == NULL) return -1;
01440 if (job->timingInformation == NULL) return -1;
01441 return job->timingInformation->numberOfTimes;
01442 }
01443
01444 string OSResult::getTimingInfoUnit(int idx){
01445 if (job == NULL) return "";
01446 if (job->timingInformation == NULL) return "";
01447 if (idx < 0 || idx >= job->timingInformation->numberOfTimes)
01448 throw ErrorClass("idx is outside of range in routine getTimingInfoUnit()");
01449 if (job->timingInformation->time[idx] == NULL) return "";
01450 return job->timingInformation->time[idx]->unit;
01451 }
01452
01453 string OSResult::getTimingInfoType(int idx){
01454 if (job == NULL) return "";
01455 if (job->timingInformation == NULL) return "";
01456 if (idx < 0 || idx >= job->timingInformation->numberOfTimes)
01457 throw ErrorClass("idx is outside of range in routine getTimingInfoType()");
01458 if (job->timingInformation->time[idx] == NULL) return "";
01459 return job->timingInformation->time[idx]->type;
01460 }
01461
01462 string OSResult::getTimingInfoCategory(int idx){
01463 if (job == NULL) return "";
01464 if (job->timingInformation == NULL) return "";
01465 if (idx < 0 || idx >= job->timingInformation->numberOfTimes)
01466 throw ErrorClass("idx is outside of range in routine getTimingInfoCategory()");
01467 if (job->timingInformation->time[idx] == NULL) return "";
01468 return job->timingInformation->time[idx]->category;
01469 }
01470
01471 string OSResult::getTimingInfoDescription(int idx){
01472 if (job == NULL) return "";
01473 if (job->timingInformation == NULL) return "";
01474 if (idx < 0 || idx >= job->timingInformation->numberOfTimes)
01475 throw ErrorClass("idx is outside of range in routine getTimingInfoDescription()");
01476 if (job->timingInformation->time[idx] == NULL) return "";
01477 return job->timingInformation->time[idx]->description;
01478 }
01479
01480 double OSResult::getTimingInfoValue(int idx){
01481 if (job == NULL) return OSNAN;
01482 if (job->timingInformation == NULL) return OSNAN;
01483 if (idx < 0 || idx >= job->timingInformation->numberOfTimes)
01484 throw ErrorClass("idx is outside of range in routine getTimingInfoValue()");
01485 if (job->timingInformation->time[idx] == NULL) return OSNAN;
01486 return job->timingInformation->time[idx]->value;
01487 }
01488
01489 string OSResult::getUsedDiskSpaceUnit(){
01490 if (job == NULL) return "";
01491 if (job->usedDiskSpace == NULL) return "";
01492 return job->usedDiskSpace->unit;
01493 }
01494
01495 string OSResult::getUsedDiskSpaceDescription(){
01496 if (job == NULL) return "";
01497 if (job->usedDiskSpace == NULL) return "";
01498 return job->usedDiskSpace->description;
01499 }
01500
01501 double OSResult::getUsedDiskSpaceValue(){
01502 if (job == NULL) return -1.;
01503 if (job->usedDiskSpace == NULL) return -1.;
01504 return job->usedDiskSpace->value;
01505 }
01506
01507 string OSResult::getUsedMemoryUnit(){
01508 if (job == NULL) return "";
01509 if (job->usedMemory == NULL) return "";
01510 return job->usedMemory->unit;
01511 }
01512
01513 string OSResult::getUsedMemoryDescription(){
01514 if (job == NULL) return "";
01515 if (job->usedMemory == NULL) return "";
01516 return job->usedMemory->description;
01517 }
01518
01519 double OSResult::getUsedMemoryValue(){
01520 if (job == NULL) return -1.;
01521 if (job->usedMemory == NULL) return -1.;
01522 return job->usedMemory->value;
01523 }
01524
01525 string OSResult::getUsedCPUSpeedUnit(){
01526 if (job == NULL) return "";
01527 if (job->usedCPUSpeed == NULL) return "";
01528 return job->usedCPUSpeed->unit;
01529 }
01530
01531 string OSResult::getUsedCPUSpeedDescription(){
01532 if (job == NULL) return "";
01533 if (job->usedCPUSpeed == NULL) return "";
01534 return job->usedCPUSpeed->description;
01535 }
01536
01537 double OSResult::getUsedCPUSpeedValue(){
01538 if (job == NULL) return -1.;
01539 if (job->usedCPUSpeed == NULL) return -1.;
01540 return job->usedCPUSpeed->value;
01541 }
01542
01543 string OSResult::getUsedCPUNumberDescription(){
01544 if (job == NULL) return "";
01545 if (job->usedCPUNumber == NULL) return "";
01546 return job->usedCPUNumber->description;
01547 }
01548
01549 int OSResult::getUsedCPUNumberValue(){
01550 if (job == NULL) return -1;
01551 if (job->usedCPUNumber == NULL) return -1;
01552 return job->usedCPUNumber->value;
01553 }
01554
01555 int OSResult::getNumberOfOtherJobResults(){
01556 if (job == NULL) return -1;
01557 if (job->otherResults == NULL) return -1;
01558 return job->otherResults->numberOfOtherResults;
01559 }
01560
01561 string OSResult::getOtherJobResultName(int idx){
01562 if (job == NULL) return "";
01563 if (job->otherResults == NULL) return "";
01564 if (idx < 0 || idx >= job->otherResults->numberOfOtherResults)
01565 throw ErrorClass("idx is outside of range in routine getOtherJobResultName()");
01566 if (job->otherResults->other[idx] == NULL) return "";
01567 return job->otherResults->other[idx]->name;
01568 }
01569
01570 string OSResult::getOtherJobResultValue(int idx){
01571 if (job == NULL) return "";
01572 if (job->otherResults == NULL) return "";
01573 if (idx < 0 || idx >= job->otherResults->numberOfOtherResults)
01574 throw ErrorClass("idx is outside of range in routine getOtherJobResultValue()");
01575 if (job->otherResults->other[idx] == NULL) return "";
01576 return job->otherResults->other[idx]->value;
01577 }
01578
01579 string OSResult::getOtherJobResultDescription(int idx){
01580 if (job == NULL) return "";
01581 if (job->otherResults == NULL) return "";
01582 if (idx < 0 || idx >= job->otherResults->numberOfOtherResults)
01583 throw ErrorClass("idx is outside of range in routine getOtherJobResultDescription()");
01584 if (job->otherResults->other[idx] == NULL) return "";
01585 return job->otherResults->other[idx]->description;
01586 }
01587
01588 double OSResult::getTimeValue()
01589 { if (job == NULL) return 0.0;
01590 if (job->timingInformation == NULL) return 0.0;
01591 if (job->timingInformation->numberOfTimes <= 0) return 0.0;
01592 return job->timingInformation->time[0]->value;
01593 }
01594
01595 int OSResult::getTimeNumber()
01596 { if (job == NULL) return -1;
01597 if (job->timingInformation == NULL) return -1;
01598 return job->timingInformation->numberOfTimes;
01599 }
01600
01601
01602 int OSResult::getVariableNumber(){
01603 if(m_iVariableNumber == -1){
01604 if(optimization == NULL) return -1;
01605 m_iVariableNumber = optimization->numberOfVariables;
01606 }
01607 return m_iVariableNumber;
01608 }
01609
01610 int OSResult::getObjectiveNumber(){
01611 if(m_iObjectiveNumber == -1){
01612 if(optimization == NULL) return -1;
01613 m_iObjectiveNumber = optimization->numberOfObjectives;
01614 }
01615 return m_iObjectiveNumber;
01616 }
01617
01618 int OSResult::getConstraintNumber(){
01619 if(m_iConstraintNumber == -1){
01620 if(optimization == NULL) return -1;
01621 m_iConstraintNumber = optimization->numberOfConstraints;
01622 }
01623 return m_iConstraintNumber;
01624 }
01625
01626 int OSResult::getSolutionNumber(){
01627 if(optimization == NULL) return 0;
01628 if(optimization->solution == NULL) return 0;
01629 return optimization->numberOfSolutions;
01630 }
01631
01632
01633 OptimizationSolutionStatus* OSResult::getSolutionStatus( int solIdx){
01634 if (optimization == NULL || optimization->solution == NULL)
01635 throw ErrorClass("No solution defined");
01636 if (solIdx < 0 || solIdx >= optimization->numberOfSolutions)
01637 throw ErrorClass("solIdx is outside of range in routine getSolutionStatus()");
01638 if(optimization->solution[solIdx] == NULL) return NULL;
01639 return optimization->solution[solIdx]->status;
01640 }
01641
01642 string OSResult::getSolutionStatusType(int solIdx){
01643 if (optimization == NULL || optimization->solution == NULL)
01644 throw ErrorClass("No solution defined");
01645 if (solIdx < 0 || solIdx >= optimization->numberOfSolutions)
01646 throw ErrorClass("solIdx is outside of range in routine getSolutionStatusType()");
01647 if (optimization->solution[solIdx] == NULL) return "";
01648 if (optimization->solution[solIdx]->status == NULL) return "";
01649 return optimization->solution[solIdx]->status->type;
01650 }
01651
01652 string OSResult::getSolutionStatusDescription(int solIdx){
01653 if (optimization == NULL || optimization->solution == NULL)
01654 throw ErrorClass("No solution defined");
01655 if (solIdx < 0 || solIdx >= optimization->numberOfSolutions)
01656 throw ErrorClass("solIdx is outside of range in routine getSolutionStatusDescription()");
01657 if (optimization->solution[solIdx] == NULL) return "";
01658 if (optimization->solution[solIdx]->status == NULL) return "";
01659 return optimization->solution[solIdx]->status->description;
01660 }
01661
01662 int OSResult::getNumberOfSolutionSubstatuses(int solIdx){
01663 if (optimization == NULL || optimization->solution == NULL)
01664 throw ErrorClass("No solution defined");
01665 if (solIdx < 0 || solIdx >= optimization->numberOfSolutions)
01666 throw ErrorClass("solIdx is outside of range in routine getNumberOfSolutionSubstatuses()");
01667 if (optimization->solution[solIdx] == NULL) return -1;
01668 if (optimization->solution[solIdx]->status == NULL) return -1;
01669 return optimization->solution[solIdx]->status->numberOfSubstatuses;
01670 }
01671
01672 string OSResult::getSolutionSubstatusType(int solIdx, int substatusIdx){
01673 if (optimization == NULL || optimization->solution == NULL)
01674 throw ErrorClass("No solution defined");
01675 if (solIdx < 0 || solIdx >= optimization->numberOfSolutions)
01676 throw ErrorClass("solIdx is outside of range in routine getSolutionSubstatusType()");
01677 if (optimization->solution[solIdx] == NULL) return "";
01678 if (optimization->solution[solIdx]->status == NULL) return "";
01679 if (substatusIdx < 0 || substatusIdx >= optimization->solution[solIdx]->status->numberOfSubstatuses)
01680 throw ErrorClass("solution substatus index is outside of range in routine getSolutionSubstatusType()");
01681 return optimization->solution[solIdx]->status->substatus[substatusIdx]->type;
01682 }
01683
01684 string OSResult::getSolutionSubstatusDescription(int solIdx, int substatusIdx){
01685 if (optimization == NULL || optimization->solution == NULL)
01686 throw ErrorClass("No solution defined");
01687 if (solIdx < 0 || solIdx >= optimization->numberOfSolutions)
01688 throw ErrorClass("solIdx is outside of range in routine getSolutionSubstatusDescription()");
01689 if (optimization->solution[solIdx] == NULL) return "";
01690 if (optimization->solution[solIdx]->status == NULL) return "";
01691 if (substatusIdx < 0 || substatusIdx >= optimization->solution[solIdx]->status->numberOfSubstatuses)
01692 return "";
01693 return optimization->solution[solIdx]->status->substatus[substatusIdx]->description;
01694 }
01695
01696 int OSResult::getSolutionTargetObjectiveIdx(int solIdx){
01697 if (optimization == NULL || optimization->solution == NULL)
01698 throw ErrorClass("No solution defined");
01699 if (solIdx < 0 || solIdx >= optimization->numberOfSolutions)
01700 throw ErrorClass("solIdx is outside of range in routine getSolutionTargetObjectiveIdx()");
01701 if (optimization->solution[solIdx] == NULL) return 0;
01702 return optimization->solution[solIdx]->targetObjectiveIdx;
01703 }
01704
01705 bool OSResult::getSolutionWeightedObjectives(int solIdx){
01706 if (optimization == NULL || optimization->solution == NULL)
01707 throw ErrorClass("No solution defined");
01708 if (solIdx < 0 || solIdx >= optimization->numberOfSolutions)
01709 throw ErrorClass("solIdx is outside of range in routine getSolutionWeightedObjectives()");
01710 if (optimization->solution[solIdx] == NULL) return false;
01711 return optimization->solution[solIdx]->weightedObjectives;
01712 }
01713
01714 string OSResult::getSolutionMessage(int solIdx){
01715 if(optimization == NULL) return "there is no solution";
01716 if(optimization->solution == NULL ||
01717 solIdx < 0 || solIdx >= optimization->numberOfSolutions) return "there is no solution";
01718 if(optimization->solution[solIdx] == NULL) return "there is no solution";
01719 return optimization->solution[solIdx]->message;
01720 }
01721
01722 int OSResult::getNumberOfPrimalVariableValues(int solIdx){
01723 if (optimization == NULL || optimization->solution == NULL)
01724 throw ErrorClass("No solution defined");
01725 if (solIdx < 0 || solIdx >= optimization->numberOfSolutions)
01726 throw ErrorClass("solIdx is outside of range in routine getNumberOfPrimalVariableValues()");
01727 if (optimization->solution[solIdx] == NULL) return -1;
01728 if (optimization->solution[solIdx]->variables == NULL) return -1;
01729 if (optimization->solution[solIdx]->variables->values == NULL) return -1;
01730 return optimization->solution[solIdx]->variables->values->numberOfVar;
01731 }
01732
01733 int OSResult::getNumberOfVarValues(int solIdx){
01734 if (optimization == NULL || optimization->solution == NULL)
01735 throw ErrorClass("No solution defined");
01736 if (solIdx < 0 || solIdx >= optimization->numberOfSolutions)
01737 throw ErrorClass("solIdx is outside of range in routine getNumberOfVarValues()");
01738 if (optimization->solution[solIdx] == NULL) return -1;
01739 if (optimization->solution[solIdx]->variables == NULL) return -1;
01740 if (optimization->solution[solIdx]->variables->values == NULL) return -1;
01741 return optimization->solution[solIdx]->variables->values->numberOfVar;
01742 }
01743
01744 int OSResult::getVarValueIdx(int solIdx, int varIdx){
01745 if (optimization == NULL || optimization->solution == NULL)
01746 throw ErrorClass("No solution defined");
01747 if (solIdx < 0 || solIdx >= optimization->numberOfSolutions)
01748 throw ErrorClass("solIdx is outside of range in routine getVarValueIdx()");
01749 if (optimization->solution[solIdx] == NULL) return -1;
01750 if (optimization->solution[solIdx]->variables == NULL) return -1;
01751 if (optimization->solution[solIdx]->variables->values == NULL) return -1;
01752 if (varIdx < 0 || varIdx >= optimization->solution[solIdx]->variables->values->numberOfVar)
01753 throw ErrorClass("varIdx is outside of range in routine getVarValueIdx()");
01754 return optimization->solution[solIdx]->variables->values->var[varIdx]->idx;
01755 }
01756
01757 double OSResult::getVarValue(int solIdx, int varIdx){
01758 if (optimization == NULL || optimization->solution == NULL)
01759 throw ErrorClass("No solution defined");
01760 if (solIdx < 0 || solIdx >= optimization->numberOfSolutions)
01761 throw ErrorClass("solIdx is outside of range in routine getVarValue()");
01762 if (optimization->solution[solIdx] == NULL) return OSNAN;
01763 if (optimization->solution[solIdx]->variables == NULL) return OSNAN;
01764 if (optimization->solution[solIdx]->variables->values == NULL) return OSNAN;
01765 if (varIdx < 0 || varIdx >= optimization->solution[solIdx]->variables->values->numberOfVar)
01766 throw ErrorClass("varIdx is outside of range in routine getVarValue()");
01767 return optimization->solution[solIdx]->variables->values->var[varIdx]->value;
01768 }
01769
01770 std::vector<IndexValuePair*> OSResult::getOptimalPrimalVariableValues(int solIdx){
01771 int numberOfVar;
01772 struct IndexValuePair *primalValPair;
01773 int iSolutions = this->getSolutionNumber();
01774 for(int i = 0; i < iSolutions; i++){
01775 if( i != solIdx) continue;
01776 if(optimization->solution[i] == NULL) continue;
01777 if(optimization->solution[i]->variables == NULL) continue;
01778 if(optimization->solution[i]->variables->values == NULL) continue;
01779 if((optimization->solution[i]->status->type.find("ptimal") != string::npos && m_mdPrimalValues == NULL) ||
01780 optimization->solution[i]->status->type.compare("globallyOptimal") == 0){
01781 numberOfVar = optimization->solution[i]->variables->values->numberOfVar;
01782 for(int j = 0; j < numberOfVar; j++){
01783 primalValPair = new IndexValuePair();
01784 primalValPair->value = optimization->solution[i]->variables->values->var[j]->value;
01785 primalValPair->idx = optimization->solution[i]->variables->values->var[j]->idx;
01786 primalVals.push_back( primalValPair);
01787 }
01788 }
01789 if(optimization->solution[i]->status->type.compare("globallyOptimal") == 0){
01790 return primalVals;
01791 }
01792 }
01793 return primalVals;
01794 }
01795
01796
01797 int OSResult::getNumberOfVarValuesString(int solIdx){
01798 if (optimization == NULL || optimization->solution == NULL)
01799 throw ErrorClass("No solution defined");
01800 if (solIdx < 0 || solIdx >= optimization->numberOfSolutions)
01801 throw ErrorClass("solIdx is outside of range in routine getNumberOfVarValuesString()");
01802 if (optimization->solution[solIdx] == NULL) return -1;
01803 if (optimization->solution[solIdx]->variables == NULL) return -1;
01804 if (optimization->solution[solIdx]->variables->valuesString == NULL) return -1;
01805 return optimization->solution[solIdx]->variables->valuesString->numberOfVar;
01806 }
01807
01808 int OSResult::getVarValueStringIdx(int solIdx, int varIdx){
01809 if (optimization == NULL || optimization->solution == NULL)
01810 throw ErrorClass("No solution defined");
01811 if (solIdx < 0 || solIdx >= optimization->numberOfSolutions)
01812 throw ErrorClass("solIdx is outside of range in routine getVarValueStringIdx()");
01813 if (optimization->solution[solIdx] == NULL) return -1;
01814 if (optimization->solution[solIdx]->variables == NULL) return -1;
01815 if (optimization->solution[solIdx]->variables->valuesString == NULL) return -1;
01816 if (varIdx < 0 || varIdx >= optimization->solution[solIdx]->variables->valuesString->numberOfVar)
01817 throw ErrorClass("varIdx is outside of range in routine getVarValueStringIdx()");
01818 return optimization->solution[solIdx]->variables->valuesString->var[varIdx]->idx;
01819 }
01820
01821 std::string OSResult::getVarValueString(int solIdx, int varIdx){
01822 if (optimization == NULL || optimization->solution == NULL)
01823 throw ErrorClass("No solution defined");
01824 if (solIdx < 0 || solIdx >= optimization->numberOfSolutions)
01825 throw ErrorClass("solIdx is outside of range in routine getVarValueString()");
01826 if (optimization->solution[solIdx] == NULL) return NULL;
01827 if (optimization->solution[solIdx]->variables == NULL) return NULL;
01828 if (optimization->solution[solIdx]->variables->valuesString == NULL) return NULL;
01829 if (varIdx < 0 || varIdx >= optimization->solution[solIdx]->variables->valuesString->numberOfVar)
01830 throw ErrorClass("varIdx is outside of range in routine getVarValueString()");
01831 return optimization->solution[solIdx]->variables->valuesString->var[varIdx]->value;
01832 }
01833
01834
01835
01836
01837
01838
01839
01840
01841
01842
01843
01844
01845
01846
01847
01848
01849
01850
01851
01852
01853
01854
01855
01856
01857
01858
01859
01860
01861
01862
01863
01864
01865
01866
01867
01868
01869
01870
01871
01872
01873 int OSResult::getNumberOfOtherVariableResults(int solIdx){
01874 if(m_iNumberOfOtherVariableResults == -1){
01875 if (optimization == NULL || optimization->solution == NULL)
01876 throw ErrorClass("No solution defined");
01877 if (solIdx < 0 || solIdx >= optimization->numberOfSolutions)
01878 throw ErrorClass("solIdx is outside of range in routine getNumberOfOtherVariableResults()");
01879 if(optimization->solution[solIdx] == NULL) return -1;
01880 if(optimization->solution[solIdx]->variables == NULL) return -1;
01881 if(optimization->solution[solIdx]->variables->other == NULL) return -1;
01882 m_iNumberOfOtherVariableResults = optimization->solution[solIdx]->variables->numberOfOtherVariableResults;
01883 }
01884 return m_iNumberOfOtherVariableResults;
01885 }
01886
01887 int OSResult::getAnOtherVariableResultNumberOfVar(int solIdx, int iOther){
01888 if (optimization == NULL || optimization->solution == NULL)
01889 throw ErrorClass("No solution defined");
01890 int iSolutions = this->getSolutionNumber();
01891 if (solIdx < 0 || solIdx >= iSolutions)
01892 throw ErrorClass("solIdx is outside of range in routine getAnOtherVariableResultNumberOfVar()");
01893 if (optimization->solution[solIdx] == NULL) return -1;
01894 if (optimization->solution[solIdx]->variables == NULL) return -1;
01895 if (optimization->solution[solIdx]->variables->other == NULL) return -1;
01896 if (iOther < 0 || iOther >= optimization->solution[solIdx]->variables->numberOfOtherVariableResults)
01897 throw ErrorClass("other variables result index is outside of range in routine getAnOtherVariableResultNumberOfVar()");
01898 return optimization->solution[solIdx]->variables->other[iOther]->numberOfVar;
01899 }
01900
01901 string OSResult::getOtherVariableResultName(int solIdx, int otherIdx){
01902 if (optimization == NULL || optimization->solution == NULL)
01903 throw ErrorClass("No solution defined");
01904 int iSolutions = this->getSolutionNumber();
01905 if (solIdx < 0 || solIdx >= iSolutions)
01906 throw ErrorClass("solIdx is outside of range in routine getOtherVariableResultName()");
01907 if (optimization->solution[solIdx] == NULL) return "";
01908 if (optimization->solution[solIdx]->variables == NULL) return "";
01909 if (optimization->solution[solIdx]->variables->other == NULL) return "";
01910 if (otherIdx < 0 || otherIdx >= optimization->solution[solIdx]->variables->numberOfOtherVariableResults)
01911 throw ErrorClass("otherIdx is outside of range in routine getOtherVariableResultName()");
01912 if (optimization->solution[solIdx]->variables->other[ otherIdx] == NULL) return "";
01913 return optimization->solution[solIdx]->variables->other[ otherIdx]->name;
01914 }
01915
01916 string OSResult::getOtherVariableResultValue(int solIdx, int otherIdx){
01917 if (optimization == NULL || optimization->solution == NULL)
01918 throw ErrorClass("No solution defined");
01919 int iSolutions = this->getSolutionNumber();
01920 if (solIdx < 0 || solIdx >= iSolutions)
01921 throw ErrorClass("solIdx is outside of range in routine getOtherVariableResultValue()");
01922 if (optimization->solution[solIdx] == NULL) return "";
01923 if (optimization->solution[solIdx]->variables == NULL) return "";
01924 if (optimization->solution[solIdx]->variables->other == NULL) return "";
01925 if (otherIdx < 0 || otherIdx >= optimization->solution[solIdx]->variables->numberOfOtherVariableResults)
01926 throw ErrorClass("otherIdx is outside of range in routine getOtherVariableResultValue()");
01927 if (optimization->solution[solIdx]->variables->other[ otherIdx] == NULL) return "";
01928 return optimization->solution[solIdx]->variables->other[ otherIdx]->value;
01929 }
01930
01931 string OSResult::getOtherVariableResultDescription(int solIdx, int otherIdx){
01932 if (optimization == NULL || optimization->solution == NULL)
01933 throw ErrorClass("No solution defined");
01934 int iSolutions = this->getSolutionNumber();
01935 if (solIdx < 0 || solIdx >= iSolutions)
01936 throw ErrorClass("solIdx is outside of range in routine getOtherVariableResultDescription()");
01937 if (optimization->solution[solIdx] == NULL) return "";
01938 if (optimization->solution[solIdx]->variables == NULL) return "";
01939 if (optimization->solution[solIdx]->variables->other == NULL) return "";
01940 if (otherIdx < 0 || otherIdx >= optimization->solution[solIdx]->variables->numberOfOtherVariableResults)
01941 throw ErrorClass("otherIdx is outside of range in routine getOtherVariableResultDescription()");
01942 if (optimization->solution[solIdx]->variables->other[ otherIdx] == NULL) return "";
01943 return optimization->solution[solIdx]->variables->other[ otherIdx]->description;
01944 }
01945
01946 int OSResult::getOtherVariableResultNumberOfVar(int solIdx, int otherIdx){
01947 if (optimization == NULL || optimization->solution == NULL)
01948 throw ErrorClass("No solution defined");
01949 int iSolutions = this->getSolutionNumber();
01950 if (solIdx < 0 || solIdx >= iSolutions)
01951 throw ErrorClass("solIdx is outside of range in routine getOtherVariableResultNumberOfVar()");
01952 if (optimization->solution[solIdx] == NULL) return -1;
01953 if (optimization->solution[solIdx]->variables == NULL) return -1;
01954 if (optimization->solution[solIdx]->variables->other == NULL) return -1;
01955 if (otherIdx < 0 || otherIdx >= optimization->solution[solIdx]->variables->numberOfOtherVariableResults)
01956 throw ErrorClass("otherIdx is outside of range in routine getOtherVariableResultNumberOfVar()");
01957 if (optimization->solution[solIdx]->variables->other[ otherIdx] == NULL) return -1;
01958 return optimization->solution[solIdx]->variables->other[ otherIdx]->numberOfVar;
01959 }
01960
01961 int OSResult::getOtherVariableResultVarIdx(int solIdx, int otherIdx, int varIdx){
01962 if (optimization == NULL || optimization->solution == NULL)
01963 throw ErrorClass("No solution defined");
01964 int iSolutions = this->getSolutionNumber();
01965 if (solIdx < 0 || solIdx >= iSolutions)
01966 throw ErrorClass("solIdx is outside of range in routine getOtherVariableResultVarIdx()");
01967 if (optimization->solution[solIdx] == NULL) return -1;
01968 if (optimization->solution[solIdx]->variables == NULL) return -1;
01969 if (optimization->solution[solIdx]->variables->other == NULL) return -1;
01970 if (otherIdx < 0 || otherIdx >= optimization->solution[solIdx]->variables->numberOfOtherVariableResults)
01971 throw ErrorClass("otherIdx is outside of range in routine getOtherVariableResultVarIdx()");
01972 if (optimization->solution[solIdx]->variables->other[ otherIdx] == NULL) return -1;
01973 if (optimization->solution[solIdx]->variables->other[ otherIdx]->var == NULL) return -1;
01974 if (varIdx < 0 || varIdx >= optimization->solution[solIdx]->variables->other[ otherIdx]->numberOfVar)
01975 throw ErrorClass("varIdx is outside of range in routine getOtherVariableResultVarIdx()");
01976 return optimization->solution[solIdx]->variables->other[otherIdx]->var[varIdx]->idx;
01977 }
01978
01979 string OSResult::getOtherVariableResultVar(int solIdx, int otherIdx, int varIdx){
01980 if (optimization == NULL || optimization->solution == NULL)
01981 throw ErrorClass("No solution defined");
01982 int iSolutions = this->getSolutionNumber();
01983 if (solIdx < 0 || solIdx >= iSolutions)
01984 throw ErrorClass("solIdx is outside of range in routine getOtherVariableResultVar()");
01985 if (optimization->solution[solIdx] == NULL) return "";
01986 if (optimization->solution[solIdx]->variables == NULL) return "";
01987 if (optimization->solution[solIdx]->variables->other == NULL) return "";
01988 if (otherIdx < 0 || otherIdx >= optimization->solution[solIdx]->variables->numberOfOtherVariableResults)
01989 throw ErrorClass("otherIdx is outside of range in routine getOtherVariableResultVar()");
01990 if (optimization->solution[solIdx]->variables->other[ otherIdx] == NULL) return "";
01991 if (optimization->solution[solIdx]->variables->other[ otherIdx]->var == NULL) return "";
01992 if (varIdx < 0 || varIdx >= optimization->solution[solIdx]->variables->other[ otherIdx]->numberOfVar)
01993 throw ErrorClass("varIdx is outside of range in routine getOtherVariableResultVar()");
01994 return optimization->solution[solIdx]->variables->other[otherIdx]->var[varIdx]->value;
01995 }
01996
01997 int OSResult::getNumberOfObjValues(int solIdx){
01998 if (optimization == NULL || optimization->solution == NULL)
01999 throw ErrorClass("No solution defined");
02000 int iSolutions = this->getSolutionNumber();
02001 if (solIdx < 0 || solIdx >= iSolutions)
02002 throw ErrorClass("solIdx is outside of range in routine getNumberOfObjValues()");
02003 if (optimization->solution[solIdx] == NULL) return -1;
02004 if (optimization->solution[solIdx]->objectives == NULL) return -1;
02005 if (optimization->solution[solIdx]->objectives->values == NULL) return -1;
02006 return optimization->solution[solIdx]->objectives->values->numberOfObj;
02007 }
02008
02009 int OSResult::getObjValueIdx(int solIdx, int objIdx){
02010 if (optimization == NULL || optimization->solution == NULL)
02011 throw ErrorClass("No solution defined");
02012 int iSolutions = this->getSolutionNumber();
02013 if (solIdx < 0 || solIdx >= iSolutions)
02014 throw ErrorClass("solIdx is outside of range in routine getObjValueIdx()");
02015 if (optimization->solution[solIdx] == NULL) return 0;
02016 if (optimization->solution[solIdx]->objectives == NULL) return 0;
02017 if (optimization->solution[solIdx]->objectives->values == NULL) return 0;
02018 if (objIdx < 0 || objIdx >= optimization->solution[solIdx]->objectives->values->numberOfObj)
02019 throw ErrorClass("objIdx is outside of range in routine getObjValueIdx()");
02020 return optimization->solution[solIdx]->objectives->values->obj[objIdx]->idx;
02021 }
02022
02023 double OSResult::getObjValue(int solIdx, int objIdx){
02024 if (optimization == NULL || optimization->solution == NULL)
02025 throw ErrorClass("No solution defined");
02026 int iSolutions = this->getSolutionNumber();
02027 if (solIdx < 0 || solIdx >= iSolutions)
02028 throw ErrorClass("solIdx is outside of range in routine getObjValue()");
02029 if (optimization->solution[solIdx] == NULL) return OSNAN;
02030 if (optimization->solution[solIdx]->objectives == NULL) return OSNAN;
02031 if (optimization->solution[solIdx]->objectives->values == NULL) return OSNAN;
02032 if (objIdx < 0 || objIdx >= optimization->solution[solIdx]->objectives->values->numberOfObj)
02033 throw ErrorClass("objIdx is outside of range in routine getObjValue()");
02034 return optimization->solution[solIdx]->objectives->values->obj[objIdx]->value;
02035 }
02036
02037 double OSResult::getOptimalObjValue(int objIdx, int solIdx)
02038 {
02039 if (this->optimization == NULL || this->optimization->solution == NULL)
02040 throw ErrorClass("No optimization or solution object defined");
02041 int iSolutions = this->getSolutionNumber();
02042 for (int i = 0; i < iSolutions; i++){
02043 if(i != solIdx) continue;
02044 if(this->optimization->solution[i]->targetObjectiveIdx != objIdx) continue;
02045 if((this->optimization->solution[i]->status->type.find("ptimal") != string::npos ) ||
02046 this->optimization->solution[i]->status->type.compare("globallyOptimal") == 0){
02047 return this->optimization->solution[i]->objectives->values->obj[ abs( objIdx) -1 ]->value;
02048 }
02049 else{
02050 throw ErrorClass("There is no optimal solution");
02051 }
02052 }
02053 throw ErrorClass("There is no optimal solution");
02054 }
02055
02056 int OSResult::getNumberOfOtherObjectiveResults(int solIdx){
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 getNumberOfOtherObjectiveResults()");
02062 if (optimization->solution[solIdx]->objectives == NULL) return -1;
02063 if (optimization->solution[solIdx]->objectives->other == NULL) return -1;
02064 return optimization->solution[solIdx]->objectives->numberOfOtherObjectiveResults;
02065 }
02066
02067
02068 string OSResult::getOtherObjectiveResultName(int solIdx, int otherIdx){
02069 if (optimization == NULL || optimization->solution == NULL)
02070 throw ErrorClass("No solution defined");
02071 int iSolutions = this->getSolutionNumber();
02072 if (solIdx < 0 || solIdx >= iSolutions)
02073 throw ErrorClass("solIdx is outside of range in routine getOtherObjectiveResultName()");
02074 if (optimization->solution[solIdx] == NULL) return "";
02075 if (optimization->solution[solIdx]->objectives == NULL) return "";
02076 if (optimization->solution[solIdx]->objectives->other == NULL) return "";
02077 if (otherIdx < 0 || otherIdx >= optimization->solution[solIdx]->objectives->numberOfOtherObjectiveResults)
02078 throw ErrorClass("otherIdx is outside of range in routine getOtherObjectiveResultName()");
02079 if (optimization->solution[solIdx]->objectives->other[ otherIdx] == NULL) return "";
02080 return optimization->solution[solIdx]->objectives->other[ otherIdx]->name;
02081 }
02082
02083 string OSResult::getOtherObjectiveResultValue(int solIdx, int otherIdx){
02084 if (optimization == NULL || optimization->solution == NULL)
02085 throw ErrorClass("No solution defined");
02086 int iSolutions = this->getSolutionNumber();
02087 if (solIdx < 0 || solIdx >= iSolutions)
02088 throw ErrorClass("solIdx is outside of range in routine getOtherObjectiveResultValue()");
02089 if (optimization->solution[solIdx] == NULL) return "";
02090 if (optimization->solution[solIdx]->objectives == NULL) return "";
02091 if (optimization->solution[solIdx]->objectives->other == NULL) return "";
02092 if (otherIdx < 0 || otherIdx >= optimization->solution[solIdx]->objectives->numberOfOtherObjectiveResults)
02093 throw ErrorClass("otherIdx is outside of range in routine getOtherObjectiveResultValue()");
02094 if (optimization->solution[solIdx]->objectives->other[ otherIdx] == NULL) return "";
02095 return optimization->solution[solIdx]->objectives->other[ otherIdx]->value;
02096 }
02097
02098 string OSResult::getOtherObjectiveResultDescription(int solIdx, int otherIdx){
02099 if (optimization == NULL || optimization->solution == NULL)
02100 throw ErrorClass("No solution defined");
02101 int iSolutions = this->getSolutionNumber();
02102 if (solIdx < 0 || solIdx >= iSolutions)
02103 throw ErrorClass("solIdx is outside of range in routine getOtherObjectiveResultDescription()");
02104 if (optimization->solution[solIdx] == NULL) return "";
02105 if (optimization->solution[solIdx]->objectives == NULL) return "";
02106 if (optimization->solution[solIdx]->objectives->other == NULL) return "";
02107 if (otherIdx < 0 || otherIdx >= optimization->solution[solIdx]->objectives->numberOfOtherObjectiveResults)
02108 throw ErrorClass("otherIdx is outside of range in routine getOtherObjectiveResultDescription()");
02109 if (optimization->solution[solIdx]->objectives->other[ otherIdx] == NULL) return "";
02110 return optimization->solution[solIdx]->objectives->other[ otherIdx]->description;
02111 }
02112
02113 int OSResult::getOtherObjectiveResultNumberOfObj(int solIdx, int otherIdx){
02114 if (optimization == NULL || optimization->solution == NULL)
02115 throw ErrorClass("No solution defined");
02116 int iSolutions = this->getSolutionNumber();
02117 if (solIdx < 0 || solIdx >= iSolutions)
02118 throw ErrorClass("solIdx is outside of range in routine getOtherObjectiveResultNumberOfObj()");
02119 if (optimization->solution[solIdx] == NULL) return -1;
02120 if (optimization->solution[solIdx]->objectives == NULL) return -1;
02121 if (optimization->solution[solIdx]->objectives->other == NULL) return -1;
02122 if (otherIdx < 0 || otherIdx >= optimization->solution[solIdx]->objectives->numberOfOtherObjectiveResults)
02123 throw ErrorClass("otherIdx is outside of range in routine getOtherObjectiveResultNumberOfObj()");
02124 if (optimization->solution[solIdx]->objectives->other[ otherIdx] == NULL) return -1;
02125 return optimization->solution[solIdx]->objectives->other[ otherIdx]->numberOfObj;
02126 }
02127
02128 int OSResult::getOtherObjectiveResultObjIdx(int solIdx, int otherIdx, int objIdx){
02129 if (optimization == NULL || optimization->solution == NULL)
02130 throw ErrorClass("No solution defined");
02131 int iSolutions = this->getSolutionNumber();
02132 if (solIdx < 0 || solIdx >= iSolutions)
02133 throw ErrorClass("solIdx is outside of range in routine getOtherObjectiveResultObjIdx()");
02134 if (optimization->solution[solIdx] == NULL) return 0;
02135 if (optimization->solution[solIdx]->objectives == NULL) return 0;
02136 if (optimization->solution[solIdx]->objectives->other == NULL) return 0;
02137 if (otherIdx < 0 || otherIdx >= optimization->solution[solIdx]->objectives->numberOfOtherObjectiveResults)
02138 throw ErrorClass("otherIdx is outside of range in routine getOtherObjectiveResultObjIdx()");
02139 if (optimization->solution[solIdx]->objectives->other[ otherIdx] == NULL) return -1;
02140 if (optimization->solution[solIdx]->objectives->other[ otherIdx]->obj == NULL) return -1;
02141 if (objIdx < 0 || objIdx >= optimization->solution[solIdx]->objectives->other[ otherIdx]->numberOfObj)
02142 throw ErrorClass("objIdx is outside of range in routine getOtherObjectiveResultObjIdx()");
02143 return optimization->solution[solIdx]->objectives->other[otherIdx]->obj[objIdx]->idx;
02144 }
02145
02146 string OSResult::getOtherObjectiveResultObj(int solIdx, int otherIdx, int objIdx){
02147 if (optimization == NULL || optimization->solution == NULL)
02148 throw ErrorClass("No solution defined");
02149 int iSolutions = this->getSolutionNumber();
02150 if (solIdx < 0 || solIdx >= iSolutions)
02151 throw ErrorClass("solIdx is outside of range in routine getOtherObjectiveResultObj()");
02152 if (optimization->solution[solIdx] == NULL) return "";
02153 if (optimization->solution[solIdx]->objectives == NULL) return "";
02154 if (optimization->solution[solIdx]->objectives->other == NULL) return "";
02155 if (otherIdx < 0 || otherIdx >= optimization->solution[solIdx]->objectives->numberOfOtherObjectiveResults)
02156 throw ErrorClass("otherIdx is outside of range in routine getOtherObjectiveResultObj()");
02157 if (optimization->solution[solIdx]->objectives->other[ otherIdx] == NULL) return "";
02158 if (optimization->solution[solIdx]->objectives->other[ otherIdx]->obj == NULL) return "";
02159 if (objIdx < 0 || objIdx >= optimization->solution[solIdx]->objectives->other[ otherIdx]->numberOfObj)
02160 throw ErrorClass("otherIdx is outside of range in routine getOtherObjectiveResultObj()");
02161 return optimization->solution[solIdx]->objectives->other[otherIdx]->obj[objIdx]->value;
02162 }
02163
02164 int OSResult::getNumberOfDualValues(int solIdx){
02165 if (optimization == NULL || optimization->solution == NULL)
02166 throw ErrorClass("No solution defined");
02167 int iSolutions = this->getSolutionNumber();
02168 if (solIdx < 0 || solIdx >= iSolutions)
02169 throw ErrorClass("solIdx is outside of range in routine getNumberOfDualValues()");
02170 if (optimization->solution[solIdx] == NULL) return -1;
02171 if (optimization->solution[solIdx]->constraints == NULL) return -1;
02172 if (optimization->solution[solIdx]->constraints->dualValues == NULL) return -1;
02173 return optimization->solution[solIdx]->constraints->dualValues->numberOfCon;
02174 }
02175
02176 int OSResult::getDualValueIdx(int solIdx, int conIdx){
02177 if (optimization == NULL || optimization->solution == NULL)
02178 throw ErrorClass("No solution defined");
02179 int iSolutions = this->getSolutionNumber();
02180 if (solIdx < 0 || solIdx >= iSolutions)
02181 throw ErrorClass("solIdx is outside of range in routine getDualValueIdx()");
02182 if (optimization->solution[solIdx] == NULL) return -1;
02183 if (optimization->solution[solIdx]->constraints == NULL) return -1;
02184 if (optimization->solution[solIdx]->constraints->dualValues == NULL) return -1;
02185 if (conIdx < 0 || conIdx >= optimization->solution[solIdx]->constraints->dualValues->numberOfCon)
02186 throw ErrorClass("conIdx is outside of range in routine getDualValueIdx()");
02187 return optimization->solution[solIdx]->constraints->dualValues->con[conIdx]->idx;
02188 }
02189
02190 double OSResult::getDualValue(int solIdx, int conIdx){
02191 if (optimization == NULL || optimization->solution == NULL)
02192 throw ErrorClass("No solution defined");
02193 int iSolutions = this->getSolutionNumber();
02194 if (solIdx < 0 || solIdx >= iSolutions)
02195 throw ErrorClass("solIdx is outside of range in routine getDualValue()");
02196 if (optimization->solution[solIdx] == NULL) return OSNAN;
02197 if (optimization->solution[solIdx]->constraints == NULL) return OSNAN;
02198 if (optimization->solution[solIdx]->constraints->dualValues == NULL) return OSNAN;
02199 if (conIdx < 0 || conIdx >= optimization->solution[solIdx]->constraints->dualValues->numberOfCon)
02200 throw ErrorClass("conIdx is outside of range in routine getDualValue()");
02201 return optimization->solution[solIdx]->constraints->dualValues->con[conIdx]->value;
02202 }
02203
02204 std::vector<IndexValuePair*> OSResult::getOptimalDualVariableValues(int solIdx){
02205 int numberOfCon;
02206 struct IndexValuePair *dualValPair;
02207 int iSolutions = this->getSolutionNumber();
02208 for(int i = 0; i < iSolutions; i++){
02209 if(i != solIdx) continue;
02210 if(optimization->solution[i] == NULL) continue;
02211 if(optimization->solution[i]->constraints == NULL) continue;
02212 if(optimization->solution[i]->constraints->dualValues == NULL) continue;
02213 if((optimization->solution[i]->status->type.find("ptimal") != string::npos && m_mdDualValues == NULL) ||
02214 optimization->solution[i]->status->type.compare("globallyOptimal") == 0){
02215 numberOfCon = optimization->solution[i]->constraints->dualValues->numberOfCon;
02216 for(int j = 0; j < numberOfCon; j++){
02217 dualValPair = new IndexValuePair();
02218 dualValPair->idx = optimization->solution[i]->constraints->dualValues->con[j]->idx;
02219 dualValPair->value = optimization->solution[i]->constraints->dualValues->con[j]->value;
02220 dualVals.push_back( dualValPair);
02221 }
02222 }
02223 if(optimization->solution[i]->status->type.compare("globallyOptimal") == 0){
02224 return dualVals;
02225 }
02226 }
02227 return dualVals;
02228 }
02229
02230
02231 int OSResult::getNumberOfOtherConstraintResults(int solIdx){
02232 if (optimization == NULL || optimization->solution == NULL)
02233 throw ErrorClass("No solution defined");
02234 int iSolutions = this->getSolutionNumber();
02235 if (solIdx < 0 || solIdx >= iSolutions)
02236 throw ErrorClass("solIdx is outside of range in routine getNumberOfOtherConstraintResults()");
02237 if (optimization->solution[solIdx]->constraints == NULL) return -1;
02238 if (optimization->solution[solIdx]->constraints->other == NULL) return -1;
02239 return optimization->solution[solIdx]->constraints->numberOfOtherConstraintResults;
02240 }
02241
02242
02243 string OSResult::getOtherConstraintResultName(int solIdx, int otherIdx){
02244 if (optimization == NULL || optimization->solution == NULL)
02245 throw ErrorClass("No solution defined");
02246 int iSolutions = this->getSolutionNumber();
02247 if (solIdx < 0 || solIdx >= iSolutions)
02248 throw ErrorClass("solIdx is outside of range in routine getOtherConstraintResultName()");
02249 if (optimization->solution[solIdx] == NULL) return "";
02250 if (optimization->solution[solIdx]->constraints == NULL) return "";
02251 if (optimization->solution[solIdx]->constraints->other == NULL) return "";
02252 if (otherIdx < 0 || otherIdx >= optimization->solution[solIdx]->constraints->numberOfOtherConstraintResults)
02253 throw ErrorClass("otherIdx is outside of range in routine getOtherConstraintResultName()");
02254 if (optimization->solution[solIdx]->constraints->other[ otherIdx] == NULL) return "";
02255 return optimization->solution[solIdx]->constraints->other[ otherIdx]->name;
02256 }
02257
02258 string OSResult::getOtherConstraintResultValue(int solIdx, int otherIdx){
02259 if (optimization == NULL || optimization->solution == NULL)
02260 throw ErrorClass("No solution defined");
02261 int iSolutions = this->getSolutionNumber();
02262 if (solIdx < 0 || solIdx >= iSolutions)
02263 throw ErrorClass("solIdx is outside of range in routine getOtherConstraintResultValue()");
02264 if (optimization->solution[solIdx] == NULL) return "";
02265 if (optimization->solution[solIdx]->constraints == NULL) return "";
02266 if (optimization->solution[solIdx]->constraints->other == NULL) return "";
02267 if (otherIdx < 0 || otherIdx >= optimization->solution[solIdx]->constraints->numberOfOtherConstraintResults)
02268 throw ErrorClass("otherIdx is outside of range in routine getOtherConstraintResultValue()");
02269 if (optimization->solution[solIdx]->constraints->other[ otherIdx] == NULL) return "";
02270 return optimization->solution[solIdx]->constraints->other[ otherIdx]->value;
02271 }
02272
02273 string OSResult::getOtherConstraintResultDescription(int solIdx, int otherIdx){
02274 if (optimization == NULL || optimization->solution == NULL)
02275 throw ErrorClass("No solution defined");
02276 int iSolutions = this->getSolutionNumber();
02277 if (solIdx < 0 || solIdx >= iSolutions)
02278 throw ErrorClass("solIdx is outside of range in routine getOtherConstraintResultDescription()");
02279 if (optimization->solution[solIdx] == NULL) return "";
02280 if (optimization->solution[solIdx]->constraints == NULL) return "";
02281 if (optimization->solution[solIdx]->constraints->other == NULL) return "";
02282 if (otherIdx < 0 || otherIdx >= optimization->solution[solIdx]->constraints->numberOfOtherConstraintResults)
02283 throw ErrorClass("otherIdx is outside of range in routine getOtherConstraintResultDescription()");
02284 if (optimization->solution[solIdx]->constraints->other[ otherIdx] == NULL) return "";
02285 return optimization->solution[solIdx]->constraints->other[ otherIdx]->description;
02286 }
02287
02288 int OSResult::getOtherConstraintResultNumberOfCon(int solIdx, int otherIdx){
02289 if (optimization == NULL || optimization->solution == NULL)
02290 throw ErrorClass("No solution defined");
02291 int iSolutions = this->getSolutionNumber();
02292 if (solIdx < 0 || solIdx >= iSolutions)
02293 throw ErrorClass("solIdx is outside of range in routine getOtherConstraintResultNumberOfCon()");
02294 if (optimization->solution[solIdx] == NULL) return -1;
02295 if (optimization->solution[solIdx]->constraints == NULL) return -1;
02296 if (optimization->solution[solIdx]->constraints->other == NULL) return -1;
02297 if (otherIdx < 0 || otherIdx >= optimization->solution[solIdx]->constraints->numberOfOtherConstraintResults)
02298 throw ErrorClass("otherIdx is outside of range in routine getOtherConstraintResultNumberOfCon()");
02299 if (optimization->solution[solIdx]->constraints->other[ otherIdx] == NULL) return -1;
02300 return optimization->solution[solIdx]->constraints->other[ otherIdx]->numberOfCon;
02301 }
02302
02303 int OSResult::getOtherConstraintResultConIdx(int solIdx, int otherIdx, int conIdx){
02304 if (optimization == NULL || optimization->solution == NULL)
02305 throw ErrorClass("No solution defined");
02306 int iSolutions = this->getSolutionNumber();
02307 if (solIdx < 0 || solIdx >= iSolutions)
02308 throw ErrorClass("solIdx is outside of range in routine getOtherConstraintResultConIdx()");
02309 if (optimization->solution[solIdx] == NULL) return -1;
02310 if (optimization->solution[solIdx]->constraints == NULL) return -1;
02311 if (optimization->solution[solIdx]->constraints->other == NULL) return -1;
02312 if (otherIdx < 0 || otherIdx >= optimization->solution[solIdx]->constraints->numberOfOtherConstraintResults)
02313 throw ErrorClass("otherIdx is outside of range in routine getOtherConstraintResultConIdx()");
02314 if (optimization->solution[solIdx]->constraints->other[ otherIdx] == NULL) return -1;
02315 if (optimization->solution[solIdx]->constraints->other[ otherIdx]->con == NULL) return -1;
02316 if (conIdx < 0 || conIdx >= optimization->solution[solIdx]->constraints->other[ otherIdx]->numberOfCon)
02317 throw ErrorClass("otherIdx is outside of range in routine getOtherConstraintResultConIdx()");
02318 return optimization->solution[solIdx]->constraints->other[otherIdx]->con[conIdx]->idx;
02319 }
02320
02321 string OSResult::getOtherConstraintResultCon(int solIdx, int otherIdx, int conIdx){
02322 if (optimization == NULL || optimization->solution == NULL)
02323 throw ErrorClass("No solution defined");
02324 int iSolutions = this->getSolutionNumber();
02325 if (solIdx < 0 || solIdx >= iSolutions)
02326 throw ErrorClass("solIdx is outside of range in routine getOtherConstraintResultCon()");
02327 if (optimization->solution[solIdx] == NULL) return "";
02328 if (optimization->solution[solIdx]->constraints == NULL) return "";
02329 if (optimization->solution[solIdx]->constraints->other == NULL) return "";
02330 if (otherIdx < 0 || otherIdx >= optimization->solution[solIdx]->constraints->numberOfOtherConstraintResults)
02331 throw ErrorClass("otherIdx is outside of range in routine getOtherConstraintResultCon()");
02332 if (optimization->solution[solIdx]->constraints->other[ otherIdx] == NULL) return "";
02333 if (optimization->solution[solIdx]->constraints->other[ otherIdx]->con == NULL) return "";
02334 if (conIdx < 0 || conIdx >= optimization->solution[solIdx]->constraints->other[ otherIdx]->numberOfCon)
02335 throw ErrorClass("otherIdx is outside of range in routine getOtherConstraintResultCon()");
02336 return optimization->solution[solIdx]->constraints->other[otherIdx]->con[conIdx]->value;
02337 }
02338
02339 int OSResult::getNumberOfOtherSolutionResults(int solIdx){
02340 if (optimization == NULL || optimization->solution == NULL)
02341 throw ErrorClass("No solution defined");
02342 int iSolutions = this->getSolutionNumber();
02343 if (solIdx < 0 || solIdx >= iSolutions)
02344 throw ErrorClass("solIdx is outside of range in routine getNumberOfOtherSolutionResults()");
02345 if (optimization->solution[solIdx] == NULL) return -1;
02346 if (optimization->solution[solIdx]->otherSolutionResults == NULL) return -1;
02347 return optimization->solution[solIdx]->otherSolutionResults->numberOfOtherSolutionResults;
02348 }
02349
02350 string OSResult::getOtherSolutionResultName(int solIdx, int otherIdx){
02351 if (optimization == NULL || optimization->solution == NULL)
02352 throw ErrorClass("No solution defined");
02353 int iSolutions = this->getSolutionNumber();
02354 if (solIdx < 0 || solIdx >= iSolutions)
02355 throw ErrorClass("solIdx is outside of range in routine getOtherSolutionResultName()");
02356 if (optimization->solution[solIdx] == NULL) return "";
02357 if (optimization->solution[solIdx]->otherSolutionResults == NULL) return "";
02358 if (otherIdx < 0 || otherIdx >= optimization->solution[solIdx]->otherSolutionResults->numberOfOtherSolutionResults)
02359 throw ErrorClass("otherIdx is outside of range in routine getOtherSolutionResultName()");
02360 if (optimization->solution[solIdx]->otherSolutionResults->otherSolutionResult[otherIdx] == NULL) return "";
02361 return optimization->solution[solIdx]->otherSolutionResults->otherSolutionResult[otherIdx]->name;
02362 }
02363
02364 string OSResult::getOtherSolutionResultCategory(int solIdx, int otherIdx){
02365 if (optimization == NULL || optimization->solution == NULL)
02366 throw ErrorClass("No solution defined");
02367 int iSolutions = this->getSolutionNumber();
02368 if (solIdx < 0 || solIdx >= iSolutions)
02369 throw ErrorClass("solIdx is outside of range in routine getOtherSolutionResultCategory()");
02370 if (optimization->solution[solIdx] == NULL) return "";
02371 if (optimization->solution[solIdx]->otherSolutionResults == NULL) return "";
02372 if (otherIdx < 0 || otherIdx >= optimization->solution[solIdx]->otherSolutionResults->numberOfOtherSolutionResults)
02373 throw ErrorClass("otherIdx is outside of range in routine getOtherSolutionResultCategory()");
02374 if (optimization->solution[solIdx]->otherSolutionResults->otherSolutionResult[otherIdx] == NULL) return "";
02375 return optimization->solution[solIdx]->otherSolutionResults->otherSolutionResult[otherIdx]->category;
02376 }
02377
02378 string OSResult::getOtherSolutionResultDescription(int solIdx, int otherIdx){
02379 if (optimization == NULL || optimization->solution == NULL)
02380 throw ErrorClass("No solution defined");
02381 int iSolutions = this->getSolutionNumber();
02382 if (solIdx < 0 || solIdx >= iSolutions)
02383 throw ErrorClass("solIdx is outside of range in routine getOtherSolutionResultDescription()");
02384 if (optimization->solution[solIdx] == NULL) return "";
02385 if (optimization->solution[solIdx]->otherSolutionResults == NULL) return "";
02386 if (otherIdx < 0 || otherIdx >= optimization->solution[solIdx]->otherSolutionResults->numberOfOtherSolutionResults)
02387 throw ErrorClass("otherIdx is outside of range in routine getOtherSolutionResultDescription()");
02388 if (optimization->solution[solIdx]->otherSolutionResults->otherSolutionResult[otherIdx] == NULL) return "";
02389 return optimization->solution[solIdx]->otherSolutionResults->otherSolutionResult[otherIdx]->description;
02390 }
02391
02392 int OSResult::getOtherSolutionResultNumberOfItems(int solIdx, int otherIdx){
02393 if (optimization == NULL || optimization->solution == NULL)
02394 throw ErrorClass("No solution defined");
02395 int iSolutions = this->getSolutionNumber();
02396 if (solIdx < 0 || solIdx >= iSolutions)
02397 throw ErrorClass("solIdx is outside of range in routine getOtherSolutionResultNumberOfItems()");
02398 if (optimization->solution[solIdx] == NULL) return -1;
02399 if (optimization->solution[solIdx]->otherSolutionResults == NULL) return -1;
02400 if (otherIdx < 0 || otherIdx >= optimization->solution[solIdx]->otherSolutionResults->numberOfOtherSolutionResults)
02401 throw ErrorClass("otherIdx is outside of range in routine getOtherSolutionResultNumberOfItems()");
02402 if (optimization->solution[solIdx]->otherSolutionResults->otherSolutionResult[otherIdx] == NULL) return -1;
02403 return optimization->solution[solIdx]->otherSolutionResults->otherSolutionResult[otherIdx]->numberOfItems;
02404 }
02405
02406 string OSResult::getOtherSolutionResultItem(int solIdx, int otherIdx, int itemIdx){
02407 if (optimization == NULL || optimization->solution == NULL)
02408 throw ErrorClass("No solution defined");
02409 int iSolutions = this->getSolutionNumber();
02410 if (solIdx < 0 || solIdx >= iSolutions)
02411 throw ErrorClass("solIdx is outside of range in routine getOtherSolutionResultItem()");
02412 if (optimization->solution[solIdx] == NULL) return "";
02413 if (optimization->solution[solIdx]->otherSolutionResults == NULL) return "";
02414 if (optimization->solution[solIdx]->otherSolutionResults->otherSolutionResult[otherIdx] == NULL) return "";
02415 if (otherIdx < 0 || otherIdx >= optimization->solution[solIdx]->otherSolutionResults->numberOfOtherSolutionResults)
02416 throw ErrorClass("otherIdx is outside of range in routine getOtherSolutionResultItem()");
02417 if (optimization->solution[solIdx]->otherSolutionResults->otherSolutionResult[otherIdx]->item == NULL) return "";
02418 if (itemIdx < 0 || itemIdx >= optimization->solution[solIdx]->otherSolutionResults->otherSolutionResult[otherIdx]->numberOfItems)
02419 throw ErrorClass("itemIdx is outside of range in routine getOtherSolutionResultItem()");
02420 return optimization->solution[solIdx]->otherSolutionResults->otherSolutionResult[otherIdx]->item[itemIdx];
02421 }
02422
02423 int OSResult::getNumberOfSolverOutputs(){
02424 if (optimization == NULL || optimization->otherSolverOutput == NULL) return -1;
02425 return optimization->otherSolverOutput->numberOfSolverOutputs;
02426 }
02427
02428 string OSResult::getSolverOutputName(int otherIdx){
02429 if (optimization == NULL) return "";
02430 if (optimization->otherSolverOutput == NULL) return "";
02431 if (otherIdx < 0 || otherIdx >= optimization->otherSolverOutput->numberOfSolverOutputs)
02432 throw ErrorClass("otherIdx is outside of range in routine getSolverOutputName()");
02433 if (optimization->otherSolverOutput->solverOutput[otherIdx] == NULL) return "";
02434 return optimization->otherSolverOutput->solverOutput[otherIdx]->name;
02435 }
02436
02437 string OSResult::getSolverOutputCategory(int otherIdx){
02438 if (optimization == NULL) return "";
02439 if (optimization->otherSolverOutput == NULL) return "";
02440 if (otherIdx < 0 || otherIdx >= optimization->otherSolverOutput->numberOfSolverOutputs)
02441 throw ErrorClass("otherIdx is outside of range in routine getSolverOutputCategory()");
02442 if (optimization->otherSolverOutput->solverOutput[otherIdx] == NULL) return "";
02443 return optimization->otherSolverOutput->solverOutput[otherIdx]->category;
02444 }
02445
02446 string OSResult::getSolverOutputDescription(int otherIdx){
02447 if (optimization == NULL) return "";
02448 if (optimization->otherSolverOutput == NULL) return "";
02449 if (otherIdx < 0 || otherIdx >= optimization->otherSolverOutput->numberOfSolverOutputs)
02450 throw ErrorClass("otherIdx is outside of range in routine getSolverOutputDescription()");
02451 if (optimization->otherSolverOutput->solverOutput[otherIdx] == NULL) return "";
02452 return optimization->otherSolverOutput->solverOutput[otherIdx]->description;
02453 }
02454
02455 int OSResult::getSolverOutputNumberOfItems(int otherIdx){
02456 if (optimization == NULL) return -1;
02457 if (optimization->otherSolverOutput == NULL) return -1;
02458 if (otherIdx < 0 || otherIdx >= optimization->otherSolverOutput->numberOfSolverOutputs)
02459 throw ErrorClass("otherIdx is outside of range in routine getSolverOutputNumberOfItems()");
02460 if (optimization->otherSolverOutput->solverOutput[otherIdx] == NULL) return -1;
02461 return optimization->otherSolverOutput->solverOutput[otherIdx]->numberOfItems;
02462 }
02463
02464 string OSResult::getSolverOutputItem(int otherIdx, int itemIdx){
02465 if (optimization == NULL) return "";
02466 if (optimization->otherSolverOutput == NULL) return "";
02467 if (otherIdx < 0 || otherIdx >= optimization->otherSolverOutput->numberOfSolverOutputs)
02468 throw ErrorClass("otherIdx is outside of range in routine getSolverOutputItem");
02469 if (optimization->otherSolverOutput->solverOutput[otherIdx] == NULL) return "";
02470 if (itemIdx < 0 || itemIdx >= optimization->otherSolverOutput->solverOutput[otherIdx]->numberOfItems)
02471 throw ErrorClass("itemIdx is outside of range in routine getSolverOutputItem()");
02472 return optimization->otherSolverOutput->solverOutput[otherIdx]->item[itemIdx];;
02473 }
02474
02475
02476
02477
02478 bool OSResult::setGeneralStatus(GeneralStatus *status){
02479 if (general->generalStatus == NULL) general->generalStatus = new GeneralStatus();
02480 general->generalStatus = status;
02481 return true;
02482 }
02483
02484 bool OSResult::setGeneralStatusType(string type){
02485 if (verifyGeneralResultStatus(type) == 0) return false;
02486 if (general->generalStatus == NULL) general->generalStatus = new GeneralStatus();
02487 general->generalStatus->type = type;
02488 return true;
02489 }
02490
02491 bool OSResult::setGeneralStatusDescription(string description){
02492 if (general->generalStatus == NULL) general->generalStatus = new GeneralStatus();
02493 general->generalStatus->description = description;
02494 return true;
02495 }
02496
02497 bool OSResult::setNumberOfGeneralSubstatuses(int num){
02498 if (general->generalStatus == NULL) general->generalStatus = new GeneralStatus();
02499 if (num < 0) return false;
02500 if (general->generalStatus->substatus != NULL) return false;
02501 general->generalStatus->numberOfSubstatuses = num;
02502 if (num > 0)
02503 { general->generalStatus->substatus = new GeneralSubstatus*[num];
02504 for(int i = 0; i < num; i++)
02505 general->generalStatus->substatus[i] = new GeneralSubstatus();
02506 }
02507 return true;
02508 }
02509
02510 bool OSResult::setGeneralSubstatusName(int idx, string name){
02511 if (general->generalStatus == NULL) return false;
02512 if (idx < 0 || idx >= general->generalStatus->numberOfSubstatuses) return false;
02513 general->generalStatus->substatus[idx]->name = name;
02514 return true;
02515 }
02516
02517 bool OSResult::setGeneralSubstatusDescription(int idx, string description){
02518 if (general->generalStatus == NULL) return false;
02519 if (idx < 0 || idx >= general->generalStatus->numberOfSubstatuses) return false;
02520 general->generalStatus->substatus[idx]->description = description;
02521 return true;
02522 }
02523
02524 bool OSResult::setGeneralMessage(string message){
02525 general->message = message;
02526 return true;
02527 }
02528
02529 bool OSResult::setServiceName(string serviceName){
02530 general->serviceName = serviceName;
02531 return true;
02532 }
02533
02534 bool OSResult::setServiceURI(string serviceURI){
02535 general->serviceURI = serviceURI;
02536 return true;
02537 }
02538
02539 bool OSResult::setInstanceName(string instanceName){
02540 general->instanceName = instanceName;
02541 return true;
02542 }
02543
02544 bool OSResult::setJobID(string jobID){
02545 general->jobID = jobID;
02546 return true;
02547 }
02548
02549 bool OSResult::setSolverInvoked(string solverInvoked){
02550 general->solverInvoked = solverInvoked;
02551 return true;
02552 }
02553
02554 bool OSResult::setTimeStamp(string timeStamp){
02555 general->timeStamp = timeStamp;
02556 return true;
02557 }
02558
02559 bool OSResult::setNumberOfOtherGeneralResults(int num){
02560 if(general->otherResults == NULL) general->otherResults = new OtherResults();
02561 if (num < 0) return false;
02562 if (general->otherResults->other != NULL) return false;
02563 general->otherResults->numberOfOtherResults = num;
02564 if (num > 0)
02565 { general->otherResults->other = new OtherResult*[num];
02566 for(int i = 0; i < num; i++)
02567 general->otherResults->other[i] = new OtherResult();
02568 }
02569 return true;
02570 }
02571
02572
02573 bool OSResult::setOtherGeneralResultName(int idx, string name){
02574 if (general->otherResults == NULL) return false;
02575 if (idx < 0 || idx >= general->otherResults->numberOfOtherResults)
02576 return false;
02577 general->otherResults->other[idx]->name = name;
02578 return true;
02579 }
02580
02581 bool OSResult::setOtherGeneralResultValue(int idx, string value){
02582 if (general->otherResults == NULL) return false;
02583 if (idx < 0 || idx >= general->otherResults->numberOfOtherResults)
02584 return false;
02585 general->otherResults->other[idx]->value = value;
02586 return true;
02587 }
02588
02589 bool OSResult::setOtherGeneralResultDescription(int idx, string description){
02590 if (general->otherResults == NULL) return false;
02591 if (idx < 0 || idx >= general->otherResults->numberOfOtherResults)
02592 return false;
02593 general->otherResults->other[idx]->description = description;
02594 return true;
02595 }
02596
02597 bool OSResult::setSystemInformation(string systemInformation){
02598 system->systemInformation = systemInformation;
02599 return true;
02600 }
02601
02602 bool OSResult::setAvailableDiskSpaceUnit(std::string unit)
02603 {
02604 if (system == NULL) return false;
02605 if (system->availableDiskSpace == NULL) system->availableDiskSpace = new DiskSpace();
02606 if (verifyStorageUnit(unit) == false) return false;
02607 system->availableDiskSpace->unit = unit;
02608 return true;
02609 }
02610
02611 bool OSResult::setAvailableDiskSpaceDescription(std::string description)
02612 { if (system->availableDiskSpace == NULL) system->availableDiskSpace = new DiskSpace();
02613 system->availableDiskSpace->description = description;
02614 return true;
02615 }
02616
02617 bool OSResult::setAvailableDiskSpaceValue(double value)
02618 { if (system->availableDiskSpace == NULL) system->availableDiskSpace = new DiskSpace();
02619 system->availableDiskSpace->value = value;
02620 return true;
02621 }
02622
02623 bool OSResult::setAvailableMemoryUnit(std::string unit)
02624 {
02625 if (system == NULL) return false;
02626 if (system->availableMemory == NULL) system->availableMemory = new MemorySize();
02627 if (verifyStorageUnit(unit) == false) return false;
02628 system->availableMemory->unit = unit;
02629 return true;
02630 }
02631
02632 bool OSResult::setAvailableMemoryDescription(std::string description)
02633 { if (system->availableMemory == NULL) system->availableMemory = new MemorySize();
02634 system->availableMemory->description = description;
02635 return true;
02636 }
02637
02638 bool OSResult::setAvailableMemoryValue(double value)
02639 { if (system->availableMemory == NULL) system->availableMemory = new MemorySize();
02640 system->availableMemory->value = value;
02641 return true;
02642 }
02643
02644 bool OSResult::setAvailableCPUSpeedUnit(std::string unit)
02645 {
02646 if (system == NULL) return false;
02647 if (system->availableCPUSpeed == NULL) system->availableCPUSpeed = new CPUSpeed();
02648 if (verifyCPUSpeedUnit(unit) == false) return false;
02649 system->availableCPUSpeed->unit = unit;
02650 return true;
02651 }
02652
02653 bool OSResult::setAvailableCPUSpeedDescription(std::string description)
02654 { if (system->availableCPUSpeed == NULL) system->availableCPUSpeed = new CPUSpeed();
02655 system->availableCPUSpeed->description = description;
02656 return true;
02657 }
02658
02659 bool OSResult::setAvailableCPUSpeedValue(double value)
02660 { if (system->availableCPUSpeed == NULL) system->availableCPUSpeed = new CPUSpeed();
02661 system->availableCPUSpeed->value = value;
02662 return true;
02663 }
02664
02665 bool OSResult::setAvailableCPUNumberDescription(std::string description)
02666 { if (system->availableCPUNumber == NULL) system->availableCPUNumber = new CPUNumber();
02667 system->availableCPUNumber->description = description;
02668 return true;
02669 }
02670
02671 bool OSResult::setAvailableCPUNumberValue(int value)
02672 { if (system->availableCPUNumber == NULL) system->availableCPUNumber = new CPUNumber();
02673 system->availableCPUNumber->value = value;
02674 return true;
02675 }
02676
02677 bool OSResult::setNumberOfOtherSystemResults(int num){
02678 if(system->otherResults == NULL) system->otherResults = new OtherResults();
02679 if (num < 0) return false;
02680 if (system->otherResults->other != NULL) return false;
02681 system->otherResults->numberOfOtherResults = num;
02682 if (num > 0)
02683 { system->otherResults->other = new OtherResult*[num];
02684 for(int i = 0; i < num; i++)
02685 system->otherResults->other[i] = new OtherResult();
02686 }
02687 return true;
02688 }
02689
02690
02691 bool OSResult::setOtherSystemResultName(int idx, string name){
02692 if (system->otherResults == NULL) return false;
02693 if (idx < 0 || idx >= system->otherResults->numberOfOtherResults)
02694 return false;
02695 system->otherResults->other[idx]->name = name;
02696 return true;
02697 }
02698
02699 bool OSResult::setOtherSystemResultValue(int idx, string value){
02700 if (system->otherResults == NULL) return false;
02701 if (idx < 0 || idx >= system->otherResults->numberOfOtherResults)
02702 return false;
02703 system->otherResults->other[idx]->value = value;
02704 return true;
02705 }
02706
02707 bool OSResult::setOtherSystemResultDescription(int idx, string description){
02708 if (system->otherResults == NULL) return false;
02709 if (idx < 0 || idx >= system->otherResults->numberOfOtherResults)
02710 return false;
02711 system->otherResults->other[idx]->description = description;
02712 return true;
02713 }
02714
02715 bool OSResult::setCurrentState(std::string currentState){
02716 if(verifySystemCurrentState(currentState) == 0) return false;
02717 service->currentState = currentState;
02718 return true;
02719 }
02720
02721 bool OSResult::setCurrentJobCount(int jobCount){
02722 service->currentJobCount = jobCount;
02723 return true;
02724 }
02725
02726 bool OSResult::setTotalJobsSoFar(int number){
02727 service->totalJobsSoFar = number;
02728 return true;
02729 }
02730
02731 bool OSResult::setTimeServiceStarted(std::string startTime){
02732 service->timeServiceStarted = startTime;
02733 return true;
02734 }
02735
02736 bool OSResult::setServiceUtilization(double value){
02737 service->serviceUtilization = value;
02738 return true;
02739 }
02740
02741 bool OSResult::setNumberOfOtherServiceResults(int num){
02742 if(service->otherResults == NULL) service->otherResults = new OtherResults();
02743 if (num < 0) return false;
02744 if (service->otherResults->other != NULL) return false;
02745 service->otherResults->numberOfOtherResults = num;
02746 if (num > 0)
02747 { service->otherResults->other = new OtherResult*[num];
02748 for(int i = 0; i < num; i++)
02749 service->otherResults->other[i] = new OtherResult();
02750 }
02751 return true;
02752 }
02753
02754 bool OSResult::setOtherServiceResultName(int idx, string name){
02755 if (service->otherResults == NULL) return false;
02756 if (idx < 0 || idx >= service->otherResults->numberOfOtherResults)
02757 return false;
02758 service->otherResults->other[idx]->name = name;
02759 return true;
02760 }
02761
02762 bool OSResult::setOtherServiceResultValue(int idx, string value){
02763 if (service->otherResults == NULL) return false;
02764 if (idx < 0 || idx >= service->otherResults->numberOfOtherResults)
02765 return false;
02766 service->otherResults->other[idx]->value = value;
02767 return true;
02768 }
02769
02770 bool OSResult::setOtherServiceResultDescription(int idx, string description){
02771 if (service->otherResults == NULL) return false;
02772 if (idx < 0 || idx >= service->otherResults->numberOfOtherResults)
02773 return false;
02774 service->otherResults->other[idx]->description = description;
02775 return true;
02776 }
02777
02778 bool OSResult::setJobStatus(std::string status){
02779 if (verifyJobStatus(status) == 0)
02780 return false;
02781 job->status = status;
02782 return true;
02783 }
02784
02785 bool OSResult::setJobSubmitTime(std::string submitTime){
02786 job->submitTime = submitTime;
02787 return true;
02788 }
02789
02790 bool OSResult::setScheduledStartTime(std::string scheduledStartTime){
02791 job->scheduledStartTime = scheduledStartTime;
02792 return true;
02793 }
02794
02795 bool OSResult::setActualStartTime(std::string actualStartTime){
02796 job->actualStartTime = actualStartTime;
02797 return true;
02798 }
02799
02800 bool OSResult::setJobEndTime(std::string endTime){
02801 job->endTime = endTime;
02802 return true;
02803 }
02804
02805 bool OSResult::setTime(double time){
02806
02807 return addTimingInformation("elapsedTime", "total", "second", "", time);
02808 }
02809
02810 bool OSResult::addTimingInformation(std::string type, std::string category,
02811 std::string unit, std::string description, double value)
02812 { int nt; int i;
02813 if (verifyTimeUnit(unit) != true)
02814 throw ErrorClass("Invalid unit of time in addTimingInformation()");
02815 if (job == NULL) job = new JobResult();
02816 if (job->timingInformation == NULL) job->timingInformation = new TimingInformation();
02817
02818 nt = job->timingInformation->numberOfTimes;
02819 Time** temp = new Time*[nt+1];
02820 for (i = 0; i < nt; i++)
02821 temp[i] = job->timingInformation->time[i];
02822
02823 delete[] job->timingInformation->time;
02824
02825
02826 temp[ nt] = new Time();
02827
02828 temp[ nt]->type = type;
02829 temp[ nt]->category = category;
02830 temp[ nt]->unit = unit;
02831 temp[ nt]->description = description;
02832 temp[ nt]->value = value;
02833
02834 job->timingInformation->time = temp;
02835 job->timingInformation->numberOfTimes = ++nt;
02836
02837 return true;
02838 }
02839
02840
02841 bool OSResult::setTimingInformation(int idx, std::string type, std::string category,
02842 std::string unit, std::string description, double value)
02843 {
02844 if (job == NULL) return false;
02845 if (job->timingInformation == NULL) return false;
02846 if (idx < 0 || idx >= job->timingInformation->numberOfTimes)
02847 return false;
02848
02849 if (verifyTimeUnit(unit) == 0) return false;
02850 if (verifyTimeType(type) == 0) return false;
02851 if (verifyTimeCategory(category) == 0) return false;
02852
02853 job->timingInformation->time[idx]->type = type;
02854 job->timingInformation->time[idx]->category = category;
02855 job->timingInformation->time[idx]->unit = unit;
02856 job->timingInformation->time[idx]->description = description;
02857 job->timingInformation->time[idx]->value = value;
02858
02859 return true;
02860 }
02861
02862
02863 bool OSResult::setNumberOfTimes(int numberOfTimes)
02864 { if (job == NULL)
02865 return false;
02866 if (job->timingInformation == NULL) job->timingInformation = new TimingInformation();
02867 if (numberOfTimes <= 0) return false;
02868 job->timingInformation->numberOfTimes = numberOfTimes;
02869 if (numberOfTimes > 0)
02870 { job->timingInformation->time = new Time*[numberOfTimes];
02871 for(int i = 0; i < numberOfTimes; i++)
02872 job->timingInformation->time[i] = new Time();
02873 }
02874 return true;
02875 }
02876
02877 bool OSResult::setTimeNumber(int timeNumber)
02878 { if (job == NULL)
02879 return false;
02880 if (job->timingInformation == NULL) job->timingInformation = new TimingInformation();
02881 if (timeNumber <= 0) return false;
02882 job->timingInformation->numberOfTimes = timeNumber;
02883 return true;
02884 }
02885
02886 bool OSResult::setUsedDiskSpaceUnit(std::string unit)
02887 { if (job == NULL)
02888 return false;
02889 if (job->usedDiskSpace == NULL) job->usedDiskSpace = new DiskSpace();
02890 if (verifyStorageUnit(unit) == 0) return false;
02891 job->usedDiskSpace->unit = unit;
02892 return true;
02893 }
02894
02895 bool OSResult::setUsedDiskSpaceDescription(std::string description)
02896 { if (job == NULL)
02897 return false;
02898 if (job->usedDiskSpace == NULL) job->usedDiskSpace = new DiskSpace();
02899 job->usedDiskSpace->description = description;
02900 return true;
02901 }
02902
02903 bool OSResult::setUsedDiskSpaceValue(double value)
02904 { if (job == NULL)
02905 return false;
02906 if (job->usedDiskSpace == NULL) job->usedDiskSpace = new DiskSpace();
02907 job->usedDiskSpace->value = value;
02908 return true;
02909 }
02910
02911 bool OSResult::setUsedMemoryUnit(std::string unit)
02912 { if (job == NULL)
02913 return false;
02914 if (job->usedMemory == NULL) job->usedMemory = new MemorySize();
02915 if (verifyStorageUnit(unit) == 0) return false;
02916 job->usedMemory->unit = unit;
02917 return true;
02918 }
02919
02920 bool OSResult::setUsedMemoryDescription(std::string description)
02921 { if (job == NULL)
02922 return false;
02923 if (job->usedMemory == NULL) job->usedMemory = new MemorySize();
02924 job->usedMemory->description = description;
02925 return true;
02926 }
02927
02928 bool OSResult::setUsedMemoryValue(double value)
02929 { if (job == NULL)
02930 return false;
02931 if (job->usedMemory == NULL) job->usedMemory = new MemorySize();
02932 job->usedMemory->value = value;
02933 return true;
02934 }
02935
02936 bool OSResult::setUsedCPUSpeedUnit(std::string unit)
02937 { if (job == NULL)
02938 return false;
02939 if (job->usedCPUSpeed == NULL) job->usedCPUSpeed = new CPUSpeed();
02940 if ( verifyCPUSpeedUnit(unit) == 0) return false;
02941 job->usedCPUSpeed->unit = unit;
02942 return true;
02943 }
02944
02945 bool OSResult::setUsedCPUSpeedDescription(std::string description)
02946 { if (job == NULL)
02947 return false;
02948 if (job->usedCPUSpeed == NULL) job->usedCPUSpeed = new CPUSpeed();
02949 job->usedCPUSpeed->description = description;
02950 return true;
02951 }
02952
02953 bool OSResult::setUsedCPUSpeedValue(double value)
02954 { if (job == NULL)
02955 return false;
02956 if (job->usedCPUSpeed == NULL) job->usedCPUSpeed = new CPUSpeed();
02957 job->usedCPUSpeed->value = value;
02958 return true;
02959 }
02960
02961 bool OSResult::setUsedCPUNumberDescription(std::string description)
02962 { if (job == NULL)
02963 return false;
02964 if (job->usedCPUNumber == NULL) job->usedCPUNumber = new CPUNumber();
02965 job->usedCPUNumber->description = description;
02966 return true;
02967 }
02968
02969 bool OSResult::setUsedCPUNumberValue(int value)
02970 { if (job == NULL)
02971 return false;
02972 if (job->usedCPUNumber == NULL) job->usedCPUNumber = new CPUNumber();
02973 job->usedCPUNumber->value = value;
02974 return true;
02975 }
02976
02977 bool OSResult::setNumberOfOtherJobResults(int num){
02978 if (job == NULL) return false;
02979 if (job->otherResults == NULL) job->otherResults = new OtherResults();
02980 if (num < 0) return false;
02981 if (job->otherResults->other != NULL) return false;
02982 job->otherResults->numberOfOtherResults = num;
02983 if (num > 0)
02984 { job->otherResults->other = new OtherResult*[num];
02985 for(int i = 0; i < num; i++)
02986 job->otherResults->other[i] = new OtherResult();
02987 }
02988 return true;
02989 }
02990
02991
02992 bool OSResult::setOtherJobResultName(int idx, string name){
02993 if (job == NULL)
02994 return false;
02995 if (job->otherResults == NULL) return false;
02996 if (idx < 0 || idx >= job->otherResults->numberOfOtherResults)
02997 return false;
02998 job->otherResults->other[idx]->name = name;
02999 return true;
03000 }
03001
03002 bool OSResult::setOtherJobResultValue(int idx, string value){
03003 if (job == NULL)
03004 return false;
03005 if (job->otherResults == NULL) return false;
03006 if (idx < 0 || idx >= job->otherResults->numberOfOtherResults)
03007 return false;
03008 job->otherResults->other[idx]->value = value;
03009 return true;
03010 }
03011
03012 bool OSResult::setOtherJobResultDescription(int idx, string description){
03013 if (job == NULL)
03014 return false;
03015 if (job->otherResults == NULL) return false;
03016 if (idx < 0 || idx >= job->otherResults->numberOfOtherResults)
03017 return false;
03018 job->otherResults->other[idx]->description = description;
03019 return true;
03020 }
03021
03022
03023 bool OSResult::setVariableNumber(int variableNumber){
03024 if(variableNumber < 0)
03025 return false;
03026 if(optimization == NULL) optimization = new OptimizationResult();
03027 optimization->numberOfVariables = variableNumber;
03028 return true;
03029 }
03030
03031 bool OSResult::setObjectiveNumber(int objectiveNumber){
03032 if(objectiveNumber < 0)
03033 return false;
03034 if(optimization == NULL) optimization = new OptimizationResult();
03035 optimization->numberOfObjectives = objectiveNumber;
03036 return true;
03037 }
03038
03039 bool OSResult::setConstraintNumber(int constraintNumber){
03040 if(constraintNumber < 0)
03041 return false;
03042 if(optimization == NULL) optimization = new OptimizationResult();
03043 optimization->numberOfConstraints = constraintNumber;
03044 return true;
03045 }
03046
03047 bool OSResult::setSolutionNumber(int number){
03048 if(number < 0) return false;
03049 if(number == 0) return true;
03050 if(optimization == NULL) optimization = new OptimizationResult();
03051 optimization->numberOfSolutions = number;
03052 optimization->solution = new OptimizationSolution*[number];
03053 for(int i = 0; i < number; i++){
03054 optimization->solution[i] = new OptimizationSolution();
03055 }
03056 return true;
03057 }
03058
03059 bool OSResult::setSolutionStatus(int solIdx, string type, string description){
03060 int nSols = this->getSolutionNumber();
03061 if(optimization == NULL) return false;
03062 if(nSols <= 0) return false;
03063 if(optimization->solution == NULL ||
03064 solIdx < 0 || solIdx >= nSols) return false;
03065 if(optimization->solution[solIdx] == NULL)
03066 optimization->solution[solIdx] = new OptimizationSolution();
03067 if(optimization->solution[solIdx]->status == NULL)
03068 optimization->solution[solIdx]->status = new OptimizationSolutionStatus();
03069
03070 if (verifySolutionStatus(type) == false) return false;
03071
03072 optimization->solution[solIdx]->status->type = type;
03073 optimization->solution[solIdx]->status->description = description;
03074 return true;
03075 }
03076
03077 bool OSResult::setSolutionStatusType(int solIdx, std::string type){
03078 int nSols = this->getSolutionNumber();
03079 if(optimization == NULL) return false;
03080 if(nSols <= 0) return false;
03081 if(optimization->solution == NULL ||
03082 solIdx < 0 || solIdx >= nSols) return false;
03083 if(optimization->solution[solIdx] == NULL)
03084 optimization->solution[solIdx] = new OptimizationSolution();
03085 if(optimization->solution[solIdx]->status == NULL)
03086 optimization->solution[solIdx]->status = new OptimizationSolutionStatus();
03087
03088 if (verifySolutionStatus(type) == false) return false;
03089
03090 optimization->solution[solIdx]->status->type = type;
03091 return true;
03092 }
03093
03094 bool OSResult::setSolutionStatusDescription(int solIdx, std::string description){
03095 int nSols = this->getSolutionNumber();
03096 if(optimization == NULL) return false;
03097 if(nSols <= 0) return false;
03098 if(optimization->solution == NULL ||
03099 solIdx < 0 || solIdx >= nSols) return false;
03100 if(optimization->solution[solIdx] == NULL){
03101 optimization->solution[solIdx] = new OptimizationSolution();
03102 }
03103 if(optimization->solution[solIdx]->status == NULL){
03104 optimization->solution[solIdx]->status = new OptimizationSolutionStatus();
03105 }
03106 optimization->solution[solIdx]->status->description = description;
03107 return true;
03108 }
03109
03110 bool OSResult::setNumberOfSolutionSubstatuses(int solIdx, int num){
03111 int nSols = this->getSolutionNumber();
03112 if (optimization == NULL) return false;
03113 if (nSols <= 0) return false;
03114 if (optimization->solution == NULL ||
03115 solIdx < 0 || solIdx >= nSols) return false;
03116 if (optimization->solution[solIdx] == NULL){
03117 optimization->solution[solIdx] = new OptimizationSolution();
03118 }
03119 if (optimization->solution[solIdx]->status == NULL){
03120 optimization->solution[solIdx]->status = new OptimizationSolutionStatus();
03121 }
03122 if (num < 0) return false;
03123 if (optimization->solution[solIdx]->status->substatus != NULL) return false;
03124 optimization->solution[solIdx]->status->numberOfSubstatuses = num;
03125 if (num > 0)
03126 { optimization->solution[solIdx]->status->substatus = new OptimizationSolutionSubstatus*[num];
03127 for(int i = 0; i < num; i++){
03128 optimization->solution[solIdx]->status->substatus[i] = new OptimizationSolutionSubstatus();
03129 }
03130 }
03131 return true;
03132 }
03133
03134 bool OSResult::setSolutionSubstatusType(int solIdx, int substatusIdx, std::string type){
03135 int nSols = this->getSolutionNumber();
03136 if(optimization == NULL) return false;
03137 if(optimization->solution == NULL ||
03138 solIdx < 0 || solIdx >= nSols) return false;
03139 if(optimization->solution[solIdx] == NULL) return false;
03140 if(optimization->solution[solIdx]->status == NULL) return false;
03141 int nSubs = optimization->solution[solIdx]->status->numberOfSubstatuses;
03142 if (substatusIdx < 0 || substatusIdx >= nSubs) return false;
03143
03144 if (verifySolutionSubstatusType(type) == 0) return false;
03145
03146 optimization->solution[solIdx]->status->substatus[substatusIdx]->type = type;
03147 return true;
03148 }
03149
03150 bool OSResult::setSolutionSubstatusDescription(int solIdx, int substatusIdx, std::string description){
03151 int nSols = this->getSolutionNumber();
03152 if(optimization == NULL) return false;
03153 if(optimization->solution == NULL ||
03154 solIdx < 0 || solIdx >= nSols) return false;
03155 if(optimization->solution[solIdx] == NULL) return false;
03156 if(optimization->solution[solIdx]->status == NULL) return false;
03157 int nSubs = optimization->solution[solIdx]->status->numberOfSubstatuses;
03158 if (substatusIdx < 0 || substatusIdx >= nSubs) return false;
03159 optimization->solution[solIdx]->status->substatus[substatusIdx]->description = description;
03160 return true;
03161 }
03162
03163 bool OSResult::setSolutionTargetObjectiveIdx(int solIdx, int objectiveIdx){
03164 int nSols = this->getSolutionNumber();
03165 if(optimization == NULL) return false;
03166 if(nSols <= 0) return false;
03167 if(optimization == NULL) return false;
03168 if(optimization->solution == NULL ||
03169 solIdx < 0 || solIdx >= nSols) return false;
03170 if(optimization->solution[solIdx] == NULL){
03171 optimization->solution[solIdx] = new OptimizationSolution();
03172 }
03173 if(objectiveIdx >= 0) return false;
03174 optimization->solution[solIdx]->targetObjectiveIdx = objectiveIdx;
03175 return true;
03176 }
03177
03178 bool OSResult::setSolutionWeightedObjectives(int solIdx, bool weightedObjectives){
03179 int nSols = this->getSolutionNumber();
03180 if (optimization == NULL) return false;
03181 if (nSols <= 0) return false;
03182 if (optimization == NULL) return false;
03183 if (optimization->solution == NULL ||
03184 solIdx < 0 || solIdx >= nSols) return false;
03185 if (optimization->solution[solIdx] == NULL)
03186 optimization->solution[solIdx] = new OptimizationSolution();
03187 optimization->solution[solIdx]->weightedObjectives = weightedObjectives;
03188 return true;
03189 }
03190
03191 bool OSResult::setSolutionMessage(int solIdx, std::string msg){
03192 int nSols = this->getSolutionNumber();
03193 if(optimization == NULL) return false;
03194 if(nSols <= 0) return false;
03195 if(optimization == NULL) return false;
03196 if(optimization->solution == NULL ||
03197 solIdx < 0 || solIdx >= nSols) return false;
03198 if(optimization->solution[solIdx] == NULL){
03199 optimization->solution[solIdx] = new OptimizationSolution();
03200 }
03201 optimization->solution[solIdx]->message = msg;
03202 return true;
03203 }
03204
03205 bool OSResult::setNumberOfPrimalVariableValues(int solIdx, int numberOfVar){
03206 int nSols = this->getSolutionNumber();
03207 int nVar = this->getVariableNumber();
03208 if (numberOfVar <= 0 || numberOfVar > nVar) return false;
03209 if (optimization == NULL) return false;
03210 if (nSols <= 0) return false;
03211 if (optimization->solution == NULL ||
03212 solIdx < 0 || solIdx >= nSols) return false;
03213 if (optimization->solution[solIdx] == NULL){
03214 optimization->solution[solIdx] = new OptimizationSolution();
03215 }
03216 if (optimization->solution[solIdx]->variables == NULL){
03217 optimization->solution[solIdx]->variables = new VariableSolution();
03218 }
03219 if (optimization->solution[solIdx]->variables->values == NULL){
03220 optimization->solution[solIdx]->variables->values = new VariableValues();
03221 }
03222 if (numberOfVar < 0) return false;
03223 if (optimization->solution[solIdx]->variables->values->var != NULL) return false;
03224 optimization->solution[solIdx]->variables->values->numberOfVar = numberOfVar;
03225 if (numberOfVar > 0)
03226 optimization->solution[solIdx]->variables->values->var = new VarValue*[numberOfVar];
03227 return true;
03228 }
03229
03230 bool OSResult::setPrimalVariableValuesSparse(int solIdx, std::vector<IndexValuePair*> x){
03231 int nSols = this->getSolutionNumber();
03232 int numberOfVar = x.size();
03233 if(optimization == NULL) return false;
03234 if(nSols <= 0) return false;
03235 if(optimization->solution == NULL ||
03236 solIdx < 0 || solIdx >= nSols) return false;
03237 if(optimization->solution[solIdx] == NULL){
03238 optimization->solution[solIdx] = new OptimizationSolution();
03239 }
03240 if(optimization->solution[solIdx]->variables == NULL){
03241 optimization->solution[solIdx]->variables = new VariableSolution();
03242 }
03243 if (optimization->solution[solIdx]->variables->values == NULL){
03244 optimization->solution[solIdx]->variables->values = new VariableValues();
03245 }
03246 if (optimization->solution[solIdx]->variables->values->var == NULL){
03247 optimization->solution[solIdx]->variables->values->var = new VarValue*[numberOfVar];
03248 }
03249 optimization->solution[solIdx]->variables->values->numberOfVar = numberOfVar;
03250 if(x.size() == 0){
03251
03252 return true;
03253 }
03254 for(int i = 0; i < numberOfVar; i++){
03255 optimization->solution[solIdx]->variables->values->var[i] = new VarValue();
03256 optimization->solution[solIdx]->variables->values->var[i]->idx = x[i]->idx;
03257 optimization->solution[solIdx]->variables->values->var[i]->value = x[i]->value;
03258 }
03259 return true;
03260 }
03261
03262 bool OSResult::setPrimalVariableValuesDense(int solIdx, double *x){
03263 int numberOfVar = this->getVariableNumber();
03264 int nSols = this->getSolutionNumber();
03265 if(optimization == NULL) return false;
03266 if(nSols <= 0) return false;
03267 if(optimization->solution == NULL ||
03268 solIdx < 0 || solIdx >= nSols) return false;
03269 if(optimization->solution[solIdx] == NULL){
03270 optimization->solution[solIdx] = new OptimizationSolution();
03271 }
03272 if(optimization->solution[solIdx]->variables == NULL){
03273 optimization->solution[solIdx]->variables = new VariableSolution();
03274 }
03275 if(optimization->solution[solIdx]->variables->values == NULL){
03276 optimization->solution[solIdx]->variables->values = new VariableValues();
03277 }
03278 if(optimization->solution[solIdx]->variables->values->var == NULL){
03279 optimization->solution[solIdx]->variables->values->var = new VarValue*[numberOfVar];
03280 }
03281 optimization->solution[solIdx]->variables->values->numberOfVar = numberOfVar;
03282 if(x == NULL){
03283
03284 return true;
03285 }
03286 for(int i = 0; i < numberOfVar; i++){
03287 optimization->solution[solIdx]->variables->values->var[i] = new VarValue();
03288 optimization->solution[solIdx]->variables->values->var[i]->idx = i;
03289 optimization->solution[solIdx]->variables->values->var[i]->value = x[i];
03290 }
03291 return true;
03292 }
03293
03294 bool OSResult::setNumberOfVarValues(int solIdx, int numberOfVar){
03295 if (optimization == NULL || optimization->solution == NULL)
03296 {
03297 return false;
03298 }
03299 int nSols = optimization->numberOfSolutions;
03300 if (solIdx < 0 || solIdx >= nSols) return false;
03301 if (optimization->solution[solIdx] == NULL)
03302 optimization->solution[solIdx] = new OptimizationSolution();
03303 if (optimization->solution[solIdx]->variables == NULL)
03304 optimization->solution[solIdx]->variables = new VariableSolution();
03305 if (optimization->solution[solIdx]->variables->values == NULL)
03306 optimization->solution[solIdx]->variables->values = new VariableValues();
03307 if (optimization->solution[solIdx]->variables->values->numberOfVar > 0) return false;
03308 if (numberOfVar < 0) return false;
03309 if (optimization->solution[solIdx]->variables->values->var != NULL) return false;
03310 optimization->solution[solIdx]->variables->values->numberOfVar = numberOfVar;
03311 if (numberOfVar > 0)
03312 { optimization->solution[solIdx]->variables->values->var = new VarValue*[numberOfVar];
03313 for(int i = 0; i < numberOfVar; i++)
03314 optimization->solution[solIdx]->variables->values->var[i] = new VarValue();
03315 }
03316 return true;
03317 }
03318
03319 bool OSResult::setVarValue(int solIdx, int number, int idx, double val){
03320 if (optimization == NULL || optimization->solution == NULL)
03321 {
03322 return false;
03323 }
03324 int nSols = optimization->numberOfSolutions;
03325 if (solIdx < 0 || solIdx >= nSols)
03326 {
03327 return false;
03328 }
03329 if (optimization->solution[solIdx] == NULL)
03330 {
03331 return false;
03332 }
03333 if (optimization->solution[solIdx]->variables == NULL)
03334 {
03335 return false;
03336 }
03337 if (optimization->solution[solIdx]->variables->values == NULL)
03338 {
03339 return false;
03340 }
03341 int nVar = optimization->solution[solIdx]->variables->values->numberOfVar;
03342 if (number < 0 || number >= nVar)
03343 {
03344 return false;
03345 }
03346 if (idx < 0)
03347 {
03348 return false;
03349 }
03350 optimization->solution[solIdx]->variables->values->var[number]->idx = idx;
03351 optimization->solution[solIdx]->variables->values->var[number]->value = val;
03352 return true;
03353 }
03354
03355
03356 bool OSResult::setNumberOfVarValuesString(int solIdx, int numberOfVar){
03357 if (optimization == NULL || optimization->solution == NULL)
03358 {
03359 return false;
03360 }
03361 int nSols = optimization->numberOfSolutions;
03362 if (solIdx < 0 || solIdx >= nSols)
03363 {
03364 return false;
03365 }
03366 if (optimization->solution[solIdx] == NULL)
03367 optimization->solution[solIdx] = new OptimizationSolution();
03368 if (optimization->solution[solIdx]->variables == NULL)
03369 optimization->solution[solIdx]->variables = new VariableSolution();
03370 if (optimization->solution[solIdx]->variables->valuesString == NULL)
03371 optimization->solution[solIdx]->variables->valuesString = new VariableValuesString();
03372 if (optimization->solution[solIdx]->variables->valuesString->numberOfVar > 0)
03373 return false;
03374 if (numberOfVar < 0) return false;
03375 if (optimization->solution[solIdx]->variables->valuesString->var != NULL) return false;
03376 optimization->solution[solIdx]->variables->valuesString->numberOfVar = numberOfVar;
03377 if (numberOfVar > 0)
03378 { optimization->solution[solIdx]->variables->valuesString->var = new VarValueString*[numberOfVar];
03379 for(int i = 0; i < numberOfVar; i++)
03380 optimization->solution[solIdx]->variables->valuesString->var[i] = new VarValueString();
03381 }
03382 return true;
03383 }
03384
03385 bool OSResult::setVarValueString(int solIdx, int number, int idx, std::string str){
03386 if (optimization == NULL || optimization->solution == NULL)
03387 {
03388 return false;
03389 }
03390 int nSols = optimization->numberOfSolutions;
03391 if (solIdx < 0 || solIdx >= nSols)
03392 {
03393 return false;
03394 }
03395 if (optimization->solution[solIdx] == NULL)
03396 {
03397 return false;
03398 }
03399 if (optimization->solution[solIdx]->variables == NULL)
03400 {
03401 return false;
03402 }
03403 if (optimization->solution[solIdx]->variables->valuesString == NULL)
03404 {
03405 return false;
03406 }
03407 int nVar = optimization->solution[solIdx]->variables->valuesString->numberOfVar;
03408 if (number < 0 || number >= nVar)
03409 {
03410 return false;
03411 }
03412 if (idx < 0)
03413 {
03414 return false;
03415 }
03416 optimization->solution[solIdx]->variables->valuesString->var[number]->idx = idx;
03417 optimization->solution[solIdx]->variables->valuesString->var[number]->value = str;
03418 return true;
03419 }
03420
03421 bool OSResult::setBasisStatus(int solIdx, char object, int status, int *i, int ni)
03422 {
03423 if (optimization == NULL || optimization->solution == NULL)
03424 return false;
03425 int nSols = optimization->numberOfSolutions;
03426 if (solIdx < 0 || solIdx >= nSols)
03427 return false;
03428 if (optimization->solution[solIdx] == NULL)
03429 optimization->solution[solIdx] = new OptimizationSolution();
03430
03431 switch (object)
03432 {
03433 case 'v':
03434 {
03435 if (optimization->solution[solIdx]->variables == NULL)
03436 optimization->solution[solIdx]->variables = new VariableSolution();
03437 if (optimization->solution[solIdx]->variables->basisStatus == NULL)
03438 optimization->solution[solIdx]->variables->basisStatus = new BasisStatus();
03439 for (int j=0; j<ni; j++) if (i[j] < 0) return false;
03440 return optimization->solution[solIdx]->variables->basisStatus->setBasisStatusIntVector(status, i, ni);
03441 }
03442 case 'o':
03443 {
03444 if (optimization->solution[solIdx]->objectives == NULL)
03445 optimization->solution[solIdx]->objectives = new ObjectiveSolution();
03446 if (optimization->solution[solIdx]->objectives->basisStatus == NULL)
03447 optimization->solution[solIdx]->objectives->basisStatus = new BasisStatus();
03448 for (int j=0; j<ni; j++) if (i[j] >= 0) return false;
03449 return optimization->solution[solIdx]->objectives->basisStatus->setBasisStatusIntVector(status, i, ni);
03450 }
03451 case 'c':
03452 {
03453 if (optimization->solution[solIdx]->constraints == NULL)
03454 optimization->solution[solIdx]->constraints = new ConstraintSolution();
03455 if (optimization->solution[solIdx]->constraints->basisStatus == NULL)
03456 optimization->solution[solIdx]->constraints->basisStatus = new BasisStatus();
03457 for (int j=0; j<ni; j++) if (i[j] < 0) return false;
03458 return optimization->solution[solIdx]->constraints->basisStatus->setBasisStatusIntVector(status, i, ni);
03459 }
03460 default:
03461 throw ErrorClass("target object not implemented in setBasisStatus");
03462 }
03463 }
03464
03465 bool OSResult::setNumberOfOtherVariableResults(int solIdx, int num){
03466
03467
03468 int nSols = this->getSolutionNumber();
03469 if (nSols <= 0) return false;
03470 if (optimization == NULL) return false;
03471 if (optimization->solution == NULL ||
03472 solIdx < 0 || solIdx >= nSols) return false;
03473 if (optimization->solution[solIdx] == NULL)
03474 optimization->solution[solIdx] = new OptimizationSolution();
03475 if (optimization->solution[solIdx]->variables == NULL)
03476 optimization->solution[solIdx]->variables = new VariableSolution();
03477 if (num < 0) return false;
03478 if (optimization->solution[solIdx]->variables->other != NULL) return false;
03479 optimization->solution[solIdx]->variables->numberOfOtherVariableResults = num;
03480 if (num > 0)
03481 { optimization->solution[solIdx]->variables->other = new OtherVariableResult*[num];
03482 for(int i = 0; i < num; i++)
03483 optimization->solution[solIdx]->variables->other[ i] = new OtherVariableResult();
03484 }
03485 return true;
03486 }
03487
03488
03489 bool OSResult::setAnOtherVariableResultSparse(int solIdx, int otherIdx, string name, string value, string description, int *idx, string *s, int numberOfVar){
03490 int iNumberOfVariables = numberOfVar;
03491 if(iNumberOfVariables <= -1) return false;
03492 int nSols = this->getSolutionNumber();
03493 if(optimization == NULL) return false;
03494 if(nSols <= 0) return false;
03495 if(optimization == NULL) return false;
03496 if(optimization->solution == NULL ||
03497 solIdx < 0 || solIdx >= nSols) return false;
03498 if(optimization->solution[solIdx] == NULL) return false;
03499 if(optimization->solution[solIdx]->variables == NULL)return false;
03500 if(optimization->solution[solIdx]->variables->other == NULL) return false;
03501 if(optimization->solution[solIdx]->variables->other[ otherIdx] == NULL) return false;
03502 optimization->solution[solIdx]->variables->other[ otherIdx]->name = name;
03503 optimization->solution[solIdx]->variables->other[ otherIdx]->value = value;
03504 optimization->solution[solIdx]->variables->other[ otherIdx]->description = description;
03505 optimization->solution[solIdx]->variables->other[ otherIdx]->numberOfVar = numberOfVar;
03506 if (optimization->solution[solIdx]->variables->other[ otherIdx]->var == NULL)
03507 optimization->solution[solIdx]->variables->other[ otherIdx]->var = new OtherVarResult*[numberOfVar];
03508 for(int i = 0; i < numberOfVar; i++){
03509 optimization->solution[solIdx]->variables->other[ otherIdx]->var[i] = new OtherVarResult();
03510 optimization->solution[solIdx]->variables->other[ otherIdx]->var[i]->idx = idx[i];
03511 optimization->solution[solIdx]->variables->other[ otherIdx]->var[i]->value = s[i];
03512 }
03513 return true;
03514 }
03515
03516
03517 bool OSResult::setAnOtherVariableResultDense(int solIdx, int otherIdx, string name, string value, string description, string *s){
03518 int numberOfVar = this->getVariableNumber();
03519 int iNumberOfVariables = numberOfVar;
03520 if(iNumberOfVariables <= -1) return false;
03521 int nSols = this->getSolutionNumber();
03522 if(optimization == NULL) return false;
03523 if(nSols <= 0) return false;
03524 if(optimization == NULL) return false;
03525 if(optimization->solution == NULL ||
03526 solIdx < 0 || solIdx >= nSols) return false;
03527 if(optimization->solution[solIdx] == NULL) return false;
03528 if(optimization->solution[solIdx]->variables == NULL)return false;
03529 if(optimization->solution[solIdx]->variables->other == NULL) return false;
03530 if(optimization->solution[solIdx]->variables->other[ otherIdx] == NULL) return false;
03531 optimization->solution[solIdx]->variables->other[ otherIdx]->name = name;
03532 optimization->solution[solIdx]->variables->other[ otherIdx]->value = value;
03533 optimization->solution[solIdx]->variables->other[ otherIdx]->description = description;
03534 optimization->solution[solIdx]->variables->other[ otherIdx]->numberOfVar = numberOfVar;
03535 if(optimization->solution[solIdx]->variables->other[ otherIdx]->var == NULL)
03536 optimization->solution[solIdx]->variables->other[ otherIdx]->var = new OtherVarResult*[numberOfVar];
03537 for(int i = 0; i < numberOfVar; i++){
03538 optimization->solution[solIdx]->variables->other[ otherIdx]->var[i] = new OtherVarResult();
03539 optimization->solution[solIdx]->variables->other[ otherIdx]->var[i]->idx = i;
03540 optimization->solution[solIdx]->variables->other[ otherIdx]->var[i]->value = s[i];
03541 ;
03542 }
03543 return true;
03544 }
03545
03546 bool OSResult::setOtherVariableResultNumberOfVar(int solIdx, int otherIdx, int numberOfVar){
03547 int iNumberOfVariables = numberOfVar;
03548 if (iNumberOfVariables <= -1) return false;
03549 int nSols = this->getSolutionNumber();
03550 if (nSols <= 0) return false;
03551 if (optimization == NULL) return false;
03552 if (optimization->solution == NULL ||
03553 solIdx < 0 || solIdx >= nSols) return false;
03554 if (optimization->solution[solIdx] == NULL) return false;
03555 if (optimization->solution[solIdx]->variables == NULL) return false;
03556 if (optimization->solution[solIdx]->variables->other == NULL) return false;
03557 if (optimization->solution[solIdx]->variables->other[ otherIdx] == NULL) return false;
03558 if (optimization->solution[solIdx]->variables->other[ otherIdx]->var == NULL)
03559 optimization->solution[solIdx]->variables->other[ otherIdx]->var = new OtherVarResult*[numberOfVar];
03560 for(int i = 0; i < numberOfVar; i++)
03561 optimization->solution[solIdx]->variables->other[ otherIdx]->var[i] = new OtherVarResult();
03562 optimization->solution[solIdx]->variables->other[ otherIdx]->numberOfVar = numberOfVar;
03563 return true;
03564 }
03565
03566
03567 bool OSResult::setOtherVariableResultNumberOfEnumerations(int solIdx, int otherIdx, int numberOfEnumerations){
03568 int iNumberOfEnumerations = numberOfEnumerations;
03569 if (iNumberOfEnumerations <= -1) return false;
03570 int nSols = this->getSolutionNumber();
03571 if (nSols <= 0) return false;
03572 if (optimization == NULL) return false;
03573 if (optimization->solution == NULL ||
03574 solIdx < 0 || solIdx >= nSols) return false;
03575 if (optimization->solution[solIdx] == NULL) return false;
03576 if (optimization->solution[solIdx]->variables == NULL) return false;
03577 if (optimization->solution[solIdx]->variables->other == NULL) return false;
03578 if (optimization->solution[solIdx]->variables->other[ otherIdx] == NULL) return false;
03579 if (optimization->solution[solIdx]->variables->other[ otherIdx]->enumeration == NULL)
03580 optimization->solution[solIdx]->variables->other[ otherIdx]->enumeration = new OtherOptionEnumeration*[numberOfEnumerations];
03581 for(int i = 0; i < numberOfEnumerations; i++)
03582 optimization->solution[solIdx]->variables->other[ otherIdx]->enumeration[i] = new OtherOptionEnumeration();
03583 optimization->solution[solIdx]->variables->other[ otherIdx]->numberOfEnumerations = numberOfEnumerations;
03584 return true;
03585 }
03586
03587 bool OSResult::setOtherVariableResultName(int solIdx, int otherIdx, std::string name){
03588 int numberOfVar = this->getVariableNumber();
03589 int iNumberOfVariables = numberOfVar;
03590 if (iNumberOfVariables <= -1) return false;
03591 int nSols = this->getSolutionNumber();
03592 if (optimization == NULL) return false;
03593 if (nSols <= 0) return false;
03594 if (optimization == NULL) return false;
03595 if (optimization->solution == NULL ||
03596 solIdx < 0 || solIdx >= nSols) return false;
03597 if (optimization->solution[solIdx] == NULL) return false;
03598 if (optimization->solution[solIdx]->variables == NULL)return false;
03599 if (optimization->solution[solIdx]->variables->other == NULL) return false;
03600 if (optimization->solution[solIdx]->variables->other[ otherIdx] == NULL) return false;
03601 optimization->solution[solIdx]->variables->other[ otherIdx]->name = name;
03602 return true;
03603 }
03604
03605 bool OSResult::setOtherVariableResultValue(int solIdx, int otherIdx, std::string value){
03606 int numberOfVar = this->getVariableNumber();
03607 int iNumberOfVariables = numberOfVar;
03608 if (iNumberOfVariables <= -1) return false;
03609 int nSols = this->getSolutionNumber();
03610 if (optimization == NULL) return false;
03611 if (nSols <= 0) return false;
03612 if (optimization == NULL) return false;
03613 if (optimization->solution == NULL ||
03614 solIdx < 0 || solIdx >= nSols) return false;
03615 if (optimization->solution[solIdx] == NULL) return false;
03616 if (optimization->solution[solIdx]->variables == NULL)return false;
03617 if (optimization->solution[solIdx]->variables->other == NULL) return false;
03618 if (optimization->solution[solIdx]->variables->other[ otherIdx] == NULL) return false;
03619 optimization->solution[solIdx]->variables->other[ otherIdx]->value = value;
03620 return true;
03621 }
03622
03623 bool OSResult::setOtherVariableResultDescription(int solIdx, int otherIdx, std::string description){
03624 int numberOfVar = this->getVariableNumber();
03625 int iNumberOfVariables = numberOfVar;
03626 if (iNumberOfVariables <= -1) return false;
03627 int nSols = this->getSolutionNumber();
03628 if (optimization == NULL) return false;
03629 if (nSols <= 0) return false;
03630 if (optimization == NULL) return false;
03631 if (optimization->solution == NULL ||
03632 solIdx < 0 || solIdx >= nSols) return false;
03633 if (optimization->solution[solIdx] == NULL) return false;
03634 if (optimization->solution[solIdx]->variables == NULL)return false;
03635 if (optimization->solution[solIdx]->variables->other == NULL) return false;
03636 if (optimization->solution[solIdx]->variables->other[ otherIdx] == NULL) return false;
03637 optimization->solution[solIdx]->variables->other[ otherIdx]->description = description;
03638 return true;
03639 }
03640
03641 bool OSResult::setOtherVariableResultVarIdx(int solIdx, int otherIdx, int varIdx, int idx){
03642 int nSols = this->getSolutionNumber();
03643 if(nSols <= 0) return false;
03644 if(optimization == NULL) return false;
03645 if(optimization->solution == NULL ||
03646 solIdx < 0 || solIdx >= nSols) return false;
03647 if(optimization->solution[solIdx] == NULL) return false;
03648 if(optimization->solution[solIdx]->variables == NULL) return false;
03649 if(optimization->solution[solIdx]->variables->other[otherIdx] == NULL) return false;
03650 if(optimization->solution[solIdx]->variables->other[otherIdx]->var == NULL) return false;
03651 optimization->solution[solIdx]->variables->other[otherIdx]->var[varIdx]->idx = idx;
03652 return true;
03653 }
03654
03655 bool OSResult::setOtherVariableResultVar(int solIdx, int otherIdx, int varIdx, std::string value){
03656 int nSols = this->getSolutionNumber();
03657 if(nSols <= 0) return false;
03658 if(optimization == NULL) return false;
03659 if(optimization->solution == NULL ||
03660 solIdx < 0 || solIdx >= nSols) return false;
03661 if(optimization->solution[solIdx] == NULL) return false;
03662 if(optimization->solution[solIdx]->variables == NULL) return false;
03663 if(optimization->solution[solIdx]->variables->other[otherIdx] == NULL) return false;
03664 if(optimization->solution[solIdx]->variables->other[otherIdx]->var == NULL) return false;
03665 optimization->solution[solIdx]->variables->other[otherIdx]->var[varIdx]->value = value;
03666 return true;
03667 }
03668
03669 bool OSResult::setOtherOptionEnumeration(int solIdx, int otherIdx, char object, int enumIdx, std::string value, std::string description, int *i, int ni)
03670 {
03671 if (optimization == NULL || optimization->solution == NULL)
03672 return false;
03673 int nSols = optimization->numberOfSolutions;
03674 if (solIdx < 0 || solIdx >= nSols)
03675 return false;
03676 if (optimization->solution[solIdx] == NULL) return false;
03677
03678 switch (object)
03679 {
03680 case 'v':
03681 {
03682 if (optimization->solution[solIdx]->variables == NULL) return false;
03683 if (optimization->solution[solIdx]->variables->other == NULL) return false;
03684 if (optimization->solution[solIdx]->variables->other[ otherIdx] == NULL) return false;
03685 if (optimization->solution[solIdx]->variables->other[ otherIdx]->enumeration == NULL) return false;
03686 int n_enum = optimization->solution[solIdx]->variables->other[ otherIdx]->numberOfEnumerations;
03687 if (enumIdx < 0 || enumIdx >= n_enum) return false;
03688 if (optimization->solution[solIdx]->variables->other[ otherIdx]->enumeration[enumIdx] == NULL)
03689 optimization->solution[solIdx]->variables->other[ otherIdx]->enumeration[enumIdx] = new OtherOptionEnumeration();
03690 for (int j=0; j<ni; j++) if (i[j] < 0) return false;
03691 return optimization->solution[solIdx]->variables->other[ otherIdx]->enumeration[enumIdx]->setOtherOptionEnumeration(value, description, i, ni);
03692 }
03693 case 'o':
03694 {
03695 if (optimization->solution[solIdx]->objectives == NULL) return false;
03696 if (optimization->solution[solIdx]->objectives->other == NULL) return false;
03697 if (optimization->solution[solIdx]->objectives->other[ otherIdx] == NULL) return false;
03698 if (optimization->solution[solIdx]->objectives->other[ otherIdx]->enumeration == NULL) return false;
03699 int n_enum = optimization->solution[solIdx]->objectives->other[ otherIdx]->numberOfEnumerations;
03700 if (enumIdx < 0 || enumIdx >= n_enum) return false;
03701 if (optimization->solution[solIdx]->objectives->other[ otherIdx]->enumeration[enumIdx] == NULL)
03702 optimization->solution[solIdx]->objectives->other[ otherIdx]->enumeration[enumIdx] = new OtherOptionEnumeration();
03703 for (int j=0; j<ni; j++) if (i[j] < 0) return false;
03704 return optimization->solution[solIdx]->objectives->other[ otherIdx]->enumeration[enumIdx]->setOtherOptionEnumeration(value, description, i, ni);
03705 }
03706 case 'c':
03707 {
03708 if (optimization->solution[solIdx]->constraints == NULL) return false;
03709 if (optimization->solution[solIdx]->constraints->other == NULL) return false;
03710 if (optimization->solution[solIdx]->constraints->other[ otherIdx] == NULL) return false;
03711 if (optimization->solution[solIdx]->constraints->other[ otherIdx]->enumeration == NULL) return false;
03712 int n_enum = optimization->solution[solIdx]->constraints->other[ otherIdx]->numberOfEnumerations;
03713 if (enumIdx < 0 || enumIdx >= n_enum) return false;
03714 if (optimization->solution[solIdx]->constraints->other[ otherIdx]->enumeration[enumIdx] == NULL)
03715 optimization->solution[solIdx]->constraints->other[ otherIdx]->enumeration[enumIdx] = new OtherOptionEnumeration();
03716 for (int j=0; j<ni; j++) if (i[j] < 0) return false;
03717 return optimization->solution[solIdx]->constraints->other[ otherIdx]->enumeration[enumIdx]->setOtherOptionEnumeration(value, description, i, ni);
03718 }
03719
03720 default:
03721 throw ErrorClass("target object not implemented in setOtherOptionEnumeration");
03722 }
03723 }
03724
03725
03726 bool OSResult::setNumberOfOtherObjectiveResults(int solIdx, int num){
03727 int nSols = this->getSolutionNumber();
03728 if (nSols <= 0) return false;
03729 if (optimization == NULL) return false;
03730 if (optimization->solution == NULL ||
03731 solIdx < 0 || solIdx >= nSols) return false;
03732 if (optimization->solution[solIdx] == NULL){
03733 optimization->solution[solIdx] = new OptimizationSolution();
03734 }
03735 if (optimization->solution[solIdx]->objectives == NULL){
03736 optimization->solution[solIdx]->objectives = new ObjectiveSolution();
03737 }
03738 if (num < 0) return false;
03739 if (optimization->solution[solIdx]->objectives->other != NULL) return false;
03740 optimization->solution[solIdx]->objectives->numberOfOtherObjectiveResults = num;
03741 if (num > 0)
03742 { optimization->solution[solIdx]->objectives->other = new OtherObjectiveResult*[num];
03743 for(int i = 0; i < num; i++){
03744 optimization->solution[solIdx]->objectives->other[ i] = new OtherObjectiveResult();
03745 }
03746 }
03747 return true;
03748 }
03749
03750 bool OSResult::setNumberOfObjValues(int solIdx, int numberOfObj){
03751 if (optimization == NULL || optimization->solution == NULL)
03752 {
03753 return false;
03754 }
03755 int nSols = optimization->numberOfSolutions;
03756 if (solIdx < 0 || solIdx >= nSols)
03757 {
03758 return false;
03759 }
03760 if (optimization->solution[solIdx] == NULL)
03761 optimization->solution[solIdx] = new OptimizationSolution();
03762 if (optimization->solution[solIdx]->objectives == NULL)
03763 optimization->solution[solIdx]->objectives = new ObjectiveSolution();
03764 if (optimization->solution[solIdx]->objectives->values == NULL)
03765 optimization->solution[solIdx]->objectives->values = new ObjectiveValues();
03766 if (optimization->solution[solIdx]->objectives->values->numberOfObj > 0)
03767 return false;
03768 if (numberOfObj < 0) return false;
03769 if (optimization->solution[solIdx]->objectives->values->obj != NULL) return false;
03770 optimization->solution[solIdx]->objectives->values->numberOfObj = numberOfObj;
03771 if (numberOfObj > 0)
03772 { optimization->solution[solIdx]->objectives->values->obj = new ObjValue*[numberOfObj];
03773 for(int i = 0; i < numberOfObj; i++)
03774 optimization->solution[solIdx]->objectives->values->obj[i] = new ObjValue();
03775 }
03776 return true;
03777 }
03778
03779
03780 bool OSResult::setNumberOfObjectiveValues(int solIdx, int numberOfObj){
03781 int nSols = this->getSolutionNumber();
03782 int nObj = this->getObjectiveNumber();
03783 if (numberOfObj <= 0 || numberOfObj > nObj) return false;
03784 if (optimization == NULL) return false;
03785 if (nSols <= 0) return false;
03786 if (optimization->solution == NULL ||
03787 solIdx < 0 || solIdx >= nSols) return false;
03788 if (optimization->solution[solIdx] == NULL){
03789 optimization->solution[solIdx] = new OptimizationSolution();
03790 }
03791 if (optimization->solution[solIdx]->objectives == NULL){
03792 optimization->solution[solIdx]->objectives = new ObjectiveSolution();
03793 }
03794 if (optimization->solution[solIdx]->objectives->values == NULL){
03795 optimization->solution[solIdx]->objectives->values = new ObjectiveValues();
03796 }
03797 optimization->solution[solIdx]->objectives->values->numberOfObj = numberOfObj;
03798
03799
03800 return true;
03801 }
03802
03803
03804
03805 bool OSResult::setObjectiveValuesSparse(int solIdx, std::vector<IndexValuePair*> x){
03806 int numberOfObj = x.size();
03807 int iNumberOfObjectives = numberOfObj;
03808 if(iNumberOfObjectives < 0) return false;
03809 if(iNumberOfObjectives == 0) return true;
03810 if(x.size() == 0) return false;
03811 int nSols = this->getSolutionNumber();
03812 if(optimization == NULL) return false;
03813 if(nSols <= 0) return false;
03814 if(optimization == NULL) return false;
03815 if(optimization->solution == NULL ||
03816 solIdx < 0 || solIdx >= nSols) return false;
03817 if(optimization->solution[solIdx] == NULL){
03818 optimization->solution[solIdx] = new OptimizationSolution();
03819 }
03820 if(optimization->solution[solIdx]->objectives == NULL){
03821 optimization->solution[solIdx]->objectives = new ObjectiveSolution();
03822 }
03823 if(optimization->solution[solIdx]->objectives->values == NULL){
03824 optimization->solution[solIdx]->objectives->values = new ObjectiveValues();
03825 }
03826 if(optimization->solution[solIdx]->objectives->values->obj == NULL){
03827 optimization->solution[solIdx]->objectives->values->obj = new ObjValue*[iNumberOfObjectives];
03828 }
03829 optimization->solution[solIdx]->objectives->values->numberOfObj = iNumberOfObjectives;
03830 for(int i = 0; i < iNumberOfObjectives; i++){
03831 optimization->solution[solIdx]->objectives->values->obj[i] = new ObjValue();
03832 optimization->solution[solIdx]->objectives->values->obj[i]->idx = x[i]->idx;
03833 optimization->solution[solIdx]->objectives->values->obj[i]->value = x[i]->value;
03834 }
03835 return true;
03836 }
03837
03838
03839 bool OSResult::setObjectiveValuesDense(int solIdx, double *objectiveValues){
03840 int numberOfObj = this->getObjectiveNumber();
03841 int iNumberOfObjectives = numberOfObj;
03842 if (iNumberOfObjectives < 0) return false;
03843 if (iNumberOfObjectives == 0) return true;
03844 if (objectiveValues == NULL) return false;
03845 int nSols = this->getSolutionNumber();
03846 if (optimization == NULL) return false;
03847 if (nSols <= 0) return false;
03848 if (optimization == NULL) 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]->objectives == NULL){
03855 optimization->solution[solIdx]->objectives = new ObjectiveSolution();
03856 }
03857 if (optimization->solution[solIdx]->objectives->values == NULL){
03858 optimization->solution[solIdx]->objectives->values = new ObjectiveValues();
03859 }
03860 if (optimization->solution[solIdx]->objectives->values->obj == NULL){
03861 optimization->solution[solIdx]->objectives->values->obj = new ObjValue*[iNumberOfObjectives];
03862 }
03863
03864 optimization->solution[solIdx]->objectives->values->numberOfObj = iNumberOfObjectives;
03865 for(int i = 0; i < iNumberOfObjectives; i++){
03866 optimization->solution[solIdx]->objectives->values->obj[i] = new ObjValue();
03867 optimization->solution[solIdx]->objectives->values->obj[i]->idx = -(i+1);
03868 optimization->solution[solIdx]->objectives->values->obj[i]->value = objectiveValues[i];
03869 }
03870
03871 return true;
03872 }
03873
03874
03875
03876 bool OSResult::setObjValue(int solIdx, int number, int idx, double val){
03877 if (optimization == NULL || optimization->solution == NULL)
03878 {
03879 return false;
03880 }
03881 int nSols = optimization->numberOfSolutions;
03882 if (solIdx < 0 || solIdx >= nSols)
03883 {
03884 return false;
03885 }
03886 if (optimization->solution[solIdx] == NULL)
03887 {
03888 return false;
03889 }
03890 if (optimization->solution[solIdx]->objectives == NULL)
03891 {
03892 return false;
03893 }
03894 if (optimization->solution[solIdx]->objectives->values == NULL)
03895 {
03896 return false;
03897 }
03898 int nObj = optimization->solution[solIdx]->objectives->values->numberOfObj;
03899 if (number < 0 || number >= nObj)
03900 {
03901 return false;
03902 }
03903 if (idx >= 0)
03904 {
03905 return false;
03906 }
03907 optimization->solution[solIdx]->objectives->values->obj[number]->idx = idx;
03908 optimization->solution[solIdx]->objectives->values->obj[number]->value = val;
03909 return true;
03910 }
03911
03912 bool OSResult::setOtherObjectiveResultNumberOfObj(int solIdx, int otherIdx, int numberOfObj){
03913 int iNumberOfObjectives = numberOfObj;
03914 if (iNumberOfObjectives <= -1) return false;
03915 int nSols = this->getSolutionNumber();
03916 if (optimization == NULL) return false;
03917 if (nSols <= 0) return false;
03918 if (optimization == NULL) return false;
03919 if (optimization->solution == NULL ||
03920 solIdx < 0 || solIdx >= nSols) return false;
03921 if (optimization->solution[solIdx] == NULL) return false;
03922 if (optimization->solution[solIdx]->objectives == NULL)return false;
03923 if (optimization->solution[solIdx]->objectives->other == NULL) return false;
03924 if (optimization->solution[solIdx]->objectives->other[ otherIdx] == NULL) return false;
03925 if (optimization->solution[solIdx]->objectives->other[ otherIdx]->obj == NULL)
03926 optimization->solution[solIdx]->objectives->other[ otherIdx]->obj = new OtherObjResult*[numberOfObj];
03927 for(int i = 0; i < numberOfObj; i++)
03928 {
03929 optimization->solution[solIdx]->objectives->other[ otherIdx]->obj[i] = new OtherObjResult();
03930 }
03931 optimization->solution[solIdx]->objectives->other[ otherIdx]->numberOfObj = numberOfObj;
03932 return true;
03933 }
03934
03935
03936 bool OSResult::setOtherObjectiveResultNumberOfEnumerations(int solIdx, int otherIdx, int numberOfEnumerations){
03937 int iNumberOfEnumerations = numberOfEnumerations;
03938 if (iNumberOfEnumerations <= -1) return false;
03939 int nSols = this->getSolutionNumber();
03940 if (nSols <= 0) return false;
03941 if (optimization == NULL) return false;
03942 if (optimization->solution == NULL ||
03943 solIdx < 0 || solIdx >= nSols) return false;
03944 if (optimization->solution[solIdx] == NULL) return false;
03945 if (optimization->solution[solIdx]->objectives == NULL) return false;
03946 if (optimization->solution[solIdx]->objectives->other == NULL) return false;
03947 if (optimization->solution[solIdx]->objectives->other[ otherIdx] == NULL) return false;
03948 if (optimization->solution[solIdx]->objectives->other[ otherIdx]->enumeration == NULL)
03949 optimization->solution[solIdx]->objectives->other[ otherIdx]->enumeration = new OtherOptionEnumeration*[numberOfEnumerations];
03950 for(int i = 0; i < numberOfEnumerations; i++)
03951 optimization->solution[solIdx]->objectives->other[ otherIdx]->enumeration[i] = new OtherOptionEnumeration();
03952 optimization->solution[solIdx]->objectives->other[ otherIdx]->numberOfEnumerations = numberOfEnumerations;
03953 return true;
03954 }
03955
03956 bool OSResult::setOtherObjectiveResultName(int solIdx, int otherIdx, std::string name){
03957 int numberOfObj = this->getObjectiveNumber();
03958 int iNumberOfObjectives = numberOfObj;
03959 if (iNumberOfObjectives <= -1) return false;
03960 int nSols = this->getSolutionNumber();
03961 if (optimization == NULL) return false;
03962 if (nSols <= 0) return false;
03963 if (optimization == NULL) return false;
03964 if (optimization->solution == NULL ||
03965 solIdx < 0 || solIdx >= nSols) return false;
03966 if (optimization->solution[solIdx] == NULL) return false;
03967 if (optimization->solution[solIdx]->objectives == NULL)return false;
03968 if (optimization->solution[solIdx]->objectives->other == NULL) return false;
03969 if (optimization->solution[solIdx]->objectives->other[ otherIdx] == NULL) return false;
03970 optimization->solution[solIdx]->objectives->other[ otherIdx]->name = name;
03971 return true;
03972 }
03973
03974 bool OSResult::setOtherObjectiveResultValue(int solIdx, int otherIdx, std::string value){
03975 int numberOfObj = this->getObjectiveNumber();
03976 int iNumberOfObjectives = numberOfObj;
03977 if (iNumberOfObjectives <= -1) return false;
03978 int nSols = this->getSolutionNumber();
03979 if (optimization == NULL) return false;
03980 if (nSols <= 0) return false;
03981 if (optimization == NULL) return false;
03982 if (optimization->solution == NULL ||
03983 solIdx < 0 || solIdx >= nSols) return false;
03984 if (optimization->solution[solIdx] == NULL) return false;
03985 if (optimization->solution[solIdx]->objectives == NULL)return false;
03986 if (optimization->solution[solIdx]->objectives->other == NULL) return false;
03987 if (optimization->solution[solIdx]->objectives->other[ otherIdx] == NULL) return false;
03988 optimization->solution[solIdx]->objectives->other[ otherIdx]->value = value;
03989 return true;
03990 }
03991
03992 bool OSResult::setOtherObjectiveResultDescription(int solIdx, int otherIdx, std::string description){
03993 int numberOfObj = this->getObjectiveNumber();
03994 int iNumberOfObjectives = numberOfObj;
03995 if (iNumberOfObjectives <= -1) return false;
03996 int nSols = this->getSolutionNumber();
03997 if (optimization == NULL) return false;
03998 if (nSols <= 0) return false;
03999 if (optimization == NULL) return false;
04000 if (optimization->solution == NULL ||
04001 solIdx < 0 || solIdx >= nSols) return false;
04002 if (optimization->solution[solIdx] == NULL) return false;
04003 if (optimization->solution[solIdx]->objectives == NULL)return false;
04004 if (optimization->solution[solIdx]->objectives->other == NULL) return false;
04005 if (optimization->solution[solIdx]->objectives->other[ otherIdx] == NULL) return false;
04006 optimization->solution[solIdx]->objectives->other[ otherIdx]->description = description;
04007 return true;
04008 }
04009
04010 bool OSResult::setOtherObjectiveResultObjIdx(int solIdx, int otherIdx, int objIdx, int idx){
04011 int nSols = this->getSolutionNumber();
04012 if (nSols <= 0) return false;
04013 if (optimization == NULL) return false;
04014 if (optimization->solution == NULL ||
04015 solIdx < 0 || solIdx >= nSols) return false;
04016 if (optimization->solution[solIdx] == NULL) return false;
04017 if (optimization->solution[solIdx]->objectives == NULL) return false;
04018 if (optimization->solution[solIdx]->objectives->other[otherIdx] == NULL) return false;
04019 if (optimization->solution[solIdx]->objectives->other[otherIdx]->obj == NULL) return false;
04020 if (idx >= 0) return false;
04021 optimization->solution[solIdx]->objectives->other[otherIdx]->obj[objIdx]->idx = idx;
04022 return true;
04023 }
04024
04025 bool OSResult::setOtherObjectiveResultObj(int solIdx, int otherIdx, int objIdx, std::string value){
04026 int nSols = this->getSolutionNumber();
04027 if (nSols <= 0) return false;
04028 if (optimization == NULL) return false;
04029 if (optimization->solution == NULL ||
04030 solIdx < 0 || solIdx >= nSols) return false;
04031 if (optimization->solution[solIdx] == NULL) return false;
04032 if (optimization->solution[solIdx]->objectives == NULL) return false;
04033 if (optimization->solution[solIdx]->objectives->other[otherIdx] == NULL) return false;
04034 if (optimization->solution[solIdx]->objectives->other[otherIdx]->obj == NULL) return false;
04035 optimization->solution[solIdx]->objectives->other[otherIdx]->obj[objIdx]->value = value;
04036 return true;
04037 }
04038
04039 bool OSResult::setNumberOfOtherConstraintResults(int solIdx, int num){
04040 int nSols = this->getSolutionNumber();
04041 if (nSols <= 0) return false;
04042 if (optimization == NULL) return false;
04043 if (optimization->solution == NULL ||
04044 solIdx < 0 || solIdx >= nSols) return false;
04045 if (optimization->solution[solIdx] == NULL){
04046 optimization->solution[solIdx] = new OptimizationSolution();
04047 }
04048 if (optimization->solution[solIdx]->constraints == NULL){
04049 optimization->solution[solIdx]->constraints = new ConstraintSolution();
04050 }
04051 if (num < 0) return false;
04052 if (optimization->solution[solIdx]->constraints->other != NULL) return false;
04053 optimization->solution[solIdx]->constraints->numberOfOtherConstraintResults = num;
04054 if (num > 0)
04055 { optimization->solution[solIdx]->constraints->other = new OtherConstraintResult*[num];
04056 for(int i = 0; i < num; i++){
04057 optimization->solution[solIdx]->constraints->other[ i] = new OtherConstraintResult();
04058 }
04059 }
04060 return true;
04061 }
04062
04063 bool OSResult::setNumberOfDualValues(int solIdx, int numberOfCon){
04064 if (optimization == NULL || optimization->solution == NULL)
04065 {
04066 return false;
04067 }
04068 int nSols = optimization->numberOfSolutions;
04069 if (solIdx < 0 || solIdx >= nSols)
04070 {
04071 return false;
04072 }
04073 if (optimization->solution[solIdx] == NULL)
04074 optimization->solution[solIdx] = new OptimizationSolution();
04075 if (optimization->solution[solIdx]->constraints == NULL)
04076 optimization->solution[solIdx]->constraints = new ConstraintSolution();
04077 if (optimization->solution[solIdx]->constraints->dualValues == NULL)
04078 optimization->solution[solIdx]->constraints->dualValues = new DualVariableValues();
04079 if (optimization->solution[solIdx]->constraints->dualValues->numberOfCon > 0)
04080 return false;
04081 if (numberOfCon < 0) return false;
04082 if (optimization->solution[solIdx]->constraints->dualValues->con != NULL) return false;
04083 optimization->solution[solIdx]->constraints->dualValues->numberOfCon = numberOfCon;
04084 if (numberOfCon > 0)
04085 { optimization->solution[solIdx]->constraints->dualValues->con = new DualVarValue*[numberOfCon];
04086 for(int i = 0; i < numberOfCon; i++)
04087 optimization->solution[solIdx]->constraints->dualValues->con[i] = new DualVarValue();
04088 }
04089 return true;
04090 }
04091
04092
04093 bool OSResult::setNumberOfDualVariableValues(int solIdx, int numberOfCon){
04094 int nSols = this->getSolutionNumber();
04095 int nCon = this->getConstraintNumber();
04096 if (numberOfCon <= 0 || numberOfCon > nCon) return false;
04097 if (optimization == NULL) return false;
04098 if (nSols <= 0) return false;
04099 if (optimization->solution == NULL ||
04100 solIdx < 0 || solIdx >= nSols) return false;
04101 if (optimization->solution[solIdx] == NULL){
04102 optimization->solution[solIdx] = new OptimizationSolution();
04103 }
04104 if (optimization->solution[solIdx]->constraints == NULL){
04105 optimization->solution[solIdx]->constraints = new ConstraintSolution();
04106 }
04107 if (optimization->solution[solIdx]->constraints->dualValues == NULL){
04108 optimization->solution[solIdx]->constraints->dualValues = new DualVariableValues();
04109 }
04110 optimization->solution[solIdx]->constraints->dualValues->numberOfCon = numberOfCon;
04111
04112
04113 return true;
04114 }
04115
04116
04117
04118 bool OSResult::setDualVariableValuesSparse(int solIdx, std::vector<IndexValuePair*> x){
04119 int numberOfCon = x.size();
04120 int iNumberOfConstraints = numberOfCon;
04121 if(iNumberOfConstraints < 0) return false;
04122 if(iNumberOfConstraints == 0) return true;
04123 int nSols = this->getSolutionNumber();
04124 if(optimization == NULL) return false;
04125 if(nSols <= 0) return false;
04126 if(optimization == NULL) return false;
04127 if(optimization->solution == NULL ||
04128 solIdx < 0 || solIdx >= nSols) return false;
04129 if(optimization->solution[solIdx] == NULL){
04130 optimization->solution[solIdx] = new OptimizationSolution();
04131 }
04132 if(optimization->solution[solIdx]->constraints == NULL){
04133 optimization->solution[solIdx]->constraints = new ConstraintSolution();
04134 }
04135 if(optimization->solution[solIdx]->constraints->dualValues == NULL){
04136 optimization->solution[solIdx]->constraints->dualValues = new DualVariableValues();
04137 }
04138 if(optimization->solution[solIdx]->constraints->dualValues->con == NULL){
04139 optimization->solution[solIdx]->constraints->dualValues->con = new DualVarValue*[numberOfCon];
04140 }
04141 if(x.size() == 0){
04142 optimization->solution[solIdx]->constraints->dualValues = NULL;
04143 return true;
04144 }
04145 optimization->solution[solIdx]->constraints->dualValues->numberOfCon = numberOfCon;
04146 for(int i = 0; i < iNumberOfConstraints; i++){
04147 optimization->solution[solIdx]->constraints->dualValues->con[i] = new DualVarValue();
04148 optimization->solution[solIdx]->constraints->dualValues->con[i]->idx = x[i]->idx;
04149 optimization->solution[solIdx]->constraints->dualValues->con[i]->value = x[i]->value;
04150 }
04151 return true;
04152 }
04153
04154 bool OSResult::setDualVariableValuesDense(int solIdx, double *y){
04155 int numberOfCon = this->getConstraintNumber();
04156 int iNumberOfConstraints = numberOfCon;
04157 if (iNumberOfConstraints < 0) return false;
04158 if (iNumberOfConstraints == 0) return true;
04159 int nSols = this->getSolutionNumber();
04160 if (optimization == NULL) return false;
04161 if (nSols <= 0) return false;
04162 if (optimization == NULL) return false;
04163 if (optimization->solution == NULL ||
04164 solIdx < 0 || solIdx >= nSols) return false;
04165 if (optimization->solution[solIdx] == NULL){
04166 optimization->solution[solIdx] = new OptimizationSolution();
04167 }
04168 if (optimization->solution[solIdx]->constraints == NULL){
04169 optimization->solution[solIdx]->constraints = new ConstraintSolution();
04170 }
04171 if (optimization->solution[solIdx]->constraints->dualValues == NULL){
04172 optimization->solution[solIdx]->constraints->dualValues = new DualVariableValues();
04173 }
04174 if (optimization->solution[solIdx]->constraints->dualValues->con == NULL){
04175 optimization->solution[solIdx]->constraints->dualValues->con = new DualVarValue*[numberOfCon];
04176 }
04177 if (y == NULL){
04178 optimization->solution[solIdx]->constraints->dualValues = NULL;
04179 return true;
04180 }
04181 optimization->solution[solIdx]->constraints->dualValues->numberOfCon = numberOfCon;
04182 for(int i = 0; i < iNumberOfConstraints; i++){
04183 optimization->solution[solIdx]->constraints->dualValues->con[i] = new DualVarValue();
04184 optimization->solution[solIdx]->constraints->dualValues->con[i]->idx = i;
04185 optimization->solution[solIdx]->constraints->dualValues->con[i]->value = y[i];
04186 }
04187 return true;
04188 }
04189
04190 bool OSResult::setConstraintValuesDense(int solIdx, double *dualVarValues){
04191 int numberOfCon = this->getConstraintNumber();
04192 int iNumberOfConstraints = numberOfCon;
04193 if (iNumberOfConstraints <= 0) return false;
04194 int nSols = this->getSolutionNumber();
04195 if (optimization == NULL) return false;
04196 if (nSols <= 0) return false;
04197 if (optimization == NULL) return false;
04198 if (optimization->solution == NULL ||
04199 solIdx < 0 || solIdx >= nSols) return false;
04200 if (optimization->solution[solIdx] == NULL){
04201 optimization->solution[solIdx] = new OptimizationSolution();
04202 }
04203 if (optimization->solution[solIdx]->constraints == NULL){
04204 optimization->solution[solIdx]->constraints = new ConstraintSolution();
04205 }
04206 if (optimization->solution[solIdx]->constraints->dualValues == NULL){
04207 optimization->solution[solIdx]->constraints->dualValues = new DualVariableValues();
04208 }
04209 if (optimization->solution[solIdx]->constraints->dualValues->con == NULL){
04210 optimization->solution[solIdx]->constraints->dualValues->con = new DualVarValue*[numberOfCon];
04211 }
04212 if (dualVarValues == NULL){
04213 optimization->solution[solIdx]->constraints->dualValues = NULL;
04214 return true;
04215 }
04216
04217 optimization->solution[solIdx]->constraints->dualValues->numberOfCon = numberOfCon;
04218 for(int i = 0; i < iNumberOfConstraints; i++){
04219 optimization->solution[solIdx]->constraints->dualValues->con[i] = new DualVarValue();
04220
04221 optimization->solution[solIdx]->constraints->dualValues->con[i]->idx = i;
04222 optimization->solution[solIdx]->constraints->dualValues->con[i]->value = dualVarValues[i];
04223 }
04224 return true;
04225 }
04226
04227 bool OSResult::setDualValue(int solIdx, int number, int idx, double val){
04228 if (optimization == NULL || optimization->solution == NULL)
04229 {
04230 return false;
04231 }
04232 int nSols = optimization->numberOfSolutions;
04233 if (solIdx < 0 || solIdx >= nSols)
04234 {
04235 return false;
04236 }
04237 if (optimization->solution[solIdx] == NULL)
04238 {
04239 return false;
04240 }
04241 if (optimization->solution[solIdx]->constraints == NULL)
04242 {
04243 return false;
04244 }
04245 if (optimization->solution[solIdx]->constraints->dualValues == NULL)
04246 {
04247 return false;
04248 }
04249 int nCon = optimization->solution[solIdx]->constraints->dualValues->numberOfCon;
04250 if (number < 0 || number >= nCon)
04251 {
04252 return false;
04253 }
04254 if (idx < 0)
04255 {
04256 return false;
04257 }
04258 optimization->solution[solIdx]->constraints->dualValues->con[number]->idx = idx;
04259 optimization->solution[solIdx]->constraints->dualValues->con[number]->value = val;
04260 return true;
04261 }
04262
04263 bool OSResult::setOtherConstraintResultNumberOfCon(int solIdx, int otherIdx, int numberOfCon){
04264 int iNumberOfConstraints = numberOfCon;
04265 if (iNumberOfConstraints <= -1) return false;
04266 int nSols = this->getSolutionNumber();
04267 if (optimization == NULL) return false;
04268 if (nSols <= 0) return false;
04269 if (optimization == NULL) return false;
04270 if (optimization->solution == NULL ||
04271 solIdx < 0 || solIdx >= nSols) return false;
04272 if (optimization->solution[solIdx] == NULL) return false;
04273 if (optimization->solution[solIdx]->constraints == NULL)return false;
04274 if (optimization->solution[solIdx]->constraints->other == NULL) return false;
04275 if (optimization->solution[solIdx]->constraints->other[ otherIdx] == NULL) return false;
04276 if (optimization->solution[solIdx]->constraints->other[ otherIdx]->con == NULL)
04277 optimization->solution[solIdx]->constraints->other[ otherIdx]->con = new OtherConResult*[numberOfCon];
04278 for(int i = 0; i < numberOfCon; i++)
04279 optimization->solution[solIdx]->constraints->other[ otherIdx]->con[i] = new OtherConResult();
04280 optimization->solution[solIdx]->constraints->other[ otherIdx]->numberOfCon = numberOfCon;
04281 return true;
04282 }
04283
04284
04285 bool OSResult::setOtherConstraintResultNumberOfEnumerations(int solIdx, int otherIdx, int numberOfEnumerations){
04286 int iNumberOfEnumerations = numberOfEnumerations;
04287 if (iNumberOfEnumerations <= -1) return false;
04288 int nSols = this->getSolutionNumber();
04289 if (nSols <= 0) return false;
04290 if (optimization == NULL) return false;
04291 if (optimization->solution == NULL ||
04292 solIdx < 0 || solIdx >= nSols) return false;
04293 if (optimization->solution[solIdx] == NULL) return false;
04294 if (optimization->solution[solIdx]->constraints == NULL) return false;
04295 if (optimization->solution[solIdx]->constraints->other == NULL) return false;
04296 if (optimization->solution[solIdx]->constraints->other[ otherIdx] == NULL) return false;
04297 if (optimization->solution[solIdx]->constraints->other[ otherIdx]->enumeration == NULL)
04298 optimization->solution[solIdx]->constraints->other[ otherIdx]->enumeration = new OtherOptionEnumeration*[numberOfEnumerations];
04299 for(int i = 0; i < numberOfEnumerations; i++)
04300 optimization->solution[solIdx]->constraints->other[ otherIdx]->enumeration[i] = new OtherOptionEnumeration();
04301 optimization->solution[solIdx]->constraints->other[ otherIdx]->numberOfEnumerations = numberOfEnumerations;
04302 return true;
04303 }
04304
04305 bool OSResult::setOtherConstraintResultName(int solIdx, int otherIdx, std::string name){
04306 int numberOfCon = this->getConstraintNumber();
04307 int iNumberOfConstraints = numberOfCon;
04308 if (iNumberOfConstraints <= -1) return false;
04309 int nSols = this->getSolutionNumber();
04310 if (optimization == NULL) return false;
04311 if (nSols <= 0) return false;
04312 if (optimization == NULL) return false;
04313 if (optimization->solution == NULL ||
04314 solIdx < 0 || solIdx >= nSols) return false;
04315 if (optimization->solution[solIdx] == NULL) return false;
04316 if (optimization->solution[solIdx]->constraints == NULL)return false;
04317 if (optimization->solution[solIdx]->constraints->other == NULL) return false;
04318 if (optimization->solution[solIdx]->constraints->other[ otherIdx] == NULL) return false;
04319 optimization->solution[solIdx]->constraints->other[ otherIdx]->name = name;
04320 return true;
04321 }
04322
04323 bool OSResult::setOtherConstraintResultValue(int solIdx, int otherIdx, std::string value){
04324 int numberOfCon = this->getConstraintNumber();
04325 int iNumberOfConstraints = numberOfCon;
04326 if (iNumberOfConstraints <= -1) return false;
04327 int nSols = this->getSolutionNumber();
04328 if (optimization == NULL) return false;
04329 if (nSols <= 0) return false;
04330 if (optimization == NULL) return false;
04331 if (optimization->solution == NULL ||
04332 solIdx < 0 || solIdx >= nSols) return false;
04333 if (optimization->solution[solIdx] == NULL) return false;
04334 if (optimization->solution[solIdx]->constraints == NULL)return false;
04335 if (optimization->solution[solIdx]->constraints->other == NULL) return false;
04336 if (optimization->solution[solIdx]->constraints->other[ otherIdx] == NULL) return false;
04337 optimization->solution[solIdx]->constraints->other[ otherIdx]->value = value;
04338 return true;
04339 }
04340
04341 bool OSResult::setOtherConstraintResultDescription(int solIdx, int otherIdx, std::string description){
04342 int numberOfCon = this->getConstraintNumber();
04343 int iNumberOfConstraints = numberOfCon;
04344 if (iNumberOfConstraints <= -1) return false;
04345 int nSols = this->getSolutionNumber();
04346 if (optimization == NULL) return false;
04347 if (nSols <= 0) return false;
04348 if (optimization == NULL) return false;
04349 if (optimization->solution == NULL ||
04350 solIdx < 0 || solIdx >= nSols) return false;
04351 if (optimization->solution[solIdx] == NULL) return false;
04352 if (optimization->solution[solIdx]->constraints == NULL)return false;
04353 if (optimization->solution[solIdx]->constraints->other == NULL) return false;
04354 if (optimization->solution[solIdx]->constraints->other[ otherIdx] == NULL) return false;
04355 optimization->solution[solIdx]->constraints->other[ otherIdx]->description = description;
04356 return true;
04357 }
04358
04359 bool OSResult::setOtherConstraintResultConIdx(int solIdx, int otherIdx, int conIdx, int idx){
04360 int nSols = this->getSolutionNumber();
04361 if (nSols <= 0) return false;
04362 if (optimization == NULL) return false;
04363 if (optimization->solution == NULL ||
04364 solIdx < 0 || solIdx >= nSols) return false;
04365 if (optimization->solution[solIdx] == NULL) return false;
04366 if (optimization->solution[solIdx]->constraints == NULL) return false;
04367 if (optimization->solution[solIdx]->constraints->other[otherIdx] == NULL) return false;
04368 if (optimization->solution[solIdx]->constraints->other[otherIdx]->con == NULL) return false;
04369 optimization->solution[solIdx]->constraints->other[otherIdx]->con[conIdx]->idx = idx;
04370 return true;
04371 }
04372
04373 bool OSResult::setOtherConstraintResultCon(int solIdx, int otherIdx, int conIdx, std::string value){
04374 int nSols = this->getSolutionNumber();
04375 if (nSols <= 0) return false;
04376 if (optimization == NULL) return false;
04377 if (optimization->solution == NULL ||
04378 solIdx < 0 || solIdx >= nSols) return false;
04379 if (optimization->solution[solIdx] == NULL) return false;
04380 if (optimization->solution[solIdx]->constraints == NULL) return false;
04381 if (optimization->solution[solIdx]->constraints->other[otherIdx] == NULL) return false;
04382 if (optimization->solution[solIdx]->constraints->other[otherIdx]->con == NULL) return false;
04383 optimization->solution[solIdx]->constraints->other[otherIdx]->con[conIdx]->value = value;
04384 return true;
04385 }
04386
04387 bool OSResult::setNumberOfOtherSolutionResults(int solIdx, int num){
04388 int nSols = this->getSolutionNumber();
04389 if (nSols <= 0) return false;
04390 if (optimization == NULL) return false;
04391 if (optimization->solution == NULL ||
04392 solIdx < 0 || solIdx >= nSols) return false;
04393 if (optimization->solution[solIdx] == NULL){
04394 optimization->solution[solIdx] = new OptimizationSolution();
04395 }
04396 if (optimization->solution[solIdx]->otherSolutionResults == NULL){
04397 optimization->solution[solIdx]->otherSolutionResults = new OtherSolutionResults();
04398 }
04399 if (num < 0) return false;
04400 if (optimization->solution[solIdx]->otherSolutionResults->otherSolutionResult != NULL) return false;
04401 optimization->solution[solIdx]->otherSolutionResults->numberOfOtherSolutionResults = num;
04402 if (num > 0)
04403 { optimization->solution[solIdx]->otherSolutionResults->otherSolutionResult = new OtherSolutionResult*[num];
04404 for(int i = 0; i < num; i++){
04405 optimization->solution[solIdx]->otherSolutionResults->otherSolutionResult[i] = new OtherSolutionResult();
04406 }
04407 }
04408 return true;
04409 }
04410
04411 bool OSResult::setOtherSolutionResultName(int solIdx, int otherIdx, std::string name){
04412 int nSols = this->getSolutionNumber();
04413 if (nSols <= 0) return false;
04414 if (optimization == NULL) return false;
04415 if (optimization->solution == NULL ||
04416 solIdx < 0 || solIdx >= nSols) return false;
04417 if (optimization->solution[solIdx] == NULL) return false;
04418 if (optimization->solution[solIdx]->otherSolutionResults == NULL) return false;
04419 if (optimization->solution[solIdx]->otherSolutionResults->otherSolutionResult[otherIdx] == NULL) return false;
04420 optimization->solution[solIdx]->otherSolutionResults->otherSolutionResult[otherIdx]->name = name;
04421 return true;
04422 }
04423
04424 bool OSResult::setOtherSolutionResultCategory(int solIdx, int otherIdx, std::string category){
04425 int nSols = this->getSolutionNumber();
04426 if (nSols <= 0) return false;
04427 if (optimization == NULL) return false;
04428 if (optimization->solution == NULL ||
04429 solIdx < 0 || solIdx >= nSols) return false;
04430 if (optimization->solution[solIdx] == NULL) return false;
04431 if (optimization->solution[solIdx]->otherSolutionResults == NULL) return false;
04432 if (optimization->solution[solIdx]->otherSolutionResults->otherSolutionResult[otherIdx] == NULL) return false;
04433 optimization->solution[solIdx]->otherSolutionResults->otherSolutionResult[otherIdx]->category = category;
04434 return true;
04435 }
04436
04437
04438 bool OSResult::setOtherSolutionResultDescription(int solIdx, int otherIdx, std::string description){
04439 int nSols = this->getSolutionNumber();
04440 if (nSols <= 0) return false;
04441 if (optimization == NULL) return false;
04442 if (optimization->solution == NULL ||
04443 solIdx < 0 || solIdx >= nSols) return false;
04444 if (optimization->solution[solIdx] == NULL) return false;
04445 if (optimization->solution[solIdx]->otherSolutionResults == NULL) return false;
04446 if (optimization->solution[solIdx]->otherSolutionResults->otherSolutionResult[otherIdx] == NULL) return false;
04447 optimization->solution[solIdx]->otherSolutionResults->otherSolutionResult[otherIdx]->description = description;
04448 return true;
04449 }
04450
04451
04452 bool OSResult::setOtherSolutionResultNumberOfItems(int solIdx, int otherIdx, int numberOfItems){
04453 int nSols = this->getSolutionNumber();
04454 if (nSols <= 0) return false;
04455 if (optimization == NULL) return false;
04456 if (optimization->solution == NULL ||
04457 solIdx < 0 || solIdx >= nSols) return false;
04458 if (optimization->solution[solIdx] == NULL) return false;
04459 if (optimization->solution[solIdx]->otherSolutionResults == NULL) return false;
04460 if (optimization->solution[solIdx]->otherSolutionResults->otherSolutionResult[otherIdx] == NULL)
04461 optimization->solution[solIdx]->otherSolutionResults->otherSolutionResult[otherIdx] = new OtherSolutionResult();
04462 if (numberOfItems < 0) return false;
04463 if (optimization->solution[solIdx]->otherSolutionResults->otherSolutionResult[otherIdx]->item != NULL) return false;
04464 optimization->solution[solIdx]->otherSolutionResults->otherSolutionResult[otherIdx]->numberOfItems = numberOfItems;
04465 if (numberOfItems > 0)
04466 optimization->solution[solIdx]->otherSolutionResults->otherSolutionResult[otherIdx]->item = new std::string[numberOfItems];
04467 return true;
04468 }
04469
04470 bool OSResult::setOtherSolutionResultItem(int solIdx, int otherIdx, int itemIdx, std::string item){
04471 int nSols = this->getSolutionNumber();
04472 if (nSols <= 0) return false;
04473 if (optimization == NULL) return false;
04474 if (optimization->solution == NULL ||
04475 solIdx < 0 || solIdx >= nSols) return false;
04476 if (optimization->solution[solIdx] == NULL) return false;
04477 if (optimization->solution[solIdx]->otherSolutionResults == NULL) return false;
04478 if (optimization->solution[solIdx]->otherSolutionResults->otherSolutionResult[otherIdx] == NULL) return false;
04479 if (optimization->solution[solIdx]->otherSolutionResults->otherSolutionResult[otherIdx]->item == NULL) return false;
04480 optimization->solution[solIdx]->otherSolutionResults->otherSolutionResult[otherIdx]->item[itemIdx] = item;
04481 return true;
04482 }
04483
04484 bool OSResult::setNumberOfSolverOutputs(int num){
04485 if (optimization == NULL) return false;
04486 if (optimization->otherSolverOutput == NULL){
04487 optimization->otherSolverOutput = new OtherSolverOutput();
04488 }
04489 if (num < 0) return false;
04490 if (optimization->otherSolverOutput->solverOutput != NULL) return false;
04491 optimization->otherSolverOutput->numberOfSolverOutputs = num;
04492 if (num > 0)
04493 { optimization->otherSolverOutput->solverOutput = new SolverOutput*[num];
04494 for(int i = 0; i < num; i++){
04495 optimization->otherSolverOutput->solverOutput[ i] = new SolverOutput();
04496 }
04497 }
04498 return true;
04499 }
04500
04501 bool OSResult::setSolverOutputName(int otherIdx, std::string name){
04502 if (optimization == NULL) return false;
04503 if (optimization->otherSolverOutput == NULL) return false;
04504 if (optimization->otherSolverOutput->solverOutput[otherIdx] == NULL) return false;
04505 optimization->otherSolverOutput->solverOutput[otherIdx]->name = name;
04506 return true;
04507 }
04508
04509 bool OSResult::setSolverOutputCategory(int otherIdx, std::string category){
04510 if (optimization == NULL) return false;
04511 if (optimization->otherSolverOutput == NULL) return false;
04512 if (optimization->otherSolverOutput->solverOutput[otherIdx] == NULL) return false;
04513 optimization->otherSolverOutput->solverOutput[otherIdx]->category = category;
04514 return true;
04515 }
04516
04517 bool OSResult::setSolverOutputDescription(int otherIdx, std::string description){
04518 if (optimization == NULL) return false;
04519 if (optimization->otherSolverOutput == NULL) return false;
04520 if (optimization->otherSolverOutput->solverOutput[otherIdx] == NULL) return false;
04521 optimization->otherSolverOutput->solverOutput[otherIdx]->description = description;
04522 return true;
04523 }
04524
04525 bool OSResult::setSolverOutputNumberOfItems(int otherIdx, int numberOfItems){
04526 if (optimization == NULL) return false;
04527 if (optimization->otherSolverOutput == NULL) return false;
04528 if (optimization->otherSolverOutput->solverOutput[otherIdx] == NULL)
04529 optimization->otherSolverOutput->solverOutput[otherIdx] = new SolverOutput();
04530 if (numberOfItems < 0) return false;
04531 if (optimization->otherSolverOutput->solverOutput[otherIdx]->item != NULL) return false;
04532 optimization->otherSolverOutput->solverOutput[otherIdx]->numberOfItems = numberOfItems;
04533 if (numberOfItems > 0)
04534 optimization->otherSolverOutput->solverOutput[otherIdx]->item = new std::string[numberOfItems];
04535 return true;
04536 }
04537
04538 bool OSResult::setSolverOutputItem(int otherIdx, int itemIdx, std::string item){
04539 if (optimization == NULL) return false;
04540 if (optimization->otherSolverOutput == NULL) return false;
04541 if (optimization->otherSolverOutput->solverOutput == NULL) return false;
04542 if (optimization->otherSolverOutput->solverOutput[otherIdx] == NULL) return false;
04543 if (optimization->otherSolverOutput->solverOutput[otherIdx]->item == NULL) return false;
04544 optimization->otherSolverOutput->solverOutput[otherIdx]->item[itemIdx] = item;
04545 return true;
04546 }
04547
04548
04549
04550
04551
04552
04553 bool OSResult::IsEqual(OSResult *that)
04554 {
04555 #ifdef DEBUG_ISEQUAL_ROUTINES
04556 cout << "Start comparing in OSResult" << endl;
04557 #endif
04558 if (this == NULL)
04559 { if (that == NULL)
04560 return true;
04561 else
04562 {
04563 #ifdef DEBUG_ISEQUAL_ROUTINES
04564 cout << "First object is NULL, second is not" << endl;
04565 #endif
04566 return false;
04567 }
04568 }
04569 else
04570 { if (that == NULL)
04571 {
04572 #ifdef DEBUG_ISEQUAL_ROUTINES
04573 cout << "Second object is NULL, first is not" << endl;
04574 #endif
04575 return false;
04576 }
04577 else
04578 {
04579 if (!this->general->IsEqual(that->general))
04580 return false;
04581 if (!this->system->IsEqual(that->system))
04582 return false;
04583 if (!this->service->IsEqual(that->service))
04584 return false;
04585 if (!this->job->IsEqual(that->job))
04586 return false;
04587 if (!this->optimization->IsEqual(that->optimization))
04588 return false;
04589
04590 return true;
04591 }
04592 }
04593 }
04594
04595 bool GeneralResult::IsEqual(GeneralResult *that)
04596 {
04597 #ifdef DEBUG_ISEQUAL_ROUTINES
04598 cout << "Start comparing in GeneralResult" << endl;
04599 #endif
04600 if (this == NULL)
04601 { if (that == NULL)
04602 return true;
04603 else
04604 {
04605 #ifdef DEBUG_ISEQUAL_ROUTINES
04606 cout << "First object is NULL, second is not" << endl;
04607 #endif
04608 return false;
04609 }
04610 }
04611 else
04612 { if (that == NULL)
04613 {
04614 #ifdef DEBUG_ISEQUAL_ROUTINES
04615 cout << "Second object is NULL, first is not" << endl;
04616 #endif
04617 return false;
04618 }
04619 else
04620 {
04621 if (this->message != that->message ||
04622 this->serviceURI != that->serviceURI ||
04623 this->serviceName != that->serviceName ||
04624 this->instanceName != that->instanceName ||
04625 this->jobID != that->jobID ||
04626 this->solverInvoked != that->solverInvoked ||
04627 this->timeStamp != that->timeStamp )
04628 {
04629 #ifdef DEBUG_ISEQUAL_ROUTINES
04630 cout << "message: " << this->message << " vs. " << that->message << endl;
04631 cout << "serviceURI: " << this->serviceURI << " vs. " << that->serviceURI << endl;
04632 cout << "serviceName: " << this->serviceName << " vs. " << that->serviceName << endl;
04633 cout << "instanceName: " << this->instanceName << " vs. " << that->instanceName << endl;
04634 cout << "jobID: " << this->jobID << " vs. " << that->jobID << endl;
04635 cout << "solverInvoked: " << this->solverInvoked << " vs. " << that->solverInvoked << endl;
04636 cout << "timeStamp: " << this->timeStamp << " vs. " << that->timeStamp << endl;
04637 #endif
04638
04639 return false;
04640 }
04641 if (!this->generalStatus->IsEqual(that->generalStatus))
04642 return false;
04643 if (!this->otherResults->IsEqual(that->otherResults))
04644 return false;
04645 return true;
04646 }
04647 }
04648 }
04649
04650
04651 bool GeneralStatus::IsEqual(GeneralStatus *that)
04652 {
04653 #ifdef DEBUG_ISEQUAL_ROUTINES
04654 cout << "Start comparing in GeneralStatus" << endl;
04655 #endif
04656 if (this == NULL)
04657 { if (that == NULL)
04658 return true;
04659 else
04660 {
04661 #ifdef DEBUG_ISEQUAL_ROUTINES
04662 cout << "First object is NULL, second is not" << endl;
04663 #endif
04664 return false;
04665 }
04666 }
04667 else
04668 { if (that == NULL)
04669 {
04670 #ifdef DEBUG_ISEQUAL_ROUTINES
04671 cout << "Second object is NULL, first is not" << endl;
04672 #endif
04673 return false;
04674 }
04675 else
04676 {
04677 if (this->numberOfSubstatuses != that->numberOfSubstatuses ||
04678 this->type != that->type ||
04679 this->description != that->description )
04680 {
04681 #ifdef DEBUG_ISEQUAL_ROUTINES
04682 cout << "numberOfSubstatuses: " << this->numberOfSubstatuses << " vs. " << that->numberOfSubstatuses << endl;
04683 cout << "type: " << this->type << " vs. " << that->type << endl;
04684 cout << "description: " << this->description << " vs. " << that->description << endl;
04685 #endif
04686 return false;
04687 }
04688
04689 for (int i = 0; i < numberOfSubstatuses; i++)
04690 if (!this->substatus[i]->IsEqual(that->substatus[i]))
04691 return false;
04692 }
04693 return true;
04694 }
04695 }
04696
04697 bool GeneralSubstatus::IsEqual(GeneralSubstatus *that)
04698 {
04699 #ifdef DEBUG_ISEQUAL_ROUTINES
04700 cout << "Start comparing in GeneralSubstatus" << endl;
04701 #endif
04702 if (this == NULL)
04703 { if (that == NULL)
04704 return true;
04705 else
04706 {
04707 #ifdef DEBUG_ISEQUAL_ROUTINES
04708 cout << "First object is NULL, second is not" << endl;
04709 #endif
04710 return false;
04711 }
04712 }
04713 else
04714 { if (that == NULL)
04715 {
04716 #ifdef DEBUG_ISEQUAL_ROUTINES
04717 cout << "Second object is NULL, first is not" << endl;
04718 #endif
04719 return false;
04720 }
04721 else
04722 {
04723 if (this->name != that->name ||
04724 this->description != that->description )
04725 {
04726 #ifdef DEBUG_ISEQUAL_ROUTINES
04727 cout << "name: " << this->name << " vs. " << that->name << endl;
04728 cout << "description: " << this->description << " vs. " << that->description << endl;
04729 #endif
04730 return false;
04731 }
04732 }
04733 return true;
04734 }
04735 }
04736
04737
04738 bool OtherResults::IsEqual(OtherResults *that)
04739 {
04740 #ifdef DEBUG_ISEQUAL_ROUTINES
04741 cout << "Start comparing in OtherResults" << endl;
04742 #endif
04743 if (this == NULL)
04744 { if (that == NULL)
04745 return true;
04746 else
04747 {
04748 #ifdef DEBUG_ISEQUAL_ROUTINES
04749 cout << "First object is NULL, second is not" << endl;
04750 #endif
04751 return false;
04752 }
04753 }
04754 else
04755 { if (that == NULL)
04756 {
04757 #ifdef DEBUG_ISEQUAL_ROUTINES
04758 cout << "Second object is NULL, first is not" << endl;
04759 #endif
04760 return false;
04761 }
04762 else
04763 {
04764 if (this->numberOfOtherResults != that->numberOfOtherResults)
04765 {
04766 #ifdef DEBUG_ISEQUAL_ROUTINES
04767 cout << "numberOfOtherResults: " << this->numberOfOtherResults << " vs. " << that->numberOfOtherResults << endl;
04768 #endif
04769
04770 return false;
04771 }
04772
04773 for (int i = 0; i < numberOfOtherResults; i++)
04774 if (!this->other[i]->IsEqual(that->other[i]))
04775 return false;
04776 return true;
04777 }
04778 }
04779 }
04780
04781
04782 bool OtherResult::IsEqual(OtherResult *that)
04783 {
04784 #ifdef DEBUG_ISEQUAL_ROUTINES
04785 cout << "Start comparing in OtherResult" << endl;
04786 #endif
04787 if (this == NULL)
04788 { if (that == NULL)
04789 return true;
04790 else
04791 {
04792 #ifdef DEBUG_ISEQUAL_ROUTINES
04793 cout << "First object is NULL, second is not" << endl;
04794 #endif
04795 return false;
04796 }
04797 }
04798 else
04799 { if (that == NULL)
04800 {
04801 #ifdef DEBUG_ISEQUAL_ROUTINES
04802 cout << "Second object is NULL, first is not" << endl;
04803 #endif
04804 return false;
04805 }
04806 else
04807 {
04808 if (this->name != that->name ||
04809 this->value != that->value ||
04810 this->description != that->description )
04811 {
04812 #ifdef DEBUG_ISEQUAL_ROUTINES
04813 cout << "name: " << this->name << " vs. " << that->name << endl;
04814 cout << "value: " << this->value << " vs. " << that->value << endl;
04815 cout << "description: " << this->description << " vs. " << that->description << endl;
04816 #endif
04817 return false;
04818 }
04819 return true;
04820 }
04821 }
04822 }
04823
04824
04825 bool SystemResult::IsEqual(SystemResult *that)
04826 {
04827 #ifdef DEBUG_ISEQUAL_ROUTINES
04828 cout << "Start comparing in SystemResult" << endl;
04829 #endif
04830 if (this == NULL)
04831 { if (that == NULL)
04832 return true;
04833 else
04834 {
04835 #ifdef DEBUG_ISEQUAL_ROUTINES
04836 cout << "First object is NULL, second is not" << endl;
04837 #endif
04838 return false;
04839 }
04840 }
04841 else
04842 { if (that == NULL)
04843 {
04844 #ifdef DEBUG_ISEQUAL_ROUTINES
04845 cout << "Second object is NULL, first is not" << endl;
04846 #endif
04847 return false;
04848 }
04849 else
04850 {
04851 if (this->systemInformation != that->systemInformation)
04852 {
04853 #ifdef DEBUG_ISEQUAL_ROUTINES
04854 cout << "systemInformation: " << this->systemInformation << " vs. " << that->systemInformation << endl;
04855 #endif
04856 return false;
04857 }
04858
04859 if (!this->availableDiskSpace->IsEqual(that->availableDiskSpace))
04860 return false;
04861 if (!this->availableMemory->IsEqual(that->availableMemory))
04862 return false;
04863 if (!this->availableCPUSpeed->IsEqual(that->availableCPUSpeed))
04864 return false;
04865 if (!this->availableCPUNumber->IsEqual(that->availableCPUNumber))
04866 return false;
04867 if (!this->otherResults->IsEqual(that->otherResults))
04868 return false;
04869
04870 return true;
04871 }
04872 }
04873 }
04874
04875
04876 bool DiskSpace::IsEqual(DiskSpace *that)
04877 {
04878 #ifdef DEBUG_ISEQUAL_ROUTINES
04879 cout << "Start comparing in DiskSpace" << endl;
04880 #endif
04881 if (this == NULL)
04882 { if (that == NULL)
04883 return true;
04884 else
04885 {
04886 #ifdef DEBUG_ISEQUAL_ROUTINES
04887 cout << "First object is NULL, second is not" << endl;
04888 #endif
04889 return false;
04890 }
04891 }
04892 else
04893 { if (that == NULL)
04894 {
04895 #ifdef DEBUG_ISEQUAL_ROUTINES
04896 cout << "Second object is NULL, first is not" << endl;
04897 #endif
04898 return false;
04899 }
04900 else
04901 {
04902 if (this->unit != that->unit ||
04903 this->value != that->value ||
04904 this->description != that->description )
04905 {
04906 #ifdef DEBUG_ISEQUAL_ROUTINES
04907 cout << "unit: " << this->unit << " vs. " << that->unit << endl;
04908 cout << "value: " << this->value << " vs. " << that->value << endl;
04909 cout << "description: " << this->description << " vs. " << that->description << endl;
04910 #endif
04911 return false;
04912 }
04913 return true;
04914 }
04915 }
04916 }
04917
04918 bool MemorySize::IsEqual(MemorySize *that)
04919 {
04920 #ifdef DEBUG_ISEQUAL_ROUTINES
04921 cout << "Start comparing in MemorySize" << endl;
04922 #endif
04923 if (this == NULL)
04924 { if (that == NULL)
04925 return true;
04926 else
04927 {
04928 #ifdef DEBUG_ISEQUAL_ROUTINES
04929 cout << "First object is NULL, second is not" << endl;
04930 #endif
04931 return false;
04932 }
04933 }
04934 else
04935 { if (that == NULL)
04936 {
04937 #ifdef DEBUG_ISEQUAL_ROUTINES
04938 cout << "Second object is NULL, first is not" << endl;
04939 #endif
04940 return false;
04941 }
04942 else
04943 {
04944 if (this->unit != that->unit ||
04945 this->value != that->value ||
04946 this->description != that->description )
04947 {
04948 #ifdef DEBUG_ISEQUAL_ROUTINES
04949 cout << "unit: " << this->unit << " vs. " << that->unit << endl;
04950 cout << "value: " << this->value << " vs. " << that->value << endl;
04951 cout << "description: " << this->description << " vs. " << that->description << endl;
04952 #endif
04953 return false;
04954 }
04955 return true;
04956 }
04957 }
04958 }
04959
04960 bool CPUSpeed::IsEqual(CPUSpeed *that)
04961 {
04962 #ifdef DEBUG_ISEQUAL_ROUTINES
04963 cout << "Start comparing in CPUSpeed" << endl;
04964 #endif
04965 if (this == NULL)
04966 { if (that == NULL)
04967 return true;
04968 else
04969 {
04970 #ifdef DEBUG_ISEQUAL_ROUTINES
04971 cout << "First object is NULL, second is not" << endl;
04972 #endif
04973 return false;
04974 }
04975 }
04976 else
04977 { if (that == NULL)
04978 {
04979 #ifdef DEBUG_ISEQUAL_ROUTINES
04980 cout << "Second object is NULL, first is not" << endl;
04981 #endif
04982 return false;
04983 }
04984 else
04985 {
04986 if (this->unit != that->unit ||
04987 this->value != that->value ||
04988 this->description != that->description )
04989 {
04990 #ifdef DEBUG_ISEQUAL_ROUTINES
04991 cout << "unit: " << this->unit << " vs. " << that->unit << endl;
04992 cout << "value: " << this->value << " vs. " << that->value << endl;
04993 cout << "description: " << this->description << " vs. " << that->description << endl;
04994 #endif
04995 return false;
04996 }
04997 return true;
04998 }
04999 }
05000 }
05001
05002 bool CPUNumber::IsEqual(CPUNumber *that)
05003 {
05004 #ifdef DEBUG_ISEQUAL_ROUTINES
05005 cout << "Start comparing in CPUNumber" << endl;
05006 #endif
05007 if (this == NULL)
05008 { if (that == NULL)
05009 return true;
05010 else
05011 {
05012 #ifdef DEBUG_ISEQUAL_ROUTINES
05013 cout << "First object is NULL, second is not" << endl;
05014 #endif
05015 return false;
05016 }
05017 }
05018 else
05019 { if (that == NULL)
05020 {
05021 #ifdef DEBUG_ISEQUAL_ROUTINES
05022 cout << "Second object is NULL, first is not" << endl;
05023 #endif
05024 return false;
05025 }
05026 else
05027 {
05028 if (this->value != that->value ||
05029 this->description != that->description )
05030 {
05031 #ifdef DEBUG_ISEQUAL_ROUTINES
05032 cout << "value: " << this->value << " vs. " << that->value << endl;
05033 cout << "description: " << this->description << " vs. " << that->description << endl;
05034 #endif
05035 return false;
05036 }
05037 return true;
05038 }
05039 }
05040 }
05041
05042
05043 bool ServiceResult::IsEqual(ServiceResult *that)
05044 {
05045 #ifdef DEBUG_ISEQUAL_ROUTINES
05046 cout << "Start comparing in ServiceResult" << endl;
05047 #endif
05048 if (this == NULL)
05049 { if (that == NULL)
05050 return true;
05051 else
05052 {
05053 #ifdef DEBUG_ISEQUAL_ROUTINES
05054 cout << "First object is NULL, second is not" << endl;
05055 #endif
05056 return false;
05057 }
05058 }
05059 else
05060 { if (that == NULL)
05061 {
05062 #ifdef DEBUG_ISEQUAL_ROUTINES
05063 cout << "Second object is NULL, first is not" << endl;
05064 #endif
05065 return false;
05066 }
05067 else
05068 {
05069 if (this->currentState != that->currentState ||
05070 this->currentJobCount != that->currentJobCount ||
05071 this->totalJobsSoFar != that->totalJobsSoFar ||
05072 this->timeServiceStarted != that->timeServiceStarted ||
05073 this->serviceUtilization != that->serviceUtilization )
05074 {
05075 #ifdef DEBUG_ISEQUAL_ROUTINES
05076 cout << "currentState: " << this->currentState << " vs. " << that->currentState << endl;
05077 cout << "currentJobCount: " << this->currentJobCount << " vs. " << that->currentJobCount << endl;
05078 cout << "totalJobsSoFar: " << this->totalJobsSoFar << " vs. " << that->totalJobsSoFar << endl;
05079 cout << "timeServiceStarted: " << this->timeServiceStarted << " vs. " << that->timeServiceStarted << endl;
05080 cout << "serviceUtilization: " << this->serviceUtilization << " vs. " << that->serviceUtilization << endl;
05081 #endif
05082 return false;
05083 }
05084
05085 if (!this->otherResults->IsEqual(that->otherResults))
05086 return false;
05087 }
05088 return true;
05089 }
05090 }
05091
05092
05093 bool JobResult::IsEqual(JobResult *that)
05094 {
05095 #ifdef DEBUG_ISEQUAL_ROUTINES
05096 cout << "Start comparing in JobResult" << endl;
05097 #endif
05098 if (this == NULL)
05099 { if (that == NULL)
05100 return true;
05101 else
05102 {
05103 #ifdef DEBUG_ISEQUAL_ROUTINES
05104 cout << "First object is NULL, second is not" << endl;
05105 #endif
05106 return false;
05107 }
05108 }
05109 else
05110 { if (that == NULL)
05111 {
05112 #ifdef DEBUG_ISEQUAL_ROUTINES
05113 cout << "Second object is NULL, first is not" << endl;
05114 #endif
05115 return false;
05116 }
05117 else
05118 {
05119 if (this->status != that->status ||
05120 this->submitTime != that->submitTime ||
05121 this->scheduledStartTime != that->scheduledStartTime ||
05122 this->actualStartTime != that->actualStartTime ||
05123 this->endTime != that->endTime )
05124 {
05125 #ifdef DEBUG_ISEQUAL_ROUTINES
05126 cout << "status: " << this->status << " vs. " << that->status << endl;
05127 cout << "submitTime: " << this->submitTime << " vs. " << that->submitTime << endl;
05128 cout << "scheduledStartTime: " << this->scheduledStartTime << " vs. " << that->scheduledStartTime << endl;
05129 cout << "actualStartTime: " << this->actualStartTime << " vs. " << that->actualStartTime << endl;
05130 cout << "endTime: " << this->endTime << " vs. " << that->endTime << endl;
05131 #endif
05132 return false;
05133 }
05134
05135 if (!this->timingInformation->IsEqual(that->timingInformation))
05136 return false;
05137 if (!this->usedDiskSpace->IsEqual(that->usedDiskSpace))
05138 return false;
05139 if (!this->usedMemory->IsEqual(that->usedMemory))
05140 return false;
05141 if (!this->usedCPUSpeed->IsEqual(that->usedCPUSpeed))
05142 return false;
05143 if (!this->usedCPUNumber->IsEqual(that->usedCPUNumber))
05144 return false;
05145 if (!this->otherResults->IsEqual(that->otherResults))
05146 return false;
05147
05148 return true;
05149 }
05150 }
05151 }
05152
05153
05154 bool TimingInformation::IsEqual(TimingInformation *that)
05155 {
05156 #ifdef DEBUG_ISEQUAL_ROUTINES
05157 cout << "Start comparing in TimingInformation" << endl;
05158 #endif
05159 if (this == NULL)
05160 { if (that == NULL)
05161 return true;
05162 else
05163 {
05164 #ifdef DEBUG_ISEQUAL_ROUTINES
05165 cout << "First object is NULL, second is not" << endl;
05166 #endif
05167 return false;
05168 }
05169 }
05170 else
05171 { if (that == NULL)
05172 {
05173 #ifdef DEBUG_ISEQUAL_ROUTINES
05174 cout << "Second object is NULL, first is not" << endl;
05175 #endif
05176 return false;
05177 }
05178 else
05179 {
05180 if (this->numberOfTimes != that->numberOfTimes)
05181 {
05182 #ifdef DEBUG_ISEQUAL_ROUTINES
05183 cout << "numberOfTimes: " << this->numberOfTimes << " vs. " << that->numberOfTimes << endl;
05184 #endif
05185
05186 return false;
05187 }
05188
05189 for (int i = 0; i < numberOfTimes; i++)
05190 if (!this->time[i]->IsEqual(that->time[i]))
05191 return false;
05192 return true;
05193 }
05194 }
05195 }
05196
05197
05198 bool Time::IsEqual(Time *that)
05199 {
05200 #ifdef DEBUG_ISEQUAL_ROUTINES
05201 cout << "Start comparing in Time" << endl;
05202 #endif
05203 if (this == NULL)
05204 { if (that == NULL)
05205 return true;
05206 else
05207 {
05208 #ifdef DEBUG_ISEQUAL_ROUTINES
05209 cout << "First object is NULL, second is not" << endl;
05210 #endif
05211 return false;
05212 }
05213 }
05214 else
05215 { if (that == NULL)
05216 {
05217 #ifdef DEBUG_ISEQUAL_ROUTINES
05218 cout << "Second object is NULL, first is not" << endl;
05219 #endif
05220 return false;
05221 }
05222 else
05223 {
05224 if (this->unit != that->unit ||
05225 this->type != that->type ||
05226 this->value != that->value ||
05227 this->category != that->category ||
05228 this->description != that->description )
05229 {
05230 #ifdef DEBUG_ISEQUAL_ROUTINES
05231 cout << "unit: " << this->unit << " vs. " << that->unit << endl;
05232 cout << "type: " << this->type << " vs. " << that->type << endl;
05233 cout << "value: " << this->value << " vs. " << that->value << endl;
05234 cout << "category: " << this->category << " vs. " << that->category << endl;
05235 cout << "description: " << this->description << " vs. " << that->description << endl;
05236 #endif
05237 return false;
05238 }
05239 return true;
05240 }
05241 }
05242 }
05243
05244 bool OptimizationResult::IsEqual(OptimizationResult *that)
05245 {
05246 #ifdef DEBUG_ISEQUAL_ROUTINES
05247 cout << "Start comparing in OptimizationResult" << endl;
05248 #endif
05249 if (this == NULL)
05250 { if (that == NULL)
05251 return true;
05252 else
05253 {
05254 #ifdef DEBUG_ISEQUAL_ROUTINES
05255 cout << "First object is NULL, second is not" << endl;
05256 #endif
05257 return false;
05258 }
05259 }
05260 else
05261 { if (that == NULL)
05262 {
05263 #ifdef DEBUG_ISEQUAL_ROUTINES
05264 cout << "Second object is NULL, first is not" << endl;
05265 #endif
05266 return false;
05267 }
05268 else
05269 {
05270 if (this->numberOfSolutions != that->numberOfSolutions ||
05271 this->numberOfVariables != that->numberOfVariables ||
05272 this->numberOfObjectives != that->numberOfObjectives ||
05273 this->numberOfConstraints != that->numberOfConstraints )
05274 {
05275 #ifdef DEBUG_ISEQUAL_ROUTINES
05276 cout << "numberOfSolutions: " << this->numberOfSolutions << " vs. " << that->numberOfSolutions << endl;
05277 cout << "numberOfVariables: " << this->numberOfVariables << " vs. " << that->numberOfVariables << endl;
05278 cout << "numberOfObjectives: " << this->numberOfObjectives << " vs. " << that->numberOfObjectives << endl;
05279 cout << "numberOfConstraints: " << this->numberOfConstraints << " vs. " << that->numberOfConstraints << endl;
05280 #endif
05281 return false;
05282 }
05283
05284 for (int i = 0; i < numberOfSolutions; i++)
05285 if (!this->solution[i]->IsEqual(that->solution[i]))
05286 return false;
05287
05288 if (!this->otherSolverOutput->IsEqual(that->otherSolverOutput))
05289 return false;
05290
05291 return true;
05292 }
05293 }
05294 }
05295
05296
05297 bool OptimizationSolution::IsEqual(OptimizationSolution *that)
05298 {
05299 #ifdef DEBUG_ISEQUAL_ROUTINES
05300 cout << "Start comparing in OptimizationSolution " << endl;
05301 #endif
05302 if (this == NULL)
05303 { if (that == NULL)
05304 return true;
05305 else
05306 {
05307 #ifdef DEBUG_ISEQUAL_ROUTINES
05308 cout << "First object is NULL, second is not" << endl;
05309 #endif
05310 return false;
05311 }
05312 }
05313 else
05314 { if (that == NULL)
05315 {
05316 #ifdef DEBUG_ISEQUAL_ROUTINES
05317 cout << "Second object is NULL, first is not" << endl;
05318 #endif
05319 return false;
05320 }
05321 else
05322 {
05323 if (this->targetObjectiveIdx != that->targetObjectiveIdx)
05324 {
05325 #ifdef DEBUG_ISEQUAL_ROUTINES
05326 cout << "targetObjectiveIdx: " << this->targetObjectiveIdx << " vs. " << that->targetObjectiveIdx << endl;
05327 #endif
05328 return false;
05329 }
05330
05331 if (this->weightedObjectives != that->weightedObjectives)
05332 {
05333 #ifdef DEBUG_ISEQUAL_ROUTINES
05334 cout << "weightedObjectives: " << this->weightedObjectives << " vs. " << that->weightedObjectives << endl;
05335 #endif
05336 return false;
05337 }
05338
05339 if (this->message != that->message)
05340 {
05341 #ifdef DEBUG_ISEQUAL_ROUTINES
05342 cout << "message: \'" << this->message << "\' vs. \'" << that->message << "\'" << endl;
05343 #endif
05344 return false;
05345 }
05346
05347 if (!this->status->IsEqual(that->status))
05348 return false;
05349 if (!this->variables->IsEqual(that->variables))
05350 return false;
05351 if (!this->objectives->IsEqual(that->objectives))
05352 return false;
05353 if (!this->constraints->IsEqual(that->constraints))
05354 return false;
05355 if (!this->otherSolutionResults->IsEqual(that->otherSolutionResults))
05356 return false;
05357
05358 return true;
05359 }
05360 }
05361 }
05362
05363
05364 bool OptimizationSolutionStatus::IsEqual(OptimizationSolutionStatus *that)
05365 {
05366 #ifdef DEBUG_ISEQUAL_ROUTINES
05367 cout << "Start comparing in OptimizationSolutionStatus" << endl;
05368 #endif
05369 if (this == NULL)
05370 { if (that == NULL)
05371 return true;
05372 else
05373 {
05374 #ifdef DEBUG_ISEQUAL_ROUTINES
05375 cout << "First object is NULL, second is not" << endl;
05376 #endif
05377 return false;
05378 }
05379 }
05380 else
05381 { if (that == NULL)
05382 {
05383 #ifdef DEBUG_ISEQUAL_ROUTINES
05384 cout << "Second object is NULL, first is not" << endl;
05385 #endif
05386 return false;
05387 }
05388 else
05389 {
05390 if (this->type != that->type ||
05391 this->description != that->description )
05392 {
05393 #ifdef DEBUG_ISEQUAL_ROUTINES
05394 cout << "type: " << this->type << " vs. " << that->type << endl;
05395 cout << "description: " << this->description << " vs. " << that->description << endl;
05396 #endif
05397 return false;
05398 }
05399
05400 if (this->numberOfSubstatuses != that->numberOfSubstatuses)
05401 {
05402 #ifdef DEBUG_ISEQUAL_ROUTINES
05403 cout << "numberOfSubstatuses: " << this->numberOfSubstatuses << " vs. " << that->numberOfSubstatuses << endl;
05404 #endif
05405
05406 return false;
05407 }
05408
05409 for (int i = 0; i < numberOfSubstatuses; i++)
05410 if (!this->substatus[i]->IsEqual(that->substatus[i]))
05411 return false;
05412
05413 return true;
05414 }
05415 }
05416 }
05417
05418
05419 bool OptimizationSolutionSubstatus::IsEqual(OptimizationSolutionSubstatus *that)
05420 {
05421 #ifdef DEBUG_ISEQUAL_ROUTINES
05422 cout << "Start comparing in OptimizationSolutionSubstatus" << endl;
05423 #endif
05424 if (this == NULL)
05425 { if (that == NULL)
05426 return true;
05427 else
05428 {
05429 #ifdef DEBUG_ISEQUAL_ROUTINES
05430 cout << "First object is NULL, second is not" << endl;
05431 #endif
05432 return false;
05433 }
05434 }
05435 else
05436 { if (that == NULL)
05437 {
05438 #ifdef DEBUG_ISEQUAL_ROUTINES
05439 cout << "Second object is NULL, first is not" << endl;
05440 #endif
05441 return false;
05442 }
05443 else
05444 {
05445 if (this->type != that->type ||
05446 this->description != that->description )
05447 {
05448 #ifdef DEBUG_ISEQUAL_ROUTINES
05449 cout << "type: " << this->type << " vs. " << that->type << endl;
05450 cout << "description: " << this->description << " vs. " << that->description << endl;
05451 #endif
05452 return false;
05453 }
05454
05455 return true;
05456 }
05457 }
05458 }
05459
05460
05461 bool VariableSolution::IsEqual(VariableSolution *that)
05462 {
05463 #ifdef DEBUG_ISEQUAL_ROUTINES
05464 cout << "Start comparing in VariableSolution" << endl;
05465 #endif
05466 if (this == NULL)
05467 { if (that == NULL)
05468 return true;
05469 else
05470 {
05471 #ifdef DEBUG_ISEQUAL_ROUTINES
05472 cout << "First object is NULL, second is not" << endl;
05473 #endif
05474 return false;
05475 }
05476 }
05477 else
05478 { if (that == NULL)
05479 {
05480 #ifdef DEBUG_ISEQUAL_ROUTINES
05481 cout << "Second object is NULL, first is not" << endl;
05482 #endif
05483 return false;
05484 }
05485 else
05486 {
05487 if (this->numberOfOtherVariableResults != that->numberOfOtherVariableResults)
05488 {
05489 #ifdef DEBUG_ISEQUAL_ROUTINES
05490 cout << "numberOfOtherVariableResults: " << this->numberOfOtherVariableResults << " vs. " << that->numberOfOtherVariableResults << endl;
05491 #endif
05492
05493 return false;
05494 }
05495
05496 for (int i = 0; i < numberOfOtherVariableResults; i++)
05497 if (!this->other[i]->IsEqual(that->other[i]))
05498 return false;
05499
05500 if (!this->values->IsEqual(that->values))
05501 return false;
05502 if (!this->valuesString->IsEqual(that->valuesString))
05503 return false;
05504 if (!this->basisStatus->IsEqual(that->basisStatus))
05505 return false;
05506
05507 return true;
05508 }
05509 }
05510 }
05511
05512 bool VariableValues::IsEqual(VariableValues *that)
05513 {
05514 #ifdef DEBUG_ISEQUAL_ROUTINES
05515 cout << "Start comparing in VariableValues" << endl;
05516 #endif
05517 if (this == NULL)
05518 { if (that == NULL)
05519 return true;
05520 else
05521 {
05522 #ifdef DEBUG_ISEQUAL_ROUTINES
05523 cout << "First object is NULL, second is not" << endl;
05524 #endif
05525 return false;
05526 }
05527 }
05528 else
05529 { if (that == NULL)
05530 {
05531 #ifdef DEBUG_ISEQUAL_ROUTINES
05532 cout << "Second object is NULL, first is not" << endl;
05533 #endif
05534 return false;
05535 }
05536 else
05537 {
05538 if (this->numberOfVar != that->numberOfVar)
05539 {
05540 #ifdef DEBUG_ISEQUAL_ROUTINES
05541 cout << "numberOfVar: " << this->numberOfVar << " vs. " << that->numberOfVar << endl;
05542 #endif
05543
05544 return false;
05545 }
05546
05547 for (int i = 0; i < numberOfVar; i++)
05548 if (!this->var[i]->IsEqual(that->var[i]))
05549 return false;
05550
05551 return true;
05552 }
05553 }
05554 }
05555
05556
05557 bool VarValue::IsEqual(VarValue *that)
05558 {
05559 #ifdef DEBUG_ISEQUAL_ROUTINES
05560 cout << "Start comparing in VarValue" << endl;
05561 #endif
05562 if (this == NULL)
05563 { if (that == NULL)
05564 return true;
05565 else
05566 {
05567 #ifdef DEBUG_ISEQUAL_ROUTINES
05568 cout << "First object is NULL, second is not" << endl;
05569 #endif
05570 return false;
05571 }
05572 }
05573 else
05574 { if (that == NULL)
05575 {
05576 #ifdef DEBUG_ISEQUAL_ROUTINES
05577 cout << "Second object is NULL, first is not" << endl;
05578 #endif
05579 return false;
05580 }
05581 else
05582 {
05583 if (this->idx != that->idx ||
05584 this->value != that->value )
05585 {
05586 #ifdef DEBUG_ISEQUAL_ROUTINES
05587 cout << "idx: " << this->idx << " vs. " << that->idx << endl;
05588 cout << "value: " << this->value << " vs. " << that->value << endl;
05589 #endif
05590 return false;
05591 }
05592
05593 return true;
05594 }
05595 }
05596 }
05597
05598
05599 bool VariableValuesString::IsEqual(VariableValuesString *that)
05600 {
05601 #ifdef DEBUG_ISEQUAL_ROUTINES
05602 cout << "Start comparing in VariableValuesString" << endl;
05603 #endif
05604 if (this == NULL)
05605 { if (that == NULL)
05606 return true;
05607 else
05608 {
05609 #ifdef DEBUG_ISEQUAL_ROUTINES
05610 cout << "First object is NULL, second is not" << endl;
05611 #endif
05612 return false;
05613 }
05614 }
05615 else
05616 { if (that == NULL)
05617 {
05618 #ifdef DEBUG_ISEQUAL_ROUTINES
05619 cout << "Second object is NULL, first is not" << endl;
05620 #endif
05621 return false;
05622 }
05623 else
05624 {
05625 if (this->numberOfVar != that->numberOfVar)
05626 {
05627 #ifdef DEBUG_ISEQUAL_ROUTINES
05628 cout << "numberOfVar: " << this->numberOfVar << " vs. " << that->numberOfVar << endl;
05629 #endif
05630
05631 return false;
05632 }
05633
05634 for (int i = 0; i < numberOfVar; i++)
05635 if (!this->var[i]->IsEqual(that->var[i]))
05636 return false;
05637
05638 return true;
05639 }
05640 }
05641 }
05642
05643
05644 bool VarValueString::IsEqual(VarValueString *that)
05645 {
05646 #ifdef DEBUG_ISEQUAL_ROUTINES
05647 cout << "Start comparing in VarValueString" << endl;
05648 #endif
05649 if (this == NULL)
05650 { if (that == NULL)
05651 return true;
05652 else
05653 {
05654 #ifdef DEBUG_ISEQUAL_ROUTINES
05655 cout << "First object is NULL, second is not" << endl;
05656 #endif
05657 return false;
05658 }
05659 }
05660 else
05661 { if (that == NULL)
05662 {
05663 #ifdef DEBUG_ISEQUAL_ROUTINES
05664 cout << "Second object is NULL, first is not" << endl;
05665 #endif
05666 return false;
05667 }
05668 else
05669 {
05670 if (this->idx != that->idx ||
05671 this->value != that->value )
05672 {
05673 #ifdef DEBUG_ISEQUAL_ROUTINES
05674 cout << "idx: " << this->idx << " vs. " << that->idx << endl;
05675 cout << "value: " << this->value << " vs. " << that->value << endl;
05676 #endif
05677 return false;
05678 }
05679
05680 return true;
05681 }
05682 }
05683 }
05684
05685
05686 bool OtherVariableResult::IsEqual(OtherVariableResult *that)
05687 {
05688 #ifdef DEBUG_ISEQUAL_ROUTINES
05689 cout << "Start comparing in OtherVariableResult" << endl;
05690 #endif
05691 if (this == NULL)
05692 { if (that == NULL)
05693 return true;
05694 else
05695 {
05696 #ifdef DEBUG_ISEQUAL_ROUTINES
05697 cout << "First object is NULL, second is not" << endl;
05698 #endif
05699 return false;
05700 }
05701 }
05702 else
05703 { if (that == NULL)
05704 {
05705 #ifdef DEBUG_ISEQUAL_ROUTINES
05706 cout << "Second object is NULL, first is not" << endl;
05707 #endif
05708 return false;
05709 }
05710 else
05711 {
05712 if (this->name != that->name ||
05713 this->value != that->value ||
05714 this->description != that->description )
05715 {
05716 #ifdef DEBUG_ISEQUAL_ROUTINES
05717 cout << "name: " << this->name << " vs. " << that->name << endl;
05718 cout << "value: " << this->value << " vs. " << that->value << endl;
05719 cout << "description: " << this->description << " vs. " << that->description << endl;
05720 #endif
05721 return false;
05722 }
05723
05724 if (this->numberOfVar != that->numberOfVar)
05725 {
05726 #ifdef DEBUG_ISEQUAL_ROUTINES
05727 cout << "numberOfVar: " << this->numberOfVar << " vs. " << that->numberOfVar << endl;
05728 #endif
05729
05730 return false;
05731 }
05732
05733 for (int i = 0; i < numberOfVar; i++)
05734 if (!this->var[i]->IsEqual(that->var[i]))
05735 return false;
05736
05737 if (this->numberOfEnumerations != that->numberOfEnumerations)
05738 {
05739 #ifdef DEBUG_ISEQUAL_ROUTINES
05740 cout << "numberOfEnumerations: " << this->numberOfEnumerations << " vs. " << that->numberOfEnumerations << endl;
05741 #endif
05742
05743 return false;
05744 }
05745
05746 for (int i = 0; i < numberOfEnumerations; i++)
05747 if (!this->enumeration[i]->IsEqual(that->enumeration[i]))
05748 return false;
05749
05750 return true;
05751 }
05752 }
05753 }
05754
05755
05756 bool OtherVarResult::IsEqual(OtherVarResult *that)
05757 {
05758 #ifdef DEBUG_ISEQUAL_ROUTINES
05759 cout << "Start comparing in OtherVarResult" << endl;
05760 #endif
05761 if (this == NULL)
05762 { if (that == NULL)
05763 return true;
05764 else
05765 {
05766 #ifdef DEBUG_ISEQUAL_ROUTINES
05767 cout << "First object is NULL, second is not" << endl;
05768 #endif
05769 return false;
05770 }
05771 }
05772 else
05773 { if (that == NULL)
05774 {
05775 #ifdef DEBUG_ISEQUAL_ROUTINES
05776 cout << "Second object is NULL, first is not" << endl;
05777 #endif
05778 return false;
05779 }
05780 else
05781 {
05782 if (this->idx != that->idx ||
05783 this->value != that->value )
05784 {
05785 #ifdef DEBUG_ISEQUAL_ROUTINES
05786 cout << "idx: " << this->idx << " vs. " << that->idx << endl;
05787 cout << "value: " << this->value << " vs. " << that->value << endl;
05788 #endif
05789 return false;
05790 }
05791
05792 return true;
05793 }
05794 }
05795 }
05796
05797
05798 bool ObjectiveSolution::IsEqual(ObjectiveSolution *that)
05799 {
05800 #ifdef DEBUG_ISEQUAL_ROUTINES
05801 cout << "Start comparing in ObjectiveSolution" << endl;
05802 #endif
05803 if (this == NULL)
05804 { if (that == NULL)
05805 return true;
05806 else
05807 {
05808 #ifdef DEBUG_ISEQUAL_ROUTINES
05809 cout << "First object is NULL, second is not" << endl;
05810 #endif
05811 return false;
05812 }
05813 }
05814 else
05815 { if (that == NULL)
05816 {
05817 #ifdef DEBUG_ISEQUAL_ROUTINES
05818 cout << "Second object is NULL, first is not" << endl;
05819 #endif
05820 return false;
05821 }
05822 else
05823 {
05824 if (this->numberOfOtherObjectiveResults != that->numberOfOtherObjectiveResults)
05825 {
05826 #ifdef DEBUG_ISEQUAL_ROUTINES
05827 cout << "numberOfOtherObjectiveResults: " << this->numberOfOtherObjectiveResults << " vs. " << that->numberOfOtherObjectiveResults << endl;
05828 #endif
05829
05830 return false;
05831 }
05832
05833 for (int i = 0; i < numberOfOtherObjectiveResults; i++)
05834 if (!this->other[i]->IsEqual(that->other[i]))
05835 return false;
05836
05837 if (!this->values->IsEqual(that->values))
05838 return false;
05839 if (!this->basisStatus->IsEqual(that->basisStatus))
05840 return false;
05841
05842 return true;
05843 }
05844 }
05845 }
05846
05847
05848 bool ObjectiveValues::IsEqual(ObjectiveValues *that)
05849 {
05850 #ifdef DEBUG_ISEQUAL_ROUTINES
05851 cout << "Start comparing in ObjectiveValues" << endl;
05852 #endif
05853 if (this == NULL)
05854 { if (that == NULL)
05855 return true;
05856 else
05857 {
05858 #ifdef DEBUG_ISEQUAL_ROUTINES
05859 cout << "First object is NULL, second is not" << endl;
05860 #endif
05861 return false;
05862 }
05863 }
05864 else
05865 { if (that == NULL)
05866 {
05867 #ifdef DEBUG_ISEQUAL_ROUTINES
05868 cout << "Second object is NULL, first is not" << endl;
05869 #endif
05870 return false;
05871 }
05872 else
05873 {
05874 if (this->numberOfObj != that->numberOfObj)
05875 {
05876 #ifdef DEBUG_ISEQUAL_ROUTINES
05877 cout << "numberOfObj: " << this->numberOfObj << " vs. " << that->numberOfObj << endl;
05878 #endif
05879
05880 return false;
05881 }
05882
05883 for (int i = 0; i < numberOfObj; i++)
05884 if (!this->obj[i]->IsEqual(that->obj[i]))
05885 return false;
05886
05887 return true;
05888 }
05889 }
05890 }
05891
05892
05893 bool ObjValue::IsEqual(ObjValue *that)
05894 {
05895 #ifdef DEBUG_ISEQUAL_ROUTINES
05896 cout << "Start comparing in ObjValue" << endl;
05897 #endif
05898 if (this == NULL)
05899 { if (that == NULL)
05900 return true;
05901 else
05902 {
05903 #ifdef DEBUG_ISEQUAL_ROUTINES
05904 cout << "First object is NULL, second is not" << endl;
05905 #endif
05906 return false;
05907 }
05908 }
05909 else
05910 { if (that == NULL)
05911 {
05912 #ifdef DEBUG_ISEQUAL_ROUTINES
05913 cout << "Second object is NULL, first is not" << endl;
05914 #endif
05915 return false;
05916 }
05917 else
05918 {
05919 if (this->idx != that->idx ||
05920 this->value != that->value )
05921 {
05922 #ifdef DEBUG_ISEQUAL_ROUTINES
05923 cout << "idx: " << this->idx << " vs. " << that->idx << endl;
05924 cout << "value: " << this->value << " vs. " << that->value << endl;
05925 #endif
05926 return false;
05927 }
05928
05929 return true;
05930 }
05931 }
05932 }
05933
05934
05935 bool OtherObjectiveResult::IsEqual(OtherObjectiveResult *that)
05936 {
05937 #ifdef DEBUG_ISEQUAL_ROUTINES
05938 cout << "Start comparing in OtherObjectiveResult" << endl;
05939 #endif
05940 if (this == NULL)
05941 { if (that == NULL)
05942 return true;
05943 else
05944 {
05945 #ifdef DEBUG_ISEQUAL_ROUTINES
05946 cout << "First object is NULL, second is not" << endl;
05947 #endif
05948 return false;
05949 }
05950 }
05951 else
05952 { if (that == NULL)
05953 {
05954 #ifdef DEBUG_ISEQUAL_ROUTINES
05955 cout << "Second object is NULL, first is not" << endl;
05956 #endif
05957 return false;
05958 }
05959 else
05960 {
05961 if (this->name != that->name ||
05962 this->value != that->value ||
05963 this->description != that->description )
05964 {
05965 #ifdef DEBUG_ISEQUAL_ROUTINES
05966 cout << "name: " << this->name << " vs. " << that->name << endl;
05967 cout << "value: " << this->value << " vs. " << that->value << endl;
05968 cout << "description: " << this->description << " vs. " << that->description << endl;
05969 #endif
05970 return false;
05971 }
05972
05973 if (this->numberOfObj != that->numberOfObj)
05974 {
05975 #ifdef DEBUG_ISEQUAL_ROUTINES
05976 cout << "numberOfObj: " << this->numberOfObj << " vs. " << that->numberOfObj << endl;
05977 #endif
05978
05979 return false;
05980 }
05981
05982 for (int i = 0; i < numberOfObj; i++)
05983 if (!this->obj[i]->IsEqual(that->obj[i]))
05984 return false;
05985
05986 if (this->numberOfEnumerations != that->numberOfEnumerations)
05987 {
05988 #ifdef DEBUG_ISEQUAL_ROUTINES
05989 cout << "numberOfEnumerations: " << this->numberOfEnumerations << " vs. " << that->numberOfEnumerations << endl;
05990 #endif
05991
05992 return false;
05993 }
05994
05995 for (int i = 0; i < numberOfEnumerations; i++)
05996 if (!this->enumeration[i]->IsEqual(that->enumeration[i]))
05997 return false;
05998
05999 return true;
06000 }
06001 }
06002 }
06003
06004
06005 bool OtherObjResult::IsEqual(OtherObjResult *that)
06006 {
06007 #ifdef DEBUG_ISEQUAL_ROUTINES
06008 cout << "Start comparing in OtherObjResult" << endl;
06009 #endif
06010 if (this == NULL)
06011 { if (that == NULL)
06012 return true;
06013 else
06014 {
06015 #ifdef DEBUG_ISEQUAL_ROUTINES
06016 cout << "First object is NULL, second is not" << endl;
06017 #endif
06018 return false;
06019 }
06020 }
06021 else
06022 { if (that == NULL)
06023 {
06024 #ifdef DEBUG_ISEQUAL_ROUTINES
06025 cout << "Second object is NULL, first is not" << endl;
06026 #endif
06027 return false;
06028 }
06029 else
06030 {
06031 if (this->idx != that->idx ||
06032 this->value != that->value )
06033 {
06034 #ifdef DEBUG_ISEQUAL_ROUTINES
06035 cout << "idx: " << this->idx << " vs. " << that->idx << endl;
06036 cout << "value: " << this->value << " vs. " << that->value << endl;
06037 #endif
06038 return false;
06039 }
06040
06041 return true;
06042 }
06043 }
06044 }
06045
06046
06047 bool ConstraintSolution::IsEqual(ConstraintSolution *that)
06048 {
06049 #ifdef DEBUG_ISEQUAL_ROUTINES
06050 cout << "Start comparing in ConstraintSolution" << endl;
06051 #endif
06052 if (this == NULL)
06053 { if (that == NULL)
06054 return true;
06055 else
06056 {
06057 #ifdef DEBUG_ISEQUAL_ROUTINES
06058 cout << "First object is NULL, second is not" << endl;
06059 #endif
06060 return false;
06061 }
06062 }
06063 else
06064 { if (that == NULL)
06065 {
06066 #ifdef DEBUG_ISEQUAL_ROUTINES
06067 cout << "Second object is NULL, first is not" << endl;
06068 #endif
06069 return false;
06070 }
06071 else
06072 {
06073 if (this->numberOfOtherConstraintResults != that->numberOfOtherConstraintResults)
06074 {
06075 #ifdef DEBUG_ISEQUAL_ROUTINES
06076 cout << "numberOfOtherConstraintResults: " << this->numberOfOtherConstraintResults << " vs. " << that->numberOfOtherConstraintResults << endl;
06077 #endif
06078
06079 return false;
06080 }
06081
06082 for (int i = 0; i < numberOfOtherConstraintResults; i++)
06083 if (!this->other[i]->IsEqual(that->other[i]))
06084 return false;
06085
06086 if (!this->dualValues->IsEqual(that->dualValues))
06087 return false;
06088 if (!this->basisStatus->IsEqual(that->basisStatus))
06089 return false;
06090
06091 return true;
06092 }
06093 }
06094 }
06095
06096
06097 bool DualVariableValues::IsEqual(DualVariableValues *that)
06098 {
06099 #ifdef DEBUG_ISEQUAL_ROUTINES
06100 cout << "Start comparing in DualVariableValues" << endl;
06101 #endif
06102 if (this == NULL)
06103 { if (that == NULL)
06104 return true;
06105 else
06106 {
06107 #ifdef DEBUG_ISEQUAL_ROUTINES
06108 cout << "First object is NULL, second is not" << endl;
06109 #endif
06110 return false;
06111 }
06112 }
06113 else
06114 { if (that == NULL)
06115 {
06116 #ifdef DEBUG_ISEQUAL_ROUTINES
06117 cout << "Second object is NULL, first is not" << endl;
06118 #endif
06119 return false;
06120 }
06121 else
06122 {
06123 if (this->numberOfCon != that->numberOfCon)
06124 {
06125 #ifdef DEBUG_ISEQUAL_ROUTINES
06126 cout << "numberOfCon: " << this->numberOfCon << " vs. " << that->numberOfCon << endl;
06127 #endif
06128
06129 return false;
06130 }
06131
06132 for (int i = 0; i < numberOfCon; i++)
06133 if (!this->con[i]->IsEqual(that->con[i]))
06134 return false;
06135
06136 return true;
06137 }
06138 }
06139 }
06140
06141 bool DualVarValue::IsEqual(DualVarValue *that)
06142 {
06143 #ifdef DEBUG_ISEQUAL_ROUTINES
06144 cout << "Start comparing in DualVarValue" << endl;
06145 #endif
06146 if (this == NULL)
06147 { if (that == NULL)
06148 return true;
06149 else
06150 {
06151 #ifdef DEBUG_ISEQUAL_ROUTINES
06152 cout << "First object is NULL, second is not" << endl;
06153 #endif
06154 return false;
06155 }
06156 }
06157 else
06158 { if (that == NULL)
06159 {
06160 #ifdef DEBUG_ISEQUAL_ROUTINES
06161 cout << "Second object is NULL, first is not" << endl;
06162 #endif
06163 return false;
06164 }
06165 else
06166 {
06167 if (this->idx != that->idx ||
06168 this->value != that->value )
06169 {
06170 #ifdef DEBUG_ISEQUAL_ROUTINES
06171 cout << "idx: " << this->idx << " vs. " << that->idx << endl;
06172 cout << "value: " << this->value << " vs. " << that->value << endl;
06173 #endif
06174 return false;
06175 }
06176
06177 return true;
06178 }
06179 }
06180 }
06181
06182 bool OtherConstraintResult::IsEqual(OtherConstraintResult *that)
06183 {
06184 #ifdef DEBUG_ISEQUAL_ROUTINES
06185 cout << "Start comparing in OtherConstraintResult" << endl;
06186 #endif
06187 if (this == NULL)
06188 { if (that == NULL)
06189 return true;
06190 else
06191 {
06192 #ifdef DEBUG_ISEQUAL_ROUTINES
06193 cout << "First object is NULL, second is not" << endl;
06194 #endif
06195 return false;
06196 }
06197 }
06198 else
06199 { if (that == NULL)
06200 {
06201 #ifdef DEBUG_ISEQUAL_ROUTINES
06202 cout << "Second object is NULL, first is not" << endl;
06203 #endif
06204 return false;
06205 }
06206 else
06207 {
06208 if (this->name != that->name ||
06209 this->value != that->value ||
06210 this->description != that->description )
06211 {
06212 #ifdef DEBUG_ISEQUAL_ROUTINES
06213 cout << "name: " << this->name << " vs. " << that->name << endl;
06214 cout << "value: " << this->value << " vs. " << that->value << endl;
06215 cout << "description: " << this->description << " vs. " << that->description << endl;
06216 #endif
06217 return false;
06218 }
06219
06220 if (this->numberOfCon != that->numberOfCon)
06221 {
06222 #ifdef DEBUG_ISEQUAL_ROUTINES
06223 cout << "numberOfCon: " << this->numberOfCon << " vs. " << that->numberOfCon << endl;
06224 #endif
06225
06226 return false;
06227 }
06228
06229 for (int i = 0; i < numberOfCon; i++)
06230 if (!this->con[i]->IsEqual(that->con[i]))
06231 return false;
06232
06233 if (this->numberOfEnumerations != that->numberOfEnumerations)
06234 {
06235 #ifdef DEBUG_ISEQUAL_ROUTINES
06236 cout << "numberOfEnumerations: " << this->numberOfEnumerations << " vs. " << that->numberOfEnumerations << endl;
06237 #endif
06238
06239 return false;
06240 }
06241
06242 for (int i = 0; i < numberOfEnumerations; i++)
06243 if (!this->enumeration[i]->IsEqual(that->enumeration[i]))
06244 return false;
06245
06246 return true;
06247 }
06248 }
06249 }
06250
06251
06252 bool OtherConResult::IsEqual(OtherConResult *that)
06253 {
06254 #ifdef DEBUG_ISEQUAL_ROUTINES
06255 cout << "Start comparing in OtherConResult" << endl;
06256 #endif
06257 if (this == NULL)
06258 { if (that == NULL)
06259 return true;
06260 else
06261 {
06262 #ifdef DEBUG_ISEQUAL_ROUTINES
06263 cout << "First object is NULL, second is not" << endl;
06264 #endif
06265 return false;
06266 }
06267 }
06268 else
06269 { if (that == NULL)
06270 {
06271 #ifdef DEBUG_ISEQUAL_ROUTINES
06272 cout << "Second object is NULL, first is not" << endl;
06273 #endif
06274 return false;
06275 }
06276 else
06277 {
06278 if (this->idx != that->idx ||
06279 this->value != that->value )
06280 {
06281 #ifdef DEBUG_ISEQUAL_ROUTINES
06282 cout << "idx: " << this->idx << " vs. " << that->idx << endl;
06283 cout << "value: " << this->value << " vs. " << that->value << endl;
06284 #endif
06285 return false;
06286 }
06287
06288 return true;
06289 }
06290 }
06291 }
06292
06293
06294 bool OtherSolutionResults::IsEqual(OtherSolutionResults *that)
06295 {
06296 #ifdef DEBUG_ISEQUAL_ROUTINES
06297 cout << "Start comparing in OtherSolutionResults" << endl;
06298 #endif
06299 if (this == NULL)
06300 { if (that == NULL)
06301 return true;
06302 else
06303 {
06304 #ifdef DEBUG_ISEQUAL_ROUTINES
06305 cout << "First object is NULL, second is not" << endl;
06306 #endif
06307 return false;
06308 }
06309 }
06310 else
06311 { if (that == NULL)
06312 {
06313 #ifdef DEBUG_ISEQUAL_ROUTINES
06314 cout << "Second object is NULL, first is not" << endl;
06315 #endif
06316 return false;
06317 }
06318 else
06319 {
06320 if (this->numberOfOtherSolutionResults != that->numberOfOtherSolutionResults)
06321 {
06322 #ifdef DEBUG_ISEQUAL_ROUTINES
06323 cout << "numberOfOtherSolutionResults: " << this->numberOfOtherSolutionResults << " vs. " << that->numberOfOtherSolutionResults << endl;
06324 #endif
06325
06326 return false;
06327 }
06328
06329 for (int i = 0; i < numberOfOtherSolutionResults; i++)
06330 if (!this->otherSolutionResult[i]->IsEqual(that->otherSolutionResult[i]))
06331 return false;
06332
06333 return true;
06334 }
06335 }
06336 }
06337
06338 bool OtherSolutionResult::IsEqual(OtherSolutionResult *that)
06339 {
06340 #ifdef DEBUG_ISEQUAL_ROUTINES
06341 cout << "Start comparing in OtherSolutionResult" << endl;
06342 #endif
06343 if (this == NULL)
06344 { if (that == NULL)
06345 return true;
06346 else
06347 {
06348 #ifdef DEBUG_ISEQUAL_ROUTINES
06349 cout << "First object is NULL, second is not" << endl;
06350 #endif
06351 return false;
06352 }
06353 }
06354 else
06355 { if (that == NULL)
06356 {
06357 #ifdef DEBUG_ISEQUAL_ROUTINES
06358 cout << "Second object is NULL, first is not" << endl;
06359 #endif
06360 return false;
06361 }
06362 else
06363 {
06364
06365 if (this->name != that->name ||
06366 this->category != that->category ||
06367 this->description != that->description )
06368 {
06369 #ifdef DEBUG_ISEQUAL_ROUTINES
06370 cout << "name: " << this->name << " vs. " << that->name << endl;
06371 cout << "category: " << this->category << " vs. " << that->category << endl;
06372 cout << "description: " << this->description << " vs. " << that->description << endl;
06373 #endif
06374 return false;
06375 }
06376
06377 if (this->numberOfItems != that->numberOfItems)
06378 {
06379 #ifdef DEBUG_ISEQUAL_ROUTINES
06380 cout << "numberOfItems: " << this->numberOfItems << " vs. " << that->numberOfItems << endl;
06381 #endif
06382
06383 return false;
06384 }
06385
06386 for (int i = 0; i < numberOfItems; i++)
06387 if (this->item[i] != that->item[i])
06388 {
06389 #ifdef DEBUG_ISEQUAL_ROUTINES
06390 cout << "item: " << this->item[i] << " vs. " << that->item[i] << endl;
06391 #endif
06392 return false;
06393 }
06394
06395 return true;
06396 }
06397 }
06398 }
06399
06400
06401 bool OtherSolverOutput::IsEqual(OtherSolverOutput *that)
06402 {
06403 #ifdef DEBUG_ISEQUAL_ROUTINES
06404 cout << "Start comparing in OtherSolverOutput" << endl;
06405 #endif
06406 if (this == NULL)
06407 { if (that == NULL)
06408 return true;
06409 else
06410 {
06411 #ifdef DEBUG_ISEQUAL_ROUTINES
06412 cout << "First object is NULL, second is not" << endl;
06413 #endif
06414 return false;
06415 }
06416 }
06417 else
06418 { if (that == NULL)
06419 {
06420 #ifdef DEBUG_ISEQUAL_ROUTINES
06421 cout << "Second object is NULL, first is not" << endl;
06422 #endif
06423 return false;
06424 }
06425 else
06426 {
06427 if (this->numberOfSolverOutputs != that->numberOfSolverOutputs)
06428 {
06429 #ifdef DEBUG_ISEQUAL_ROUTINES
06430 cout << "numberOfSolverOutputs: " << this->numberOfSolverOutputs << " vs. " << that->numberOfSolverOutputs << endl;
06431 #endif
06432
06433 return false;
06434 }
06435
06436 for (int i = 0; i < numberOfSolverOutputs; i++)
06437 if (!this->solverOutput[i]->IsEqual(that->solverOutput[i]))
06438 return false;
06439
06440 return true;
06441 }
06442 }
06443 }
06444
06445
06446 bool SolverOutput::IsEqual(SolverOutput *that)
06447 {
06448 #ifdef DEBUG_ISEQUAL_ROUTINES
06449 cout << "Start comparing in SolverOutput" << endl;
06450 #endif
06451 if (this == NULL)
06452 { if (that == NULL)
06453 return true;
06454 else
06455 {
06456 #ifdef DEBUG_ISEQUAL_ROUTINES
06457 cout << "First object is NULL, second is not" << endl;
06458 #endif
06459 return false;
06460 }
06461 }
06462 else
06463 { if (that == NULL)
06464 {
06465 #ifdef DEBUG_ISEQUAL_ROUTINES
06466 cout << "Second object is NULL, first is not" << endl;
06467 #endif
06468 return false;
06469 }
06470 else
06471 {
06472 if (this->name != that->name ||
06473 this->category != that->category ||
06474 this->description != that->description )
06475 {
06476 #ifdef DEBUG_ISEQUAL_ROUTINES
06477 cout << "name: " << this->name << " vs. " << that->name << endl;
06478 cout << "category: " << this->category << " vs. " << that->category << endl;
06479 cout << "description: " << this->description << " vs. " << that->description << endl;
06480 #endif
06481 return false;
06482 }
06483
06484 if (this->numberOfItems != that->numberOfItems)
06485 {
06486 #ifdef DEBUG_ISEQUAL_ROUTINES
06487 cout << "numberOfItems: " << this->numberOfItems << " vs. " << that->numberOfItems << endl;
06488 #endif
06489
06490 return false;
06491 }
06492
06493 for (int i = 0; i < numberOfItems; i++)
06494 if (this->item[i] != that->item[i])
06495 {
06496 #ifdef DEBUG_ISEQUAL_ROUTINES
06497 cout << "item: " << this->item[i] << " vs. " << that->item[i] << endl;
06498 #endif
06499 return false;
06500 }
06501
06502 return true;
06503 }
06504 }
06505 }
06506