-
Notifications
You must be signed in to change notification settings - Fork 0
CMapLapParaSolverAPI
Nariaki Tateiwa edited this page Mar 30, 2022
·
1 revision
- Communication with Load Coordinator
-
Sending Objects to Load Coordinator
sendBasis
: API for sending lattice basis matrix to LoadCoordinatorsendVectors
: API for sending lattice vectors to LoadCoordinatorsendSolution
: API for sending lattice vector to LoadCoordinatornotificationIsNecessary
: API for checking if the solver should send a notification messageiReceiveIsNecessary
: API for checking if the solver should execute iReceiveMessages function of CMapLapParaSolverAPIshareVectorsIsNecessary
: API for checking if the solver should send lattice vectors to LoadCoordinatoor
- Sending Solver Status
-
Receiving Objects
hasReceivedBasis
: API for checking the solve has received lattice basis matrix from LoadCoordinatorgetReceivedBasis
: API for getter of lattice basis matrix solver received from LoadCoordinatorrequestVectors
: API for requesting the lattice vectors to Load CoordinatorhasReceivedVectors
: API for checking the solve has received lattice vectors from LoadCoordinatorgetReceivedVectors
: API for getter of lattice vectors received from LoadCoordinator
The solver needs to run this function periodically at sufficiently short intervals, for example, 1 second.
void iReceiveMessages()
-
basis
, required -- Lattice basis. -
enumCost
, optional -- Cost of enumeration generated from basis. If this is omitted, it will be calculated as the full enumeration cost in the function.
void sendBasis(
ParaCMapLAP::BasisMatrix<int> &basis,
double enumCost=-1
)
-
vectors
, required -- Matirx including lattice vectors in row major.
void sendVectors(
ParaCMapLAP::BasisMatrix<int> &vectors
)
Lattice vectors sent by this API will have priority over other messages.
-
v
, required -- A lattice vectors. -
objValue
, required -- Objective value about v.
void sendSolution(
ParaCMapLAP::LatticeVector<int> &v,
double objValue
)
bool notificationIsNecessary(
)
Example code in program as solver.
// check to be necessary to send the status
if( cmapLapParaSolver->notificationIsNecessary() )
{
sendStatus(...); // send solver satus
}
iReceiveIsNecessary
: API for checking if the solver should execute iReceiveMessages function of CMapLapParaSolverAPI
bool iReceiveIsNecessary()
Example code in program as solver.
if( cmapLapParaSolver->iReceiveIsNecessary() )
{
cmapLapParaSolver->iReceiveMessages();
}
shareVectorsIsNecessary
: API for checking if the solver should send lattice vectors to LoadCoordinatoor
// check to share vectors
if( cmapLapParaSolver->shareVectorsIsNecessary() )
{
// sendVectors <-- create SVP::BasisMatrix matrix includes vectors
cmapLapParaSolver->sendVectors(sendVectors);
}
APIs for sending the state of the solver depends on lattice algorithms.
-
inBasis
, required -- current lattice basis. -
inCurrentBlockSize
, required -- currend BKZ block size. -
inTour
, required -- current number of BKZ loop. -
inElapsedTime
, required -- current elapsed time.
void sendSolverState(
ParaCMapLAP::BasisMatrix<int>& inBasis,
int inCurrentBlockSize,
int inTour,
double inElapsedTime
)
-
inElapsedTime
, required -- current elapsed time. -
inCoeff
, required -- coefficients of a current search node -
inDepth
, required -- depth of current searched node -
inShortestNorm
, required -- the shortest norm found -
inNumSearchedNodes
, required -- number of searched nodes in the enumeration tree
void sendSolverState(
double inElapsedTime,
ParaCMapLAP::LatticeVector<int> &inCoeff,
int inDepth,
double inEnumCost,
double inShortestNorm,
long int inNumSearchedNodes
)
-
inElapsedTime
, required -- current elapsed time. -
inBlockSize
, required -- block size. -
inNLoop
, required -- number of Sieve algorithm loop -
inListSize
, required -- size of List L -
inStackSize
, required -- size of Stack S -
inMaxListSize
, required -- maximum size used by List L -
inNCollisions
, required -- number of collisions -
inShortestNorm
, required -- the shortest norm found
void sendSolverState(
double inElapsedTime
int inBlockSize,
long int inNLoop,
int inListSize,
int inStackSize,
int inMaxListSize,
int inNCollisions,
double inShortestNorm
)
hasReceivedBasis
: API for checking the solve has received lattice basis matrix from LoadCoordinator
bool hasReceivedBasis()
template<typename BasisFloat>
SVP::BasisMatrix<BasisFloat> getReceivedBasis()
Parameters
-
nRequestVectors
, required -- number of requested lattice vecotrs
void requestVectors(
int nRequestVectors
)
Returns
- bool: true if solver has received vectors from Load Coordinator else false
bool hasReceivedVectors()
Parameters
-
vectors
, requiered -- received vectors
Returns
- bool: true if number of received vectors is greater than 0 else false
template<typename BasisFloat>
bool getReceivedVectors(
SVP::BasisMatrix<BasisFloat> &vectors
)