Skip to main content
. 2023 Feb 17;23(4):2275. doi: 10.3390/s23042275
Algorithm 3: Stable task assignment algorithm with adjustable bids
Step 1: Initialization
1: m=1, siS, tkT, pm(i,k)=pmax(i,k), flagi=1
Step 2: Buyer and seller’s transaction phase
2: while siSflagi>0 does
3: for siS do
4:    first calculate r(i, k)=r(si)r(tk), then calculate c(i, k) and q(i, k) from r(i, k), then calculate wmsi=tkpm(i,k)c(i,k), tkT
5:    if wmsi, then
6:        for tkwmsi do
7:        the user si, sends the solicitation packages pm(i, k) and q(i, k) to the task. tk
8:        end for
9:    end if
10: end for
11: for tkT do
12:    tk after collecting the bid packets sent by sellers, use wm(tk) to indicate the set of sellers for the bid packets received at tk use the DP algorithm to select the sellers from wm(tk) and reject the unselected sellers
13: end for
14: for tkT, siwmtk do
15:    if si, is rejected by tk and pm(i, k)>c(i, k), then
16:        pm+1(i, k)=maxpm(i, k)δi, c(i, k)
17:    else, if tk, or pm(i, k)=c(i, k) receives si, then
18:        pm+1(i, k)=pm(i, k)
19:    end if
20:    flagi=0
21:    if pm+1(i, k)pm(i, k), then
22:        flagi=1
23:    end if
24: end for
25: m=m+1
26: end while