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