Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The question about the correctness of responsibility calculation of submodels. #8

Open
Ln7-best opened this issue Oct 14, 2023 · 0 comments

Comments

@Ln7-best
Copy link

Hi, I just read the code about the implementation of submodle responsibility calculation and have a question about the correctness of the following code in rqrmi_tools.cpp, line 422-452:

for (; vec; vec = (scalar_t*)vector_list_iterate(U_i)) {
      // Get next transition point
      scalar_t pt = vec[0];

      // Get the bucket just before current point B(S(pt-epsilon))
      uint32_t bucket = vec[1];

      // Add new responsibility interval to the submodel corresponds to the last
      // bucket
      scalar_t* new_interval = (scalar_t*)vector_list_push_back_and_get(
          probe->responsibilities[stage_idx][bucket]);

      // Check whether the current value is relevant to the bucket as well
      scalar_t M = rqrmi_evaluate_model(model, pt);
      uint32_t B = probe->stage_width[stage_idx] * (M < 0    ? 0
                                                    : M >= 1 ? 1 - SCALAR_EPS
                                                             : M);

      // In case the input is not part of the bucket
      if (B != bucket) {
        new_interval[0] = last_value;
        new_interval[1] = SCALAR_PREV(pt);
        last_value = pt;
      }
      // In case the input as a part of the bucket
      else {
        new_interval[0] = last_value;
        new_interval[1] = pt;
        last_value = SCALAR_NEXT(pt);
      }
    }

I think this code runs well when the function determined by the previous stage is continuous, which means the value of the variable "bucket" in the code is exactly the bucket index "B" calculated by the variable "last value". While, I wonder if the program still calculates the responsibility correctly when previous stage is in the following situation:

坐标轴 drawio (1)
We can see the function is no longer continuous because of the existence of different submodels. And at this time when we iterate "variable" pt to $t_3$, "bucket" is 3, "last_value" is $t_2$ and the submodel 3 in current stage will get responsiblility $[t_2,t_3)$. But the true responsiblility for the submodel should be $[x_0,t_3)$. Are there some points I missed in the code that can handle the situation like this or simply this kind of situation doesn't exist at all?
I will appreciate it if you answer this question!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant