CONOPT
|
Tests EQ2 constraints that are made post-triangular by transfer of bounds.
\begin{eqnarray*} \min 7&x1&+8&x2&+100&x3&+100&x4& \\ &x1& && +&x3& && = 1.0 \\ &&&x2& && +&x4& = 1.5 \\ &x1&+ &x2& &&&& < 2.0 \\ &x1&, &x2&, &x3&, &x4& \geq 0 \end{eqnarray*}
For more information about the individual callbacks, please have a look at the source code.
Definition in file eq2a.f90.
Functions/Subroutines | |
program | eq2a |
Main program. A simple setup and call of CONOPT. | |
integer function | eq2a_readmatrix (lower, curr, upper, vsta, type, rhs, esta, colsta, rowno, value, nlflag, n, m, nz, usrmem) |
Define information about the model. | |
program eq2a |
integer function eq2a_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:
CURR = LOWER
or CURR = UPPER
) or super-basic, andand if IniStat = 2
the value of VSTA
must be defined as:
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:
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:
and if IniStat = 2
the value of ESTA
must be defined as:
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:
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.
LOWER
and UPPER
.