Change finite-support mju_sigmoid from a two-quadratic construction to a single quintic with zero 1st and 2nd derivatives at 0 and 1, the boundary of the smooth-support segment.
Note: this function is currently unused in the MuJoCo codebase. PiperOrigin-RevId: 529969804 Change-Id: I2bddc72916eff67625b806510935bc7f3ce5c770
This commit is contained in:
committed by
Copybara-Service
parent
26ff1fc4b5
commit
49efa9cc15
@@ -1156,7 +1156,7 @@ char* mju_strncpy(char *dst, const char *src, int n) {
|
||||
|
||||
|
||||
|
||||
// Sigmoid function over 0<=x<=1 constructed from half-quadratics.
|
||||
// sigmoid function over 0<=x<=1 using quintic polynomial
|
||||
mjtNum mju_sigmoid(mjtNum x) {
|
||||
// fast return
|
||||
if (x<=0) {
|
||||
@@ -1165,15 +1165,8 @@ mjtNum mju_sigmoid(mjtNum x) {
|
||||
if (x>=1) {
|
||||
return 1;
|
||||
}
|
||||
if (x==0.5) {
|
||||
return 0.5;
|
||||
}
|
||||
|
||||
// lower part
|
||||
if (x<0.5) {
|
||||
return 2*x*x;
|
||||
}
|
||||
|
||||
// higher part
|
||||
return (1 - 2*(1-x)*(1-x));
|
||||
// sigmoid: f(x) = 6*x^5 - 15*x^4 + 10*x^3
|
||||
// solution of f(0) = f'(0) = f''(0) = 0, f(1) = 1, f'(1) = f''(1) = 0
|
||||
return x*x*x * (3*x * (2*x - 5) + 10);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user