CONOPT
Loading...
Searching...
No Matches

Detailed Description

Zero01. Test model for constraints with coefficient that are identically Zero.

This is a CONOPT implementation of the GAMS model:

!! Set i Rows / 1*m/
!! Set j cols / 1*n/
!! parameter a(i,j); a(i,j) = 1$(uniform(0,1)>0.5);
!! variable x(j), obj
!! positive variable x(j);
!! equation e(i), objdef;
!! e(i) .. sum(j,a(i,j)*x(j)) =L= 1;
!! objdef .. obj =E= sum(j,x(j));
!! model m / all / 
 solve m using nlp maximizing obj;
!! 

All coefficients are added independent of whether they are zero or not.

For more information about the individual callbacks, please have a look at the source code.

Definition in file zero01.f90.

Functions/Subroutines

program zero01
 Main program. A simple setup and call of CONOPT.
 
real function rndx ()
 
integer function zero_readmatrix (lower, curr, upper, vsta, type, rhs, esta, colsta, rowno, value, nlflag, n, m, nz, usrmem)
 Define information about the model.
 

Variables

integer, parameter zero::nrow = 5
 
integer, parameter zero::ncol = 6
 

Function/Subroutine Documentation

◆ zero01()

program zero01

Main program. A simple setup and call of CONOPT.

Definition at line 32 of file zero01.f90.

◆ rndx()

real function rndx

Definition at line 126 of file zero01.f90.

◆ zero_readmatrix()

integer function zero_readmatrix ( real*8, dimension(n), intent(inout) lower,
real*8, dimension(n), intent(inout) curr,
real*8, dimension(n), intent(inout) upper,
integer, dimension(n), intent(inout) vsta,
integer, dimension(m), intent(out) type,
real*8, dimension(m), intent(inout) rhs,
integer, dimension(m), intent(inout) esta,
integer, dimension(n+1), intent(inout) colsta,
integer, dimension(nz), intent(out) rowno,
real*8, dimension(nz), intent(inout) value,
integer, dimension(nz), intent(inout) nlflag,
integer, intent(in) n,
integer, intent(in) m,
integer, intent(in) nz,
real*8, dimension(*) usrmem )

Define information about the model.

where:

  • LOWER: Vector of lower bounds on the variables. CONOPT will fill the vector with a special internal value that represent minus infinity or no lower bound before issuing the callback.
  • CURR: Vector of initial values of the variables. CONOPT will fill the vector with the default initial value of zero before issuing the callback.
  • UPPER: Vector of upper bounds on the variables. CONOPT will fill the vector with a special internal value that represent plus infinity or no upper bound before issuing the callback.
  • VSTA: Vector of initial status values for the variable. VSTA is only used if coidef_inistat() was called with IniStat = 1 or 2.

    If IniStat = 1 the value of VSTA must be defined as:

    • 0: The variable is initialized non-basic (if CURR = LOWER or CURR = UPPER) or super-basic, and
    • 1: The variable is initialized basic

    and if IniStat = 2 the value of VSTA must be defined as:

    • 0: The variable is initialized at lower bound
    • 1: The variable is initialized at upper bound
    • 2: The variable is initialized basic, and
    • 3: The variable is initialized superbasic.

    IniStat = 1 is simple to implement by hand, while IniStat = 2 is consistent with the output status defined in the Solution callback method. Note that if the numerical value in CURR are inconsistent with the status value, the numerical values will be used.

    If IniStat = 0 (the default value) CONOPT will not use VSTA and you do not have to define it.


  • TYPE: Vector of equation types. The values of TYPE have the following meaning:

    • 0: An equality constraint.
    • 1: A greater than or equal constraint.
    • 2: A less than or equal constraint.
    • 3: A free row.

    There is no default value for TYPE so it must be defined for all constraints. Note that CONOPT does not accept ranges.


  • RHS: Vector of right hand sides values. The default value is zero.
  • ESTA: Vector of initial status values for the slacks in the constraints. ESTA is only used if coidef_inistat() was called with IniStat = 1 or 2.

    If IniStat = 1 the value of ESTA must be defined as:

    • 0: The slack is initialized non-basic (if the constraint is binding in the initial point) or super-basic, and
    • 1: The slack is initialized basic

    and if IniStat = 2 the value of ESTA must be defined as:

    • 0: The slack is initialized at lower bound.
    • 1: The slack is initialized at upper bound.
    • 2: The slack is initialized basic, and
    • 3: The slack is initialized superbasic.

    Again, IniStat = 1 is simple to implement by hand, while IniStat = 2 is consistent with the output status defined in Solution callback method.

    If IniStat = 0 (the default value) then CONOPT will not use ESTA.

  • COLSTA: Vector of start of column pointers. All non-zero Jacobian elements must be sorted by column, i.e. all elements in column i comes before all elements in column i+1. COLSTA points to the first element in each column. If you have selected Base = 1 (Fortran conventions) then COLSTA must therefore satisfy: COLSTA(1) = 1 and COLSTA(N+1) = NZ+1. If you have selected Base = 0 (C conventions) then COLSTA must therefore satisfy: COLSTA[0] = 0 and COLSTA[N] = NZ. COLSTA must in both cases be increasing.
  • ROWNO: Vector of row or equation numbers of the non-zeros. The numbers must be in the range 1 through M inclusive if you have defined Base = 1 (Fortran conventions) and in the range 0 to M-1 inclusive if you have defined Base = 0 (C conventions). Although the columns are sorted, the rows do not have to be sorted within each column.
  • VALUE: Vector of values of the Jacobian elements. VALUE must be defined for all constant Jacobian elements, i.e. elements for which the following NLFLAG = 0. VALUE does not have to be defined for varying Jacobian elements.
  • NLFLAG: Vector of nonlinearity flags:

    • 0: The non-zero is constant, i.e. the variable appears linearly.
    • 1: The non-zero is varying, i.e. the variable appears nonlinearly

    NLFLAG is not read if the model is linear, i.e. if NLNZ = 0, otherwise it must be defined. Note that if you have an LP model, you should probably select a specialized LP algorithm instead of CONOPT.

  • N: Number of variables as defined in coidef_numvar().
  • M: Number of constraints as defined in coidef_numcon().
  • NZ: Number of Jacobian elements as defined in coidef_numnz().
  • USRMEM: User memory as defined in coidef_usrmem() (Only for Fortran and C API).

The lower bounds in LOWER must be less than or equal to the upper bounds in UPPER. Some of the bounds may be -INF or +INF, which are the bounds CONOPT assigns by default. If a bound is infinite, the user should normally not change the corresponding entry in LOWER or UPPER. If it is more convenient for the modeler to assign a value representing infinity it should be done using the values that are present in LOWER and UPPER when ReadMatrix is called, for example taken from the first element before any assignments are done. As an alternative, you may define the numerical value of Infinity to be used by the solution algorithm in option RTMAXV and store the same value in UPPER and -RTMAXV in LOWER.

The values in CURR, both those defined by the modeler and those defined by default, are without warning moved to the nearest bound if they are outside the bounds.

Note
CONOPT assumes that all functions are defined for all values of the variables between their bounds. CONOPT will never attempt to evaluate the functions in points outside the bounds specified by LOWER and UPPER.

Definition at line 146 of file zero01.f90.