KnitroSolver Class Reference

the KnitroSolver class solves problems using Knitro. More...

#include <KnitroSolver.h>

Inheritance diagram for KnitroSolver:

Inheritance graph
[legend]
Collaboration diagram for KnitroSolver:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 KnitroSolver ()
 the KnitroSolver class constructor
 ~KnitroSolver ()
 the KnitroSolver class constructor
virtual void solve () throw (ErrorClass)
 solve results in an instance being read into the Knitro data structrues and optimized
void dataEchoCheck ()
 use this for debugging, print out the instance that the solver thinks it has and compare this with the OSiL file
int getN (void)
int getM (void)
void getInitialX (double *const daX)
bool loadProblemIntoKnitro (KTR_context_ptr kc)
 Define the fixed problem definition information and pass it to KNITRO by calling KTR_init_problem.
bool areDerivativesImplemented (const DerivativesImplementedType nWhichDers)
int evalFC (const double *const daX, double *const dObj, double *const daC, void *userParams)
int evalGA (const double *const daX, double *const daG, double *const daJ, void *userParams)
int evalH (const double *const daX, const double *const daLambda, double *const daH, void *userParams)
int evalHV (const double *const daX, const double *const daLambda, double *const daHV, void *userParams)

Private Member Functions

Methods to block default compiler methods.
The compiler automatically generates the following three methods. Since the default compiler implementation is generally not what you want (for all but the most simple classes), we usually put the declarations of these methods in the private section and never implement them. This prevents the compiler from implementing an incorrect "default" behavior without us knowing. (See Scott Meyers book, "Effective C++")

 KnitroSolver (const KnitroSolver &)
KnitroSolveroperator= (const KnitroSolver &)

Private Attributes

OSrLWriterosrlwriter
std::string knitroErrorMsg

Detailed Description

the KnitroSolver class solves problems using Knitro.

Author:
Robert Fourer, Jun Ma, Kipp Martin
Version:
1.0, 03/14/2004
Since:
OS 1.0
Remarks:
this class takes an OSiL instance and optimizes it using the Knitro solver

Definition at line 93 of file KnitroSolver.h.


Constructor & Destructor Documentation

KnitroSolver::KnitroSolver (  ) 

the KnitroSolver class constructor

Definition at line 183 of file KnitroSolver.cpp.

References knitroErrorMsg, and osrlwriter.

KnitroSolver::~KnitroSolver (  ) 

the KnitroSolver class constructor

Definition at line 189 of file KnitroSolver.cpp.

References osrlwriter.

KnitroSolver::KnitroSolver ( const KnitroSolver  )  [private]


Member Function Documentation

void KnitroSolver::solve (  )  throw (ErrorClass) [virtual]

solve results in an instance being read into the Knitro data structrues and optimized

Implements DefaultSolver.

Definition at line 528 of file KnitroSolver.cpp.

References ErrorClass::errormsg, g_pOptProblem, OSInstance::getConstraintNumber(), OSInstance::getInstanceName(), OSInstance::getVariableNumber(), DefaultSolver::osil, DefaultSolver::osinstance, DefaultSolver::osresult, DefaultSolver::osrl, osrlwriter, OSiLReader::readOSiL(), OSResult::setConstraintNumber(), OSResult::setDualVariableValues(), OSResult::setGeneralMessage(), OSResult::setGeneralStatusType(), OSResult::setInstanceName(), OSResult::setObjectiveNumber(), OSResult::setObjectiveValues(), OSResult::setPrimalVariableValues(), OSResult::setServiceName(), OSResult::setSolutionNumber(), OSResult::setSolutionStatus(), OSResult::setVariableNumber(), wrapperEvalFC(), wrapperEvalGA(), wrapperEvalHorHV(), and OSrLWriter::writeOSrL().

void KnitroSolver::dataEchoCheck (  ) 

use this for debugging, print out the instance that the solver thinks it has and compare this with the OSiL file

Definition at line 751 of file KnitroSolver.cpp.

