Name

conmin_optim — Interface to the CONMIN optimization function

Calling Sequence

[x_opt,f_opt,df_opt,g_opt,dg_opt,ic_res] = conmin_optim(x0,conmin_optim_f,conmin_optim_g,ncon,...
                                                        upper,lower,ItMX,Params)

Parameters

Input parameters

x0

initial value of the parameter vector.

conmin_optim_f

objective function to be minimized. The prototype is:

 
function [f,df] = conmin_optim_f(x)
 
conmin_optim_g

the constraints of the problem. The prototype is:

 
[g,dg,ic] = conmin_optim_g(x,ct)
 

where:

  • g is a vector which handles all the values of the constraints

  • dg is a matrix which handles only the gradient of the active constraints (the one for which y(ic)>ct)

and:

  • ic is the vector of index of the active constraints

  • ct is the activity threshold

ncon

the number of constraints.

upper

The vector of upper bounds. Must be the same size as x0.

lower

The vector of lower bounds. Must be the same size as x0.

ItMX

The maximum number of iterations.

Params

a list of parameters set up via the parameters package.

'nacmx' (default ncon+nside+1)

Not used if NSIDE = NCON = 0. 1 plus user's best estimate of the maximum number of constraints (including side constraints, upper(I) and lower(I)) which will be active at any given time in the minimization process.

NACMX1 = number of rows in array A. If NAC + 1 ever exceeds this value, the minimization process will be terminated, an error message will be printed, and control will return to the main program.

NACMX1 will never exceed NDV + 1 if all constraints G(J) and bounds upper(I) and lower(I) are independent.

A reasonable value for NACMX1 (and the corresponding dimension of array A) is MIN(40, NDV + 1), where the minimum of 40 will only apply for large problems and is arbitrary, based on the observation that even for very large problems (over a hundred x0(I) and several thousand G(J)), it is uncommon for many constraints to be active at any time in the minimization process (the optimum solution is seldom "fully constrained" for very large nonlinear problems).

'isc' (default value zeros(size(x0,1),size(x0,2)))

Not used if NCON = 0.

Linear constraint identification vector. If constraint G(J) is known to be a linear function of the decision variables, x0(I), ISC(I) should be initialized to ISC(I) = 1.

If constraint G(J) is nonlinear ISC(I) is initialized to ISC(I) = 0.

Identification of linear constraints may improve efficiency of the optimization process and is therefore desirable, but is not essential.

If G(J) is not specifically known to be linear, set ISC(I) = 0.

'scal' (default value ones(size(x0,1),size(x0,2)))

Not used if NSCAL = 0.

Vector of scaling parameters. If NSCAL>0 vector SCAL need not be initialized since SCAL will be defined in CONMIN and its associated routines.

If NSCAL<0, vector SCAL is initialized in the main program, and the scaled variables X(I) = X(I)/SCAL(I).

Efficiency of the optimization process can sometimes be improved if the variables are either normalized or are scaled in such a way that the partial derivative of the objective function, OBJ, with respect to variable X(I) is of the same order of magnitude for all X(I).

SCAL(I) must be greater than zero because a negative value of SCAL(I) will result in a change of sign of X(I) and possibly yield erroneous optimization results.

The decision of if, and how, the variables should be scaled is highly problem dependent, and some experimentation is desirable for any given class of problems.

'nscal' (default value 0)

Scaling control parameter.

The decision variables will be scaled linearly.

  • NSCAL < 0: Scale variables X(I) by dividing by SCAL(I), where vector SCAL is defined by the user.

  • NSCAL = 0: Do not scale the variables.

  • NSCAL > 0: Scale the variables every NSCAL iterations.

Variables are normalized so that scaled X(I) = X(I)/ABS(X(I)).

When using this option, it is desirable that NSCAL = ICNDIR if ICNDIR is input as nonzero, and NSCAL = NDV + 1 in ICNDIR is input as zero.

'nfdg' (default value 0)

  • 0: all gradient information is calculated by finite difference within CONMIN.

  • 1: all gradient information is supplied by the user.

  • 2: the gradient of OBJ is supplied by the user and the gradients of constraints are calculated by finite difference within CONMIN.

'icndir' (default value length(x0)+1)

Conjugate direction restart parameter.

If the function is currently unconstrained, (all G(J) < CT or NCON = NSIDE = 0), Fletcher-Reeves conjugate direction method will be restarted with a steepest descent direction every ICNDIR iterations.

If ICNDIR = 1 only steepest descent will be used.

'fdch' (default value 0.01)

Not used if NFDG = 0.

Relative change in decision variable X(I) in calculating finite difference gradients.

For example, FDCH = 0.01 corresponds to a finite difference step of one percent of the value of the decision variable.

'fdchm' (default value 0.01)

Not used if NFDG = 0.

Minimum absolute step in finite difference gradient calculations.

FDCHM applies to the unscaled variable values.

'ct' (default value -0.1)

Not used if NCON = NSIDE = 0.

Constraint thickness parameter.

If CT <=G(J)<=ABS(CT), G(J) is defined as active. If G(J)>ABS(CT), G(J) is said to be violated.

