EpetraExt Package Browser (Single Doxygen Collection) Development
|
These scaling functions implement scaling of input variables and output functions and their derivatives.
These scaling functions implement scaling of input variables and output functions and their derivatives.
The scaling vectors are stored in EpetraExt::ModelEvaluator::InArgs
and EpetraExt::ModelEvaluator::OutArgs
objects in order to enhance maintainability and to avoid programming errors. This will result in some wasted space but it should not be excessive if used carefully.
First, consider scaling of the state function. Reguardless of how the state function scaling is computed, it will be represented as a positive vector s_f
that defines a diagonal matrix S_f = diag(s_f)
that transforms the state function:
f(...) = S_f * f_hat(...)
where f_hat(...)
is the original unscaled state function as computed by the underlying EpetraExt::ModelEvaluator
object and f(...)
is the scaled state function.
Next, consider the scaling of the state varaibles. The scaling for the state variables is defined by a positive vector s_x>/tt> defines a diagonal scaling matrix
S_x = diag(s_x)
that transforms the variables as:
x = S_x * x_hat
where
x_hat
is the original unscaled state variable vector as defined by the underlying EpetraExt::ModelEvaluator
object and x
is the scaled state varaible vector. Note that when the scaled variables x
are passed into evalModel
that they must be unscaled as:
x_hat = inv(S_x) * x
where
inv(S_x)
is the inverse of the diagonals of S_x
which is stored as a positive vector inv_s_x
. Since unscaling the variables as shown above is more common than scaling the original variables, the scaling vector will be stored as inv_s_x
and not as s_x
.
Note how these scalings affect the state function:
f( x_dot, x, ... ) = S_f * f_hat( inv(S_x)*x_dot, inv(S_x)*x, ... )
which has the state/state Jacobian:
W = alpha * d(f)/d(x_dot) + beta * d(f)/d(x) = S_f * ( alpha * d(f_hat)/d(x_hat) + beta * d(f_hat)/d(x) ) * inv(S_x)
Currently, these functions do not handle scalings of the parameters
p(l)
or of the auxilary response functions g(j)(...)
.
The state varaible and state function scaling gives the following scaled quantities:
f = S_f * f_hat W = S_f * W_hat * inv(S_x) DfDp(l) = S_f * DfDp_hat(l), for l=0...Np-1 g(j) = g_hat(j), for j=0...Ng-1 DgDx_dot(j) = DgDx_dot_hat(j) * inv(S_x), for j=0...Ng-1 DgDx(j) = DgDx_hat(j) * inv(S_x), for j=0...Ng-1 DgDp(j,l) = DgDp_hat(j,l), for j=0...Ng-1, l=0...Np-1
ToDo: Describe how scaling of the state function
S_f
affects the Hessian-vector products an how you just need to scale the Lagrange mutipliers as:
u^T * f(...) = u^T * (S_f * f_hat(...)) = u_f^T * f_hat(...)
where
u_f = S_f * u
.
ToDo: Also describe how scaling of the state varaibles
S_x
affects Hessian-vector products and other related quantities.
These scaling tools must be updated whenever the
InArgs
or OutArgs
classes are augmented. However, not every use case with the model evaluator requires scaling so scaling with respect to some inputs and some outputs may never be needed and therefore never need to be seen by these tools. However, there is some danger in ignoring inputs and outputs in these scaling tools since some objects may be silently unscaled and could cause hard to track down bugs.
ToDo: Finish documentation!