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