-
Notifications
You must be signed in to change notification settings - Fork 5
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
Scaling of variables #4
Comments
or the scaling could be done in the C layer to benefit python also |
If done in the C layer, you'll have to wrap the original functions, the objective |
Hi @emmt , Thank you very much for proposing this. Apologies for my slow response. Works have been complicated on my side and the situation will continue for a while. First of all, it is for sure that the Fortran code will never implement the scaling. This is due to the limitation of the language. It is doable but too complicated. Implementing it will complicate the code significantly, contradicting the idea of providing a reference implementation that is readable, understandable, and extendable. Scaling is important, but it should be done in the high-level interfaces, taking advantage of the capability of the languages. The most important ability would be lambda function/closure/anonymous function; otherwise, the code would have to carry the scaling factors explicitly (e.g., using Another important fact is that deciding good scaling is a nontrivial (but important) problem. The best scaling is only known to MATLAB guesses the scaling according to an optional input called The problem of BTW, the language is Fortran rather than FORTRAN since the 90s. PRIMA does not contain any FORTRAN code; in contrast, Powell's code is FORTRAN. Nobody should code FORTRAN in any new project. Thanks. |
Hi @zaikunzhang,
Thanks for pointing this, I'll try to be careful about the spelling ;-)
This issue was to figure out all consequences of the scaling of the variables. In particular, scaling cannot be simply done by using closures (or equivalent) for the objective function and non-linear constraints, it must be handled for the linear constraints as well. I agree that all this management should be done by the high level interface not by the user who may, at most, specify the scaling factors (as we discussed elsewhere).
I understand that, this is unfortunate but it is a minor issue. The higher level interface could always bypass that and, at least on entry and on return of the algorithm, prints the correct (unscaled) variables. |
Scaling of variables has been implemented by commit 07b17f6 |
Context
All Powell's algorithms were orinally written to solve of problem of the form:
where
f: Ω → ℝ
is the function to minimize,Ω ⊆ ℝⁿ
is the set of feasible variables, andn ≥ 1
is the number of variables. The most general feasible set is:where
xl ∈ ℝⁿ
andxu ∈ ℝⁿ
are lower and upper bounds,Aₑ
andbₑ
implement linear equality constraints,Aᵢ
andbᵢ
implement linear inequality constraints, andc: ℝⁿ → ℝᵐ
implementsm
non-linear constraints.Proposition
We consider here means to scale the variables
x
of the problem so that (i) the numerical optimization algorithms are more robust in that respect and (ii) the radius of the trust region accounts for the scaling of the variables. Scaling of the variables must be as transparent as possible for the end-users (apart for specifying the scaling). Hence, we want that the end-users deal with the variablesx
, while the algorithms deal with scaled variablesu
such thatx = S⋅u
whereS
is a diagonal invertible scaling matrix. Typically, each diagonal entry ofS
is set with the magnitude of the corresponding variablex
. For simplicity to implement bound constraints (see below), we assume that all diagonal entries ofS
are positive. Then:The initial solution writes
x0 = S⋅u0
. Thus the algorithms are initialized withu0 = S\x0
(the elementwise division of the parameters by the scaling factors).For the objective function and the non-linear constraints
f(x) = f(S⋅u)
andc(x) = c(S⋅u)
. Hencef
andc
must be respectively replaced by the compositionsf∘s
andc∘s
wheres(u) = S⋅u
.For the linear constraints
Aₑ⋅x = bₑ
andAᵢ⋅x ≤ bᵢ
which are directly handled by the algorithms, they must be replaced byAₑ⋅S⋅u = bₑ
andAᵢ⋅S⋅u ≤ bᵢ
. Hence ``Aₑand
Aᵢ` set by the end-user must be replaced by `Aₑ⋅S` and `Aᵢ⋅S` in the algorithm.Since
S
is diagonal with positive diagonal entries, the bound constraintsxl ≤ x = S⋅u ≤ xu
becomeS\xl ≤ u ≤ S\xu
. Hence the lower and upper bounds must be replaced byS\xl
andS\xu
respectively.The only remaining issue not handled by this proposition is the printing of the variables when
iprint
says to do that.The text was updated successfully, but these errors were encountered: