-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathfunc_solve_pgame.cpp
More file actions
58 lines (47 loc) · 1.99 KB
/
Copy pathfunc_solve_pgame.cpp
File metadata and controls
58 lines (47 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
* func_construct_symmodel.cpp
*
* Created on: 10.09.2020
* Author: M. Khaled
*/
#include "omega.h"
namespace pFacesOmegaKernels {
/* to init the function */
void pFacesOmega::init_solve_pgame(){
// create the parity game solver
pParityGameSolver = std::make_shared<PGSISolver<post_func_t, L_x_func_t, L_u_func_t>>(*pParityGame);
}
size_t solve_pgame(void* pPackedKernel, void* pPackedParallelProgram){
(void)pPackedParallelProgram;
static pFacesOmega* pKernel = (pFacesOmega*)pPackedKernel;
pKernel->pParityGameSolver->solve();
strix_aut::Player winner = pKernel->pParityGameSolver->getWinner();
if(winner == strix_aut::Player::SYS_PLAYER){
pfacesTerminal::showInfoMessage("solve_pgame: A controller is found !");
pKernel->is_realizable = true;
return 0;
}
else {
pfacesTerminal::showInfoMessage("solve_pgame: A controller is not found !");
pKernel->is_realizable = false;
return 1;
}
}
/* add the function to the instruction list */
void pFacesOmega::add_func_solve_pgame(std::vector<std::shared_ptr<pfacesInstruction>>& instrList, const cl::Device& targetDevice){
(void)targetDevice;
/* a message to declare start of execution */
std::shared_ptr<pfacesInstruction> instrMsg_start_solve_pgame = std::make_shared<pfacesInstruction>();
instrMsg_start_solve_pgame->setAsMessage("Solving the parity game ... ");
instrList.push_back(instrMsg_start_solve_pgame);
/* a sync point */
std::shared_ptr<pfacesInstruction> instr_BlockingSyncPoint = std::make_shared<pfacesInstruction>();
instr_BlockingSyncPoint->setAsBlockingSyncPoint();
instrList.push_back(instr_BlockingSyncPoint);
/* a host side function to solve the PGame */
/* TODO: replace with parallel implementation */
std::shared_ptr<pfacesInstruction> instr_hostSolvePGame = std::make_shared<pfacesInstruction>();
instr_hostSolvePGame->setAsHostFunction(solve_pgame, "solve_pgame");
instrList.push_back(instr_hostSolvePGame);
}
}