Class for cross-testing solvers of the Continuous Quadratic Knapsack Problem implemented as derived object of the class CQKnPClass [see CQKnPClass.h]. More...
#include <CQKnPClone.h>
Public Member Functions | |
| CQKnPClone (void) | |
| Construct both the Master and the Slave object. | |
| void | LoadSet (const int pn=0, const double *pC=0, const double *pD=0, const double *pA=0, const double *pB=0, const double pV=0, const bool sns=true) |
| Load data in both the Master and the Slave object. | |
| void | SetEps (const double eps=1e-6) |
| Set tolerance in both the Master and the Slave object. | |
| CQKnPClass::CQKStatus | SolveKNP (void) |
| Solve the problem in both the Master and the Slave object, check that the solution status agrees. | |
| double | KNPGetFO (void) |
| Recover optimal value in both the Master and the Slave object, check that they agree. | |
| void | ChgLCosts (const double *csts, const int *nms=0, int strt=0, int stp=Inf< int >()) |
| Change linear costs in both the Master and the Slave object. | |
| void | ChgQCosts (const double *csts, const int *nms=0, int strt=0, int stp=Inf< int >()) |
| Change quadratic costs in both the Master and the Slave object. | |
| void | ChgLCost (int i, const double cst) |
| Change a linear cost in both the Master and the Slave object. | |
| void | ChgQCost (int i, const double cst) |
| Change a quadratic cost in both the Master and the Slave object. | |
| void | ChgLBnds (const double *bnds, const int *nms=0, int strt=0, int stp=Inf< int >()) |
| Change lower bounds in both the Master and the Slave object. | |
| void | ChgUBnds (const double *bnds, const int *nms=0, int strt=0, int stp=Inf< int >()) |
| Change upper bounds in both the Master and the Slave object. | |
| void | ChgLBnd (int i, const double bnd) |
| Change a lower bound in both the Master and the Slave object. | |
| void | ChgUBnd (int i, const double bnd) |
| Change an upper bound in both the Master and the Slave object. | |
| void | ChgVlm (const double NVlm) |
| Change volume in both the Master and the Slave object. | |
| ~CQKnPClone () | |
| Destroy the Slave object together with the Master. | |
Public Attributes | |
| Slave * | SlvCQK |
| pointer to the "slave" object; it is public in order to allow calling the methods of the specialized interface of the slave class | |
Class for cross-testing solvers of the Continuous Quadratic Knapsack Problem implemented as derived object of the class CQKnPClass [see CQKnPClass.h].
The class is template over two objects, a "Master" one and a "Slave" one, that are assumed to be both derived from CQKnPClass; it derives from the Master class, and creates an object of the Slave class. Every call to a method is "reflected" on both objects. In some cases, checks are performed that the results agree.
The rationale for having CQKnPClone to derive from the Master class is that some methods (typically, these that read back the data of the problem) do not need to be redefined, as being CQKnPClone derived from Master the Master:: implementation of the method is automatically used (of course this implies that no checks are done that Master and Slave agree on which data they have, which perhaps should be done).
| CQKnPClone | ( | void | ) | [inline] |
Construct both the Master and the Slave object.
References CQKnPClone< Master, Slave >::SlvCQK.
| ~CQKnPClone | ( | ) | [inline] |
Destroy the Slave object together with the Master.
References CQKnPClone< Master, Slave >::SlvCQK.
| void LoadSet | ( | const int | pn = 0, |
| const double * | pC = 0, |
||
| const double * | pD = 0, |
||
| const double * | pA = 0, |
||
| const double * | pB = 0, |
||
| const double | pV = 0, |
||
| const bool | sns = true |
||
| ) | [inline] |
Load data in both the Master and the Slave object.
References CQKnPClone< Master, Slave >::SlvCQK.
| void SetEps | ( | const double | eps = 1e-6 | ) | [inline] |
Set tolerance in both the Master and the Slave object.
References CQKnPClone< Master, Slave >::SlvCQK.
| CQKnPClass::CQKStatus SolveKNP | ( | void | ) | [inline] |
Solve the problem in both the Master and the Slave object, check that the solution status agrees.
References CQKnPClone< Master, Slave >::SlvCQK.
| double KNPGetFO | ( | void | ) | [inline] |
Recover optimal value in both the Master and the Slave object, check that they agree.
References CQKnPClone< Master, Slave >::SlvCQK.
| void ChgLCosts | ( | const double * | csts, |
| const int * | nms = 0, |
||
| int | strt = 0, |
||
| int | stp = Inf<int>() |
||
| ) | [inline] |
Change linear costs in both the Master and the Slave object.
References CQKnPClone< Master, Slave >::SlvCQK.
| void ChgQCosts | ( | const double * | csts, |
| const int * | nms = 0, |
||
| int | strt = 0, |
||
| int | stp = Inf<int>() |
||
| ) | [inline] |
Change quadratic costs in both the Master and the Slave object.
References CQKnPClone< Master, Slave >::SlvCQK.
| void ChgLCost | ( | int | i, |
| const double | cst | ||
| ) | [inline] |
Change a linear cost in both the Master and the Slave object.
References CQKnPClone< Master, Slave >::SlvCQK.
| void ChgQCost | ( | int | i, |
| const double | cst | ||
| ) | [inline] |
Change a quadratic cost in both the Master and the Slave object.
References CQKnPClone< Master, Slave >::SlvCQK.
| void ChgLBnds | ( | const double * | bnds, |
| const int * | nms = 0, |
||
| int | strt = 0, |
||
| int | stp = Inf<int>() |
||
| ) | [inline] |
Change lower bounds in both the Master and the Slave object.
References CQKnPClone< Master, Slave >::SlvCQK.
| void ChgUBnds | ( | const double * | bnds, |
| const int * | nms = 0, |
||
| int | strt = 0, |
||
| int | stp = Inf<int>() |
||
| ) | [inline] |
Change upper bounds in both the Master and the Slave object.
References CQKnPClone< Master, Slave >::SlvCQK.
| void ChgLBnd | ( | int | i, |
| const double | bnd | ||
| ) | [inline] |
Change a lower bound in both the Master and the Slave object.
References CQKnPClone< Master, Slave >::SlvCQK.
| void ChgUBnd | ( | int | i, |
| const double | bnd | ||
| ) | [inline] |
Change an upper bound in both the Master and the Slave object.
References CQKnPClone< Master, Slave >::SlvCQK.
| void ChgVlm | ( | const double | NVlm | ) | [inline] |
Change volume in both the Master and the Slave object.
References CQKnPClone< Master, Slave >::SlvCQK.