Interior-point-optimisation  1.0-1
Interior-pointoptimisationlibrary
ipo::detail::PhaseIModel Class Reference

Model used for finding an initial feasible solution in phase I of interior-pont optimisation. More...

#include <PhaseIModel.hpp>

Inheritance diagram for ipo::detail::PhaseIModel:
Inheritance graph
Collaboration diagram for ipo::detail::PhaseIModel:
Collaboration graph

Public Member Functions

 PhaseIModel (Model &model)
 Constructor. More...
 
double getInitial_s (gsl::vector const &vector) const
 Get an initial value for s from a vector of length one less than the number of variables of this model. More...
 
bool findFeasibleSolution ()
 Find a feasible solution to the base Model by partial optimisation of the PhaseIModel and copy the result to the variables of the base Model on success. More...
 
- Public Member Functions inherited from ipo::Model
 Model ()
 Constructor. More...
 
virtual void notify ()
 Notify function that model must implement. More...
 
void setObjective (Objective &objective)
 Set the objective function. More...
 
Objective getObjective ()
 Get the objective function. More...
 
void addConstraint (Constraint &constraint)
 Add a constraint. More...
 
bool removeConstraint (Constraint &constraint)
 Remove a constraint. More...
 
std::vector< Constraint > const & getConstraints () const
 Get list of constraints. More...
 
std::vector< LinearConstraint >
const & 
getEqualityConstraints () const
 Get list of equality constraints. More...
 
bool isFeasible ()
 Test whether current values of variables give a feasible solution. More...
 
bool isStrictlyFeasible ()
 Test whether current values of variables give a feasible solution. More...
 
bool minimise ()
 Try to minimise the objective function subject to the constraints. More...
 
bool maximise ()
 Try to maximise the objective function subject to the constraints. More...
 
virtual bool findFeasible ()
 Try to find a set of values for the variables that gives a feasible solution. More...
 
ParametersgetParameters ()
 Get parameters by reference. More...
 
detail::NewtonDescent::ParametersgetNewtonDescentParameters ()
 Get Newton descent parameters by reference. More...
 
detail::LineSearch::ParametersgetLineSearchParameters ()
 Get line search parameters by reference. More...
 
bool checkSize () const
 Check objective and constraint functions. More...
 
void testSizes () const
 Check objective and constraint functions. More...
 
void summary (std::ostream &ostream=std::cout) const
 Create a summary of this model. More...
 

Private Member Functions

bool findEqualityConstraintFeasibleSolution ()
 Find a solution that satisfies equality constraints. More...
 
virtual void setIndices ()
 Sets the values of objectiveIndices, constraintIndices and variableIndices from Model. More...
 

Private Attributes

Modelmodel
 The Model this is based on. More...
 
std::map< Variable, VariablecrossIndex
 A map so we can look up Variable of this from Variable of model. More...
 

Additional Inherited Members

- Protected Member Functions inherited from ipo::Model
gsl::vector getVectorFromVariables () const
 Get a vector from values of variables. More...
 
void setVariablesFromVector (gsl::vector const &vector)
 Set variable values from a vector. More...
 
bool stoppingCriterion (double const t) const
 Check whether or not stopping criterion has been met. More...
 
virtual bool optimise (bool const minimise)
 Try to optimise the objective function subject to the constraints. More...
 
void setObjectiveIndices ()
 Set objectiveIndices. More...
 
void setConstraintIndices ()
 Set constraintIndices. More...
 
- Protected Attributes inherited from ipo::Model
std::vector< Constraintconstraints
 The set of constraints. More...
 
std::vector
< ipo::LinearConstraint
equalityConstraints
 The set of equality constraints. More...
 
Objective objective
 The objective function. More...
 
std::shared_ptr< SubvectorobjectiveIndices
 Used internally to match the variables in the objective to indices in a vector: objectiveIndices[i] is the index in a gsl::vector of the ith variable in objective.getVariables() after a call to setIndices(). More...
 