If G(J)<CT, G(J) is not active. CT is sequentially reduced in magnitude during the optimization process.

If ABS(CT) is very small, one or more constraints may be active on one iteration and inactive on the next, only to become active again on a subsequent iteration.

This is often referred to as "zigzagging" between constraints.

A wide initial value of the constraint thickness is desirable for highly nonlinear problems so that when a constraint becomes active it tends to remain active, thus reducing the zigzagging problem.

The default value is usually adequate.

'ctmin' (default value 0.004)

Not used if NCON = NSIDE = 0.

Minimum absolute value of CT considered in the optimization process.

CTMIN may be considered as "numerical zero" since it may not be meaningful to compare numbers smaller than CTMIN.

The value of CTMIN is chosen to indicate that satisfaction of a constraint within this tolerance is acceptable.

The default value is usually adequate.

'ctl' (default value -0.01)

Not used if NCON = NSIDE = 0.

Constraint thickness parameter for linear and side constraints.

CTL is smaller in magnitude than CT because the zigzagging problem is avoided with linear and side constraints.

The default value is usually adequate.

'ctlmin' (default value 0.001)

Not used if NCON = NSIDE = 0.

Minimum absolute value of CTL considered in the optimization process.

The default value is usually adequate.

'theta' (default value 1.0)

Not used if NCON = NSIDE = 0.

Mean value of the push-off factor in the method of feasible directions.

A larger value of THETA is desirable if the constraints, G(J), are known to be highly nonlinear, and a smaller value may be used if all G(J) are known to be nearly linear.

The actual value of the push-off factor used in the program is a quadratic function of each G(J), varying from 0.0 for G(J) = CT to 4.0*THETA for G(J) = ABS(CT).

A value of THETA = 0.0 is used in the program for constraints which are identified by the user to be strictly linear.

THETA is called a "push-off" factor because it pushes the design away from the active constraints into the feasible region.

The default value is usually adequate.

'delfun' (default value 0.001)

Minimum relative change in the objective function to indicate convergence.

If in ITRM consecutive iterations, ABS(1.0-OBJ(J-1)/OBJ(J))<DELFUN and the current design is feasible (all G(J)<=ABS(CT)), the minimization process is terminated.

If the current design is infeasible (some G(J)>ABS(CT)), five iterations are required to terminate and this situation indicates that a feasible design may not exist.

'dabfun' (default value 0.001 times the initial function value)

Same as DELFUN except comparison is on absolute change in the objective function, ABS(OBJ(J)-OBJ(J-1)), instead of relative change.

'linobj' (default value 0)

Linear objective function identifier.

If the objective, OBJ, is specifically known to be a strictly linear function of the decision variables, X(I), set LINOBJ = 1.

If OBJ is a general nonlinear function, set LINOBJ = 0.

'itrm' (default value 3)

Number of consecutive iterations to indicate convergence by relative or absolute changes, DELFUN or DABFUN.

'alphax' (default value 0.1)

alphax is the maximum fractional change in any component of X as an initial estimate for ALPHA in the one-dimensional search.

That is, the initial ALPHA will be such that no component of X is changed by more than this amount. This only applies to those X(i) of magnitude greater than 0.1.

If an optimization run shows numerous ALPHA = 0 results for the one-dimensional search, it may help to try ALPHAX less than the default.

ALPHAX is changed by CONMIN depending on the progress of the optimization.

'abobj1' (default value 0.1)

abobj1 is the fractional change attempted as a first step in the one-dimensional search and is based on a linear approximation.

ABOBJ1 is updated during the optimization, depending on progress.

The initial step in the one-dimensional search is taken as the amount necessary to change OBJ by ABOBJ1*ABS(OBJ) or to change some X(i) by ALPHAX*ABS( X(i) ), whichever is less.

'infog' (default value 0)

  • 0: INFOG is not used.

  • 1: only those constraints identified as active or violated in array IC(I), I = 1, NAC need be evaluated.

This is only meaningful if finite difference gradients are calculated, and allows the user to avoid calculating non-essential information.

If it is convenient to evaluate all constraints each time, variable INFOG may be ignored.

'info' (default value 1)

  • 1: Calculate objective function value, OBJ, for current variables X.

  • 2: Calculate objective function value, OBJ, and constraint values, G(J), J = 1, NCON for current variables, X.

  • 3: Calculate analytic gradient of objective function corresponding to current variables, X. The objective function and constraint values already correspond to the current values of X and need not be recalculated. However, other information obtained in SUB1 when calculating OBJ and G(J) may not correspond to X and must be calculated again here if it is used in gradient computations. If finite difference control parameter, NFDG, is set to NFDG = 1 in the main program this value of INFO will never be considered.

  • 4: For current variables, X, determine which constraints are active and which are violated (G(J).GE.CT) and how many such constraints there are (NAC = Number of active and violated constraints). Calculate the analytic gradients of the objective function and all active or violated constraints. Values of the objective function, OBJ, and constraints, G(J), already correspond to the current variables, X, and need not be recalculated. As in the case of INFO = 3, all other information used in gradient computations must be calculated for the current variables, X. If finite difference control parameter NFDG, defined in the main program, is not zero, this value of INFO will never be considered.

