Research Article
Cyber-Physical-Social Model for Service Recommendation in the Internet of Things
Algorithm 2
The semantic distance solving algorithm for behavior patterns of individual users in niches.
| Input: Sp, Sq | | Output: the behavior pattern matrix [] | | Begin: | (1) | Search , making ci Z+ | (2) | Repeat | | cpm cpm; cqn cqn; | (3) | End | (4) | Repeat | | Establish nodes with Bpm, BpmSp; | (5) | Repeat | | Establish nodes Bqn, and edge (Bpm, Bqn), meeting the consumption dmndt (Bpm, Bqn); | (6) | End | (7) | End | (8) | Array b [ cp1, cp2, , cpm, -cq1, -cq2, , -cqn]; bmax { cpm, cqn }; 2log(bmax); fmn = 0; | (9) | Repeat | | If:b! = 0 do | | If: | | Select BpmSp, meeting b[m] ; | | Select BqnSq, meeting b[m + n-1] -; | | do | | Search the edge needing minimum consumption in graph; | | b[m] b[m] ; b[m + n-1] b[m + n-1]+ ; fmnfmn+ ; | | Else: | | Goto row 11; | | Else: | | Goto row 12; | (10) | End | (11) | If: = 1 do | | Goto row 12; | | Else | | /2; goto row 9; | (12) | Repeat | | pq ; | (13) | End | (14) | Return [pq]; |
|