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