  Reconfigurable intelligent surface (RIS) technology is a promising method to
enhance the device-to-device (D2D) communications. To maximize the sum rate of
the cellular and D2D networks, a joint optimization of the position and the
phase shift of RIS in D2D communications is considered in this paper. To solve
the non-convex sum rate maximum problem, we propose a novel convolutional
neural network (CNN) based deep Q-network (DQN) that jointly optimizes the RIS
position and its phase shift with lower complexity. Numerical results
illustrate that the proposed algorithm can achieve higher sum rate compared to
the benchmark algorithms, meanwhile meeting the quality of service (QoS)
requirements at D2D receivers and the base station (BS).