'iprint' (default value 0)

Print control.

All printing is done on unit number 6 (the console - not the scilab console).

  • 0: Print nothing.

  • 1: Print initial and final function information.

  • 2: 1st debug level. Print all of above plus control parameters. Print function value and X-vector at each iteration.

  • 3: 2nd. debug level. Print all of above plus all constraint values, numbers of active or violated constraints, direction vectors, move parameters and miscellaneous information. The constraint parameter, BETA, printed under this option approaches zero as the optimum objective is achieved.

  • 4: Complete debug. Print all of above plus gradients of objective function, active or violated constraint functions and miscellaneous information.

Output parameters

x_opt

the optimal value.

f_opt

the value of the objective function for x_opt (optional parameter).

df_opt

the gradient of the objective function for the x_opt (optional parameter).

g_opt

the value of the constraints for x_opt (optional parameter).

dg_opt

the value of the gradient of the active constraints (optional parameter).

ic_res

the index of the active constraints (optional parameter).

Description

CONMIN is a FORTRAN program, in subroutine form, for the solution of linear or nonlinear constrained optimization problems.

The basic optimization algorithm is the Method of Feasible Directions.

The user must provide an objective function and a constraints function and to provide gradient information. If analytic gradients of the objective or constraint functions are not available, this information is calculated by finite difference.

While the program is intended primarily for efficient solution of constrained problems, unconstrained function minimization problems may also be solved, and the conjugate direction method of Fletcher and Reeves is used for this purpose.

Sample problems are included to help the user become familiar with CONMIN and to make the program operational.

Example

 
// Constr pb from example 1
// The objective function and its gradient
deff('y=f(x)','y=x(1)^2 - 5*x(1) + x(2)^2 - 5*x(2) + 2*x(3)^2 - 21*x(3) + x(4)^2 + 7*x(4) + 50');
deff('y=df(x)','y(1) = 2*x(1) - 5; ...
                y(2) = 2*x(2) - 5; ...
                y(3) = 4*x(3) - 21; ...
                y(4) = 2*x(4) + 7;');

// We gather objective function and gradient into a unique function
deff('[y,dy] = fobj(x)','y = f(x); dy = df(x);');

// The constraints and its Jacobian
deff('[y,dy,ic]=ineqconstraint(x,ct)','Index = 1; ...
                                       y   = 0; ...
                                       dy  = 0; ...
                                       ic  = []; ...
                                       y(1) = x(1)^2 + x(1) + x(2)^2 - x(2) + x(3)^2 + x(3) + x(4)^2 - x(4) - 8; ...
                                       if y(1)>ct then ...
                                         dy(1,Index) = 2*x(1) + 1; ...
                                         dy(2,Index) = 2*x(2) - 1; ...
                                         dy(3,Index) = 2*x(3) + 1; ...
                                         dy(4,Index) = 2*x(4) - 1; ...
                                         ic(Index) = 1; ...
                                         Index = Index + 1; ...
                                       end ...
                                       y(2) = x(1)^2 - x(1) + 2*x(2)^2 + x(3)^2 + 2*x(4)^2 - x(4) - 10.0; ...
                                       if y(2)>ct then ...
                                         dy(1,Index) = 2*x(1) - 1; ...
                                         dy(2,Index) = 4*x(2); ...
                                         dy(3,Index) = 2*x(3); ...
                                         dy(4,Index) = 4*x(4) - 1; ...
                                         ic(Index) = 2; ...
                                         Index = Index + 1; ...
                                       end ...
                                       y(3) = 2*x(1)^2 + 2*x(1) + x(2)^2 - x(2) + x(3)^2 - x(4) - 5.0; ...
                                       if y(3)>ct then ...
                                         dy(1,Index) = 4*x(1) + 2; ...
                                         dy(2,Index) = 2*x(2) - 1; ...
                                         dy(3,Index) = 2*x(3); ...
                                         dy(4,Index) = -1; ...
                                         ic(Index) = 3; ...
                                       end;');                                     

// The starting point
x0   = ones(4,1);
ncon = 3;
upper = 99999*ones(4,1);
lower = -99999*ones(4,1);
ItMX  = 40;

clear param;
param = init_param();

param = add_param(param,'iprint',2);
param = add_param(param,'nfdg',1); // Jacobian is user defined
//param = add_param(param,'nfdg',0); // Jacobian is computed by finite differences

[x_opt,f_opt] = conmin_optim(x0,fobj,ineqconstraint,ncon,param);

printf('Initial values\n');
printf('Value of the starting solution: ');
disp(x0');
printf('Value of the objective function: %f\n',f(x0));
printf('Value of the constraints:');
disp(ineqconstraint(x0,0)');

printf('Final values\n');
printf('Value of the optimal solution: ');
disp(x_opt');
printf('Value of the objective function: %f\n',f(x_opt));
printf('Value of the constraints:');
disp(ineqconstraint(x_opt,0)');
 

Authors

Yann COLLETTE

(ycollet@freesurf.fr)