# 6G Goal-Oriented Communications: How to Coexist with Legacy Systems?
## 4 Problem Formulation and Solution
### Solution of the Instantaneous Problem  
Let us notice that the first indicator function in (30) (\(\mathbf{1}_{\{\Theta_{t}\geq\Theta_{\mathrm{th}}\}}\)) is strongly dependent on the choice of the PER (equivalently, in practice, on the specific MCS employed for GO communication at time slot \(t\)). It should be noted that, in general, there is no known function relating PER and entropy relative increase (goal value). In addition, differently from the one related to the delay (which is known if system state is perfectly known at the MEH--as we assume here), the actual value of such indicator variable is made available by the server only _after the inference takes place_, i.e., after the computation phase, which is obviously too late to make a decision. Therefore, the decision has to be made on a \"bestguess\" of what the outcome could be. For this reason, as an approximation to solve (30), we replace the first indicator function with its expectation, i.e., the probability of the goal value exceeding the threshold. Nevertheless, this approximation is not enough to solve the problem, as a model linking the PER and this probability is generally not available in advance. One possible solution is to exploit model-free optimization tools, such as DRL [59]. However, as the scope of this paper (and, in particular, of this section) is to provide a contribution to the coexistence of GO and DO systems, we will rely on a look-up table built on a validation set. Specifically, using a validation set from the considered input pattern set, we build a look-up table linking PER at \(AP_{\delta}\) and the probability of the goal value being above the predefined threshold, to be used during operation time to select the desired PER, based on current virtual queue states and context parameter realizations.  
Once the first indicator function in (30) (i.e., \(\mathbf{1}_{\{\Theta\geq\Theta_{\Theta}\}}\)) is replaced with its expected value (i.e., the probability of the event) and the look-up table is built, the remaining part of the problem can be _optimally solved_ via an exhaustive search over the involved variables. The overall procedure to dynamically select DO user transmit power and GO system PER is described in Algorithm 1.  
```
At each time slot \(t\):  1. Observe wireless channel realizations, computation resources and virtual queue states;  2. Solve (30) as described in Section 4.1  3. Observe the real goal value outcome at the output of the classifier (14), and update the virtual queue \(Z_{t}\) as in (28)  4. Go to next time slot \(t+1\)
```  
**Algorithm 1**Goal-oriented resource allocation  
The main challenge of the proposed method is the need of modeling the whole system, including the inference performance as a function of the PER. In more practical scenarios, such a system modeling requirement can be bypassed through the exploitation of data-driven techniques, such as RL. By applying such an approach, the system can adapt through exploration and exploitation of previously performed actions to find the right balance towards an optimized policy. The latter investigation is left for future works, while, in this paper, we make use of a model to give insights on the achievable system performance.