CONOPT
|
In addition to the three implementations of the Tutorial model discussed so far there are a number of other models that show various aspects of CONOPT. The source code for these models is distributed with the CONOPT library.
tutorialk.f90 (tutorialk.c): This is a revision of tutorial.f90 (tutorial.c) in which the capital stock is defined as a variable with fixed value. The disadvantage of this formulation is the larger side. The advantage is, that the model can return the marginal value of capital.
pindyck.f90 (pindyck.c): This is a larger model with a time dimension, 7 variables and 6 equations per period plus an objective function. The implementation shows how all sizes and the callback routines ReadMatrix
and FDEval
can be written with the number of periods as a parameter. The file also shows the use of COI_Version
to determine the version of CONOPT being used and the use of WorkFactor
and WorkSpace
to tell CONOPT about memory estimates.
pindyckm.f90 (pindyckm.c): This model is close to pindyck.f90 (pindyck.c). The differences are, that we allocate working memory based on the estimate given by COI_MemEst
and pass this memory to CONOPT, and we pass user memory to CONOPT and test that it is indeed this memory we receive in some of the callback routines.
pinadd.f90 (pinadd.c): The time horizon in pindyck.f90 (pindyck.c) is made dynamic and the model is solved for 16, 17, .. up to 20 periods. The relevant entries in the control vector are updated before each call of COI_Solve
. The solution values are saved in a special Pin_Solution
callback routine and reused as initial values in Pin_ReadMatrix
when the model is solved for a longer period. The status values from Solution
are also saved and reused in ReadMatrix
after CONOPT has been informed about the availability of status information with COIDEF_IniStat
. The special Pin_Solution
is only writing the solution for the final period.
pinadd2.f90 (pinadd2.c): The example in pinadd.f90 (pinadd.c) is enhanced with second derivatives defined in a Pin_2DLagr
routine. The example also show the use of COIDEF_Debug2D
to turn the second derivative debugger on for the first solve and off for the remaining solves.
pinadd2err.f90 (pinadd2err.c): The above model with a provoked error in the second derivative matrix. Shows an error message from the 2nd derivative debugger.
pinsquare.f90 (pinsquare.c): The example is close to pindyck.f90 (pindyck.c), but one of the dynamic variables is fixed and the resulting model is a square system of equations. The recursive order of the pre-triangular equations is also show using a Pin_TriOrd
callback routine. A comment in the file shows how the model can be made infeasible and another termination message becomes available.
qp1.f90 (qp1.c): A simple linearly constrained QP model implemented with first derivatives only and showing the importance of allowing many superbasic variables.
qp2.f90 (qp2.c): The same model as in qp1.f90 (qp1.c) coded with directional second derivatives.
qp3.f90 (qp3.c): The same model as in qp1.f90 (qp1.c) coded with an explicit Hessian of the Lagrangian.
qp4.f90 (qp4.c): The same model as in qp1.f90 (qp1.c) coded with both directional second derivatives and an explicit Hessian of the Lagrangian.
qp5.f90 (qp5.c): The same model as in qp1.f90 (qp1.c) with directional second derivatives computed using perturbations.