什么是保护分区? (参考遗传编程和密码学)

发布于 2024-12-02 13:03:57 字数 100 浏览 1 评论 0原文

我在一篇关于遗传编程的论文中引用了“受保护的除法”操作。当我用谷歌搜索这个时,我得到的大部分是关于遗传编程的论文以及与密码学相关的各种结果,但没有一个能够解释它实际上是什么。有人知道吗?

I am getting references in a paper on genetic programming, to a "protected division" operation. When I google this, i get mostly papers on genetic programming and various results related to cryptography, but none that explain what it actually is. Does anybody know?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

那小子欠揍 2024-12-09 13:03:57

受保护的除法(通常用 % 表示)检查其第二个除法是否
参数为 0。如果是这样,% 通常返回值 1(无论
第一个参数的值)。

http://en.wikipedia.org/wiki/Genetic_programming

在密码学中似乎并没有定义明确,但谷歌最热门的是防止侧通道攻击(在这种情况下,通过电力使用 - 您可以通过查看进行加密的硬件的功耗来猜测该部门使用的数字) <一href="http://dl.acm.org/itation.cfm?id=1250996" rel="noreferrer">http://dl.acm.org/itation.cfm?id=1250996 http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.9.7298&rep=rep1&type=pdf

Protected division (often notated with %) checks to see if its second
argument is 0. If so, % typically returns the value 1 (regardless of
the value of the first argument).

http://en.wikipedia.org/wiki/Genetic_programming

In cryptography it doesn't seem to be well-defined, but the top google hit is for protecting against side channel attacks (in that case, via power use - you can guess what numbers are being used in the division by looking at the power consumption of the hardware doing the encryption) http://dl.acm.org/citation.cfm?id=1250996 http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.9.7298&rep=rep1&type=pdf

日久见人心 2024-12-09 13:03:57

在 GP 中,受保护除法是一种改进的除法运算符,当分母为 0(零)时,它不会发出“除零”错误信号。当分母为零时,它通常返回 1。

In GP protected division is a modified division operator which does not signal "division by zero" error when denominator is 0 (zero). It typically returns 1 when denominator is zero.

盗琴音 2024-12-09 13:03:57

它按参数的阈值函数而不是参数进行划分。

Thres(x) = epsilon*Theta(x) if fabs(x)<epsilon.

其中 Theta() 是 theta 函数的非零变体。

其他可能的阈值函数。或者有时它只是“epsilon”。

It divides on threshold function of argument instead of argument.

Thres(x) = epsilon*Theta(x) if fabs(x)<epsilon.

Where Theta() is non-zero variant of theta-function.

Other threshold functions possible. Or sometimes it is just 'epsilon'.

别念他 2024-12-09 13:03:57

当使用遗传编程(GP)进化程序时,每个生成的程序都会经过测试以获得其适应度值。
当进化的程序是数学表达式时,需要保护除法。在密码学中,数学表达式可用于对决策过程进行建模。
在评估步骤中,程序可能会执行除以零的操作,这会导致崩溃。为了避免这种情况,受保护的除法被设置为在分母等于零时返回特定值。我见过三种设置:

  • 如果分母等于 0,则返回 1
  • 如果分母等于 0,则返回 0
  • 如果分母等于 0,则返回分子

该设置应在论文中的某处指定。
如果不是,最安全的选择是假设受保护的除法返回分子。
鉴于 1 是乘法中性,0 是加法中性,它们可能会导致进化过程中生成的程序出现一些偏差,但仍然常用。

When evolving programs with Genetic Programming (GP), every generated program is tested to get its fitness value.
The protected division is required when the evolved programs are mathematical expressions. In cryptography, the mathematical expression might be used to model a decision-making process.
In the evaluation step, the program may perform a division by zero, which would cause a crash. To avoid this, the protected division is set to return a specific value if the denominator equals zero. I've seen three settings:

  • If the denominator equals zero, return 1
  • If the denominator equals zero, return 0
  • If the denominator equals zero, return the numerator

The setting should be specified somewhere in the paper.
If not, the safest bet is to assume that the protected division returns the numerator.
Given that 1 is a multiplicative neutral and 0 is an additive neutral, they could cause some bias in the programs generated during the evolution but are still commonly used.

揽清风入怀 2024-12-09 13:03:57

上面的答案很好,但我的建议是避免受保护的分裂,因为结果是不可预测的。

相反,如果您除以零(或任何其他异常),请将该运算符修改(变异)为另一个不会生成异常的运算符。

我确实将这个策略实施到 多表达式编程< /a>.

这是与此案例相关的代码片段:

void compute_eval_matrix(const t_mep_chromosome &c, int code_length, int num_variables,
int num_training_data,  const double **training_data, 
double **eval_matrix)
{
for (int i = 0; i < code_length; i++){   // read the chromosome from top to down
    bool is_error_case = false;// division by zero, other errors
    switch (c.code[i].op) {

    case  DIV_OP:  //  handle division
        for (int k = 0; k < num_training_data; k++)
            if (fabs(eval_matrix[c.code[i].addr2][k]) < 1e-6) // test if it is too small
                is_error_case = true;
        if (is_error_case) {                                           // an division by zero error occured !!!
            c.code[i].op = rand() % num_variables;   // the gene is mutated into a terminal
            for (int k = 0; k < num_training_data; k++)
                eval_matrix[i][k] = training_data[k][c.code[i].op];
        }
        else    // normal execution....
            for (int k = 0; k < num_training_data; k++)
                eval_matrix[i][k] = eval_matrix[c.code[i].addr1][k] / eval_matrix[c.code[i].addr2][k];
        break;
    default:  // a variable
        break;
    } // end switch
} // end for
}

The above answers are good, but my advice is to avoid protected division because the results are unpredictable.

Rather, if you get division by zero (or any other exception) do modify (mutate) that operator into another one which does not generate an exception.

I did implemented this strategy into Multi Expression Programming.

Here is a code snippet relevant to this case:

void compute_eval_matrix(const t_mep_chromosome &c, int code_length, int num_variables,
int num_training_data,  const double **training_data, 
double **eval_matrix)
{
for (int i = 0; i < code_length; i++){   // read the chromosome from top to down
    bool is_error_case = false;// division by zero, other errors
    switch (c.code[i].op) {

    case  DIV_OP:  //  handle division
        for (int k = 0; k < num_training_data; k++)
            if (fabs(eval_matrix[c.code[i].addr2][k]) < 1e-6) // test if it is too small
                is_error_case = true;
        if (is_error_case) {                                           // an division by zero error occured !!!
            c.code[i].op = rand() % num_variables;   // the gene is mutated into a terminal
            for (int k = 0; k < num_training_data; k++)
                eval_matrix[i][k] = training_data[k][c.code[i].op];
        }
        else    // normal execution....
            for (int k = 0; k < num_training_data; k++)
                eval_matrix[i][k] = eval_matrix[c.code[i].addr1][k] / eval_matrix[c.code[i].addr2][k];
        break;
    default:  // a variable
        break;
    } // end switch
} // end for
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文