References QuadraticTerms::coefficients, OSInstance::getConstraintLowerBounds(), OSInstance::getConstraintNames(), OSInstance::getConstraintNumber(), OSInstance::getConstraintUpperBounds(), OSInstance::getDenseObjectiveCoefficients(), OSInstance::getInstanceDescription(), OSInstance::getInstanceName(), OSInstance::getInstanceSource(), OSInstance::getLinearConstraintCoefficientNumber(), OSInstance::getLinearConstraintCoefficientsInColumnMajor(), OSInstance::getNumberOfQuadraticTerms(), OSInstance::getObjectiveMaxOrMins(), OSInstance::getQuadraticTerms(), OSInstance::getVariableLowerBounds(), OSInstance::getVariableNames(), OSInstance::getVariableNumber(), OSInstance::getVariableTypes(), OSInstance::getVariableUpperBounds(), SparseMatrix::indexes, OSInstance::instanceData, Objectives::numberOfObjectives, Objectives::obj, InstanceData::objectives, DefaultSolver::osinstance, QuadraticTerms::rowIndexes, SparseMatrix::starts, SparseMatrix::values, QuadraticTerms::varOneIndexes, and QuadraticTerms::varTwoIndexes.

int KnitroSolver::getN ( void   ) 

Definition at line 206 of file KnitroSolver.cpp.

int KnitroSolver::getM ( void   ) 

Definition at line 211 of file KnitroSolver.cpp.

void KnitroSolver::getInitialX ( double *const   daX  ) 

Definition at line 216 of file KnitroSolver.cpp.

bool KnitroSolver::loadProblemIntoKnitro ( KTR_context_ptr  kc  ) 

Define the fixed problem definition information and pass it to KNITRO by calling KTR_init_problem.

Definition at line 234 of file KnitroSolver.cpp.

References OSInstance::bUseExpTreeForFunEval, ErrorClass::errormsg, OSInstance::getConstraintLowerBounds(), OSInstance::getConstraintNumber(), OSInstance::getConstraintUpperBounds(), OSInstance::getJacobianSparsityPattern(), OSInstance::getObjectiveNumber(), OSInstance::getVariableLowerBounds(), OSInstance::getVariableNumber(), OSInstance::getVariableUpperBounds(), SparseJacobianMatrix::indexes, OSInstance::initForAlgDiff(), knitroErrorMsg, OSINFINITY, DefaultSolver::osinstance, SparseJacobianMatrix::starts, and SparseJacobianMatrix::valueSize.

bool KnitroSolver::areDerivativesImplemented ( const DerivativesImplementedType  nWhichDers  ) 

Definition at line 399 of file KnitroSolver.cpp.

int KnitroSolver::evalFC ( const double *const   daX,
double *const   dObj,
double *const   daC,
void *  userParams 
)

Definition at line 413 of file KnitroSolver.cpp.

References OSInstance::calculateAllConstraintFunctionValues(), OSInstance::calculateAllObjectiveFunctionValues(), ErrorClass::errormsg, CommonUtil::ISOSNAN(), knitroErrorMsg, and DefaultSolver::osinstance.

int KnitroSolver::evalGA ( const double *const   daX,
double *const   daG,
double *const   daJ,
void *  userParams 
)

Definition at line 449 of file KnitroSolver.cpp.

References OSInstance::calculateAllConstraintFunctionGradients(), OSInstance::calculateAllObjectiveFunctionGradients(), ErrorClass::errormsg, CommonUtil::ISOSNAN(), knitroErrorMsg, DefaultSolver::osinstance, and SparseJacobianMatrix::values.

int KnitroSolver::evalH ( const double *const   daX,
const double *const   daLambda,
double *const   daH,
void *  userParams 
)

Definition at line 491 of file KnitroSolver.cpp.

References OSInstance::calculateLagrangianHessian(), ErrorClass::errormsg, SparseHessianMatrix::hessValues, knitroErrorMsg, and DefaultSolver::osinstance.

int KnitroSolver::evalHV ( const double *const   daX,
const double *const   daLambda,
double *const   daHV,
void *  userParams 
)

Definition at line 518 of file KnitroSolver.cpp.

KnitroSolver& KnitroSolver::operator= ( const KnitroSolver  )  [private]


Member Data Documentation

OSrLWriter* KnitroSolver::osrlwriter [private]

Definition at line 141 of file KnitroSolver.h.

Referenced by KnitroSolver(), solve(), and ~KnitroSolver().

std::string KnitroSolver::knitroErrorMsg [private]

Definition at line 158 of file KnitroSolver.h.

Referenced by evalFC(), evalGA(), evalH(), KnitroSolver(), and loadProblemIntoKnitro().


The documentation for this class was generated from the following files:
Generated on Thu May 15 22:15:34 2008 by  doxygen 1.4.7