Namespace: DotNumerics.Optimization.LBFGSBAssembly: DWSIM.MathOps.DotNumerics (in DWSIM.MathOps.DotNumerics.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax public void Run(
int N,
int M,
ref double[] X,
int offset_x,
double[] L,
int offset_l,
double[] U,
int offset_u,
int[] NBD,
int offset_nbd,
ref double F,
ref double[] G,
int offset_g,
double FACTR,
double PGTOL,
ref double[] WA,
int offset_wa,
ref int[] IWA,
int offset_iwa,
ref BFGSTask TASK,
int IPRINT,
ref BFGSTask CSAVE,
ref bool[] LSAVE,
int offset_lsave,
ref int[] ISAVE,
int offset_isave,
ref double[] DSAVE,
int offset_dsave
)
Public Sub Run (
N As Integer,
M As Integer,
ByRef X As Double(),
offset_x As Integer,
L As Double(),
offset_l As Integer,
U As Double(),
offset_u As Integer,
NBD As Integer(),
offset_nbd As Integer,
ByRef F As Double,
ByRef G As Double(),
offset_g As Integer,
FACTR As Double,
PGTOL As Double,
ByRef WA As Double(),
offset_wa As Integer,
ByRef IWA As Integer(),
offset_iwa As Integer,
ByRef TASK As BFGSTask,
IPRINT As Integer,
ByRef CSAVE As BFGSTask,
ByRef LSAVE As Boolean(),
offset_lsave As Integer,
ByRef ISAVE As Integer(),
offset_isave As Integer,
ByRef DSAVE As Double(),
offset_dsave As Integer
)
Request Example
View SourceParameters
- N Int32
-
is an integer variable.
On entry n is the dimension of the problem.
On exit n is unchanged.
- M Int32
-
is an integer variable.
On entry m is the maximum number of variable metric corrections
used to define the limited memory matrix.
On exit m is unchanged.
- X Double
-
is a double precision array of dimension n.
On entry x is an approximation to the solution.
On exit x is the current approximation.
- offset_x Int32
-
- L Double
-
is a double precision array of dimension n.
On entry l is the lower bound on x.
On exit l is unchanged.
- offset_l Int32
-
- U Double
-
is a double precision array of dimension n.
On entry u is the upper bound on x.
On exit u is unchanged.
- offset_u Int32
-
- NBD Int32
-
is an integer array of dimension n.
On entry nbd represents the type of bounds imposed on the
variables, and must be specified as follows:
nbd(i)=0 if x(i) is unbounded,
1 if x(i) has only a lower bound,
2 if x(i) has both lower and upper bounds, and
3 if x(i) has only an upper bound.
On exit nbd is unchanged.
- offset_nbd Int32
-
- F Double
-
is a double precision variable.
On first entry f is unspecified.
On final exit f is the value of the function at x.
- G Double
-
is a double precision array of dimension n.
On first entry g is unspecified.
On final exit g is the value of the gradient at x.
- offset_g Int32
-
- FACTR Double
-
is a double precision variable.
On entry factr .GE. 0 is specified by the user. The iteration
will stop when
(f^k - f^{k+1})/max{|f^k|,|f^{k+1}|,1} .LE. factr*epsmch
where epsmch is the machine precision, which is automatically
generated by the code. Typical values for factr: 1.d+12 for
low accuracy; 1.d+7 for moderate accuracy; 1.d+1 for extremely
high accuracy.
On exit factr is unchanged.
- PGTOL Double
-
is a double precision variable.
On entry pgtol .GE. 0 is specified by the user. The iteration
will stop when
max{|proj g_i | i = 1, ..., n} .LE. pgtol
where pg_i is the ith component of the projected gradient.
On exit pgtol is unchanged.
- WA Double
-
is a double precision working array of length
(2mmax + 4)nmax + 12mmax^2 + 12mmax.
- offset_wa Int32
-
- IWA Int32
-
is an integer working array of length 3nmax.
- offset_iwa Int32
-
- TASK BFGSTask
-
is a working string of characters of length 60 indicating
the current job when entering and quitting this subroutine.
- IPRINT Int32
-
is an integer variable that must be set by the user.
It controls the frequency and type of output generated:
iprint.LT.0 no output is generated;
iprint=0 print only one line at the last iteration;
0.LT.iprint.LT.99 print also f and |proj g| every iprint iterations;
iprint=99 print details of every iteration except n-vectors;
iprint=100 print also the changes of active set and final x;
iprint.GT.100 print details of every iteration including x and g;
When iprint .GT. 0, the file iterate.dat will be created to
summarize the iteration.
- CSAVE BFGSTask
-
is a working string of characters of length 60.
- LSAVE Boolean
-
is a logical working array of dimension 4.
On exit with 'task' = NEW_X, the following information is
available:
If lsave(1) = .true. then the initial X has been replaced by
its projection in the feasible set;
If lsave(2) = .true. then the problem is constrained;
If lsave(3) = .true. then each variable has upper and lower
bounds;
- offset_lsave Int32
-
- ISAVE Int32
-
is an integer working array of dimension 44.
On exit with 'task' = NEW_X, the following information is
available:
isave(22) = the total number of intervals explored in the
search of Cauchy points;
isave(26) = the total number of skipped BFGS updates before
the current iteration;
isave(30) = the number of current iteration;
isave(31) = the total number of BFGS updates prior the current
iteration;
isave(33) = the number of intervals explored in the search of
Cauchy point in the current iteration;
isave(34) = the total number of function and gradient
evaluations;
isave(36) = the number of function value or gradient
evaluations in the current iteration;
if isave(37) = 0 then the subspace argmin is within the box;
if isave(37) = 1 then the subspace argmin is beyond the box;
isave(38) = the number of free variables in the current
iteration;
isave(39) = the number of active constraints in the current
iteration;
n + 1 - isave(40) = the number of variables leaving the set of
active constraints in the current iteration;
isave(41) = the number of variables entering the set of active
constraints in the current iteration.
- offset_isave Int32
-
- DSAVE Double
-
is a double precision working array of dimension 29.
On exit with 'task' = NEW_X, the following information is
available:
dsave(1) = current 'theta' in the BFGS matrix;
dsave(2) = f(x) in the previous iteration;
dsave(3) = factr*epsmch;
dsave(4) = 2-norm of the line search direction vector;
dsave(5) = the machine precision epsmch generated by the code;
dsave(7) = the accumulated time spent on searching for
Cauchy points;
dsave(8) = the accumulated time spent on
subspace minimization;
dsave(9) = the accumulated time spent on line search;
dsave(11) = the slope of the line search function at
the current point of line search;
dsave(12) = the maximum relative step length imposed in
line search;
dsave(13) = the infinity norm of the projected gradient;
dsave(14) = the relative step length in the line search;
dsave(15) = the slope of the line search function at
the starting point of the line search;
dsave(16) = the square of the 2-norm of the line search
direction vector.
- offset_dsave Int32
-
See Also