std::vector< std::shared_ptr
< Subvector > > 
constraintIndices
 Used internally to match the variables in each constraint to indices in a vector: (*constraintIndices[j])()[i] is the index in a gsl::vector of the ith variable in constraint[j]->getVariables() after a call to setIndices(). More...
 
std::vector< std::shared_ptr
< Subvector > > 
equalityConstraintIndices
 Used internally to match the variables in each equality constraint to indices in a vector: (*constraintIndices[j])()[i] is the index in a gsl::vector of the ith variable in * constraint[j]->getVariables() after a call to setIndices(). More...
 
std::map< Variable, size_t > indexMap
 Used internally to match the variables in each variable to indices in a vector. More...
 
bool variablesChanged = false
 Value that indicates if any variables, objective or constraints have been modified in such a way that we may have to update them. More...
 
detail::NewtonDescent::Parameters newtonDescentParameters
 Parameters used by Newton descent algorithm during optimisation. More...
 
detail::LineSearch::Parameters lineSearchParameters
 Parameters used by backtracking line search algorithm during optimisation. More...
 

Detailed Description

Model used for finding an initial feasible solution in phase I of interior-pont optimisation.

This model needs to be based on another model, which is provided with its constructor.

Definition at line 36 of file PhaseIModel.hpp.

Constructor & Destructor Documentation

PhaseIModel::PhaseIModel ( Model model)

Constructor.

Parameters
modelThe Model that this Model finds a feasible solution for

Definition at line 28 of file PhaseIModel.cc.

References ipo::Model::lineSearchParameters, ipo::Model::newtonDescentParameters, ipo::Model::parameters, setIndices(), and ipo::Model::variablesChanged.

Member Function Documentation

bool PhaseIModel::findEqualityConstraintFeasibleSolution ( )
private

Find a solution that satisfies equality constraints.

Set variables to the values found.

Returns
true or false according as solution found or not

Definition at line 294 of file PhaseIModel.cc.

References crossIndex, ipo::Model::equalityConstraints, ipo::Model::indexMap, IPOE, model, setIndices(), and ipo::Variable::setValue().

Referenced by findFeasibleSolution().

bool PhaseIModel::findFeasibleSolution ( )

Find a feasible solution to the base Model by partial optimisation of the PhaseIModel and copy the result to the variables of the base Model on success.

Returns
true or false according as algorithm succeeded or not

Definition at line 253 of file PhaseIModel.cc.

References crossIndex, findEqualityConstraintFeasibleSolution(), getInitial_s(), ipo::Model::getNewtonDescentParameters(), ipo::Model::indexMap, ipo::Model::isStrictlyFeasible(), ipo::Model::minimise(), model, setIndices(), ipo::detail::NewtonDescent::Parameters::setPhaseI(), and ipo::Model::setVariablesFromVector().

Referenced by ipo::Model::findFeasible().

double PhaseIModel::getInitial_s ( gsl::vector const &  vector) const

Get an initial value for s from a vector of length one less than the number of variables of this model.

Parameters
vectorA vector: (vector,s) will be an initial feasible solution for PhaseIModel on return
Returns
An initial value for s
Exceptions
IPOExceptionif vector has wrong length

Definition at line 37 of file PhaseIModel.cc.

References ipo::Model::constraintIndices, ipo::Model::constraints, ipo::Model::indexMap, ipo::infinity, IPOE, lowerBound, ipo::minusInfinity, model, ipo::Model::setIndices(), and upperBound.

Referenced by findFeasibleSolution().

Member Data Documentation

std::map<Variable,Variable> ipo::detail::PhaseIModel::crossIndex
private

A map so we can look up Variable of this from Variable of model.

Definition at line 80 of file PhaseIModel.hpp.

Referenced by findEqualityConstraintFeasibleSolution(), findFeasibleSolution(), and setIndices().

Model& ipo::detail::PhaseIModel::model
private

The Model this is based on.

Definition at line 76 of file PhaseIModel.hpp.

Referenced by findEqualityConstraintFeasibleSolution(), findFeasibleSolution(), getInitial_s(), and setIndices().


The documentation for this class was generated from the following files: