MinlpProblem Class Reference

Class for defining a mixed-integer nonlinear minimization problem. More...

#include <problem.h>

Collaboration diagram for MinlpProblem:
Collaboration graph
[legend]

List of all members.

Public Types

enum  ptype { QQP, MINLP }
 

Types of optimization problems.

More...

Public Member Functions

 MinlpProblem (ptype p_type=MINLP, char *prob_name_=(char *) NULL, Pointer< ostream > out_problem_p_=out_out_p, Pointer< ostream > out_problem_log_p_=out_log_p)
 (Standard-)Constructor for an optimization problem.
 MinlpProblem (Pointer< SepQcFunc > obj_, const dvector &lower_, const dvector &upper_, bool discr_=false, Pointer< ostream > out_problem_p_=out_out_p, Pointer< ostream > out_problem_log_p_=out_log_p)
 Constructor for an objective function, the lower and upper bounds and a boolean, which indicates, whether all variables are discrete or continuous.
 MinlpProblem (const MinlpProblem &p)
 The copy constructor.
 MinlpProblem (const MinlpProblem &p, int k)
 Copy constructor for the variable structure of one block from another MinlpProblem.
virtual ~MinlpProblem ()
 Virtual Destructor.
int dim () const
 Get's the dimension of the problem.
virtual void add_var (int i_, int bnum, bool discr_, double lower_, double upper_, char *name=NULL)
 Add's a variable.
virtual void add_con (Pointer< SepQcFunc > f, bool eq=true, char *name=NULL)
 Adds a constraint to the problem.
virtual void del_con (int connr)
 Deletes one constraint from the problem.
virtual void add_obj (Pointer< SepQcFunc > f)
 Add's (or replace) the objective function.
void taylor_approx (UserVector< double > &point, const int degree=2)
 Does a second taylor approximation for this problem.
int feasible (const UserVector< double > &x, double tol, ostream *out=NULL)
 Checks the point for feasibility according to the constraints, not the lower and upper bounds.
void print_most_violated_constraints (const UserVector< double > &x, ostream &out, int nr=5, double tol=1E-4)
 Prints the names of those constraints that are most violated by a given point.
int scale (Pointer< Param > param=NULL)
 Scales the constraints, using the primal_point.
int scale (UserVector< double > &x, Pointer< Param > param=NULL)
 Scales the constraints.
void get_sparsity (vector< Pointer< SparsityInfo > > &si) const
Pointer< SparsityInfoget_sparsity (int k) const
virtual void print (ostream &out) const
 Prints some information about the problem.
void print_as_gams (ostream &out) const
 Prints the problem in gams format.

Public Attributes

Pointer< ostream > out_problem_p
 A Pointer to an ostream to print problem-relevant information to.
Pointer< ostream > out_problem_log_p
 A Pointer to an ostream to print problem-relevant logging-information to.
ptype problem_type
 The type of the problem.
Pointer< char > prob_name
 A name for the problem.
vector< ivectorblock
 The block structure of the variables.
vector< Pointer< char > > var_names
 The names of the variables.
Pointer< SepQcFuncobj
 The objective function.
vector< Pointer< SepQcFunc > > con
 The constraints functions.
vector< Pointer< char > > con_names
 The names of the constraints.
vector< bool > con_eq
 Indicates, which constraints are equations and which are inequation.
vector< int > i_discr
 The indices of the discrete variables.
vector< int > i_cont
 The indices of the continuous variables.
vector< bool > discr
 Indicates, whether variable is discrete (true) or continuous (false).
dvector lower
 The lower bounds of the variables.
dvector upper
 The upper bounds of the variables.
dvector primal_point
 Used for fixing the discrete variables.

Protected Attributes

int dim_
 The dimension.

Private Member Functions

double compute_scale (char *option, int c, double eps, UserVector< double > &x)

Friends

ostream & operator<< (ostream &out, const MinlpProblem &a)
 The output-operator.

Detailed Description

Class for defining a mixed-integer nonlinear minimization problem.

If i_discr is empty the problem is continuous.

Parameters:
constraint scaling eps options $ 0$ default 0 The value $$ to which constraints are going to be scaled. Not applied currently.
constraint scaling default options W*gradient | condition Jac | adjust by box ends | equalized default no scaling How to scale the constraints.
constraint scaling max patterns options integer $ 0$ Maximum number of different patterns to scale specific type of constraints.
constraint scaling pattern <$n$> options W*gradient | condition Jac | adjust by box ends | equalized | double $ 0$ How to scale the constraints that match the patters. Example: for all the constraints that contain the letter `E' {constraint scaling pattern 2 : E 1.} {constraint scaling pattern 2 : E number or equalized or condition Jac or none}

Definition at line 35 of file problem.h.


Member Enumeration Documentation

Types of optimization problems.

Enumerator:
QQP 
MINLP 

Definition at line 77 of file problem.h.


Constructor & Destructor Documentation

MinlpProblem::MinlpProblem ( ptype  p_type = MINLP,
char *  prob_name_ = (char*)NULL,
Pointer< ostream >  out_problem_p_ = out_out_p,
Pointer< ostream >  out_problem_log_p_ = out_log_p 
) [inline]

(Standard-)Constructor for an optimization problem.

Variables, objective function and constraints should then be add with the appropriate methods.

Parameters:
p_type The type of the optimization problem. By default, it's set to MINLP.
prob_name A name for the problem.
out_problem_p_ A Pointer to an ostream to print the problem-releated information to, default is out_out_p.
out_problem_log_p_ A Pointer to an ostream to print the problem-related logging-information to, default is out_log_p.
See also:
add_var(int, int, bool, double, double, char*)
add_obj(SepQcFunc*)
add_con(SepQcFunc&, bool, char*)

Definition at line 159 of file problem.h.

MinlpProblem::MinlpProblem ( Pointer< SepQcFunc obj_,
const dvector lower_,
const dvector upper_,
bool  discr_ = false,
Pointer< ostream >  out_problem_p_ = out_out_p,
Pointer< ostream >  out_problem_log_p_ = out_log_p 
) [inline]

Constructor for an objective function, the lower and upper bounds and a boolean, which indicates, whether all variables are discrete or continuous.

Set's the dimension of the problem to the dimension of the objective function.

Parameters:
obj_ The objective function.
lower_ The lower bounds of the variables.
upper_ The upper bounds of the variables.
discr_ If true, each variable is set to be discrete. If false, each variable is set to be continuous. Default is false.
out_problem_p_ A pointer to an ostream to print the problem-releated information to, default is out_out_p.
out_problem_log_p_ A pointer to an ostream to print the problem-related logging-information to, default is out_log_p.

Definition at line 172 of file problem.h.

MinlpProblem::MinlpProblem ( const MinlpProblem p  )  [inline]

The copy constructor.

Parameters:
p The MinlpProblem to copy.

Definition at line 182 of file problem.h.

MinlpProblem::MinlpProblem ( const MinlpProblem p,
int  k 
)

Copy constructor for the variable structure of one block from another MinlpProblem.

This does not copy the constraints.

Parameters:
p The problem to take one block from.
k The number of the block to take.
virtual MinlpProblem::~MinlpProblem (  )  [inline, virtual]

Virtual Destructor.

Definition at line 200 of file problem.h.


Member Function Documentation

double MinlpProblem::compute_scale ( char *  option,
int  c,
double  eps,
UserVector< double > &  x 
) [private]
int MinlpProblem::dim (  )  const [inline]

Get's the dimension of the problem.

Returns:
The dimension of the problem.

Definition at line 205 of file problem.h.

virtual void MinlpProblem::add_var ( int  i_,
int  bnum,
bool  discr_,
double  lower_,
double  upper_,
char *  name = NULL 
) [virtual]

Add's a variable.

Increases the dimension of the problem.

Add's the index i_ to block bnum.

If discr_ is true, adds the index to i_discr. If discr_ is false, adds the index to i_cont.

Add's discr_ to disrc.

Add's lower_ to lower. Add's upper_ to upper.

Parameters:
i_ The index of the new variable.
bnum The number of the block, where this variable belongs to.
discr_ Indicates, whether variable is discrete (true) or not (false).
lower_ The lower bound of this variable.
upper_ The upper bound of this variable.
name The name of the variable as pointer of char, default is NULL.
See also:
add_obj(SepQcFunc*)
add_con(SepQcFunc&, bool, char*)
virtual void MinlpProblem::add_con ( Pointer< SepQcFunc f,
bool  eq = true,
char *  name = NULL 
) [virtual]

Adds a constraint to the problem.

Adds f to con, init's the Ablock of f, copys the name and add eq to con_eq.

Parameters:
f The function.
eq Indicates, whether it's an equality-(true) or inequality-(false)-function. Default-Value is true.
name The name of the constraint as pointer of char. Default is NULL.
See also:
add_var(int, int, bool, double, double, char*)
add_obj(SepQcFunc&)
del_con(int)
virtual void MinlpProblem::del_con ( int  connr  )  [virtual]

Deletes one constraint from the problem.

Parameters:
connr The number of the constraint to delete.
See also:
add_con(SepQcFunc&, bool, char*)
virtual void MinlpProblem::add_obj ( Pointer< SepQcFunc f  )  [inline, virtual]

Add's (or replace) the objective function.

Parameters:
f The objective function, which should be used.
See also:
add_var(int, int, bool, double, double, char*)
add_con(SepQcFunc&, bool, char*)

Definition at line 252 of file problem.h.

void MinlpProblem::taylor_approx ( UserVector< double > &  point,
const int  degree = 2 
)

Does a second taylor approximation for this problem.

Changes the type of this problem to QQP.

Parameters:
point The point, where the approximation should be done.
int MinlpProblem::feasible ( const UserVector< double > &  x,
double  tol,
ostream *  out = NULL 
)

Checks the point for feasibility according to the constraints, not the lower and upper bounds.

Parameters:
x The UserVector<double> to check.
tol The tolerance, default is rtol.
Returns:
The number of not sattisfied constraints.
void MinlpProblem::print_most_violated_constraints ( const UserVector< double > &  x,
ostream &  out,
int  nr = 5,
double  tol = 1E-4 
)

Prints the names of those constraints that are most violated by a given point.

Each constraint is scaled by max(1,||gradient of constraint at x||_2).

Parameters:
x The point to check
out Where to print to.
nr How many violated constraints to print.
tol A feasibility tolerance.
int MinlpProblem::scale ( Pointer< Param param = NULL  )  [inline]

Scales the constraints, using the primal_point.

Parameters:
param Optional parameters, default is NULL.
Returns:
The number of scaled constraints.
See also:
scale(UserVector<double>&)

Definition at line 281 of file problem.h.

int MinlpProblem::scale ( UserVector< double > &  x,
Pointer< Param param = NULL 
)

Scales the constraints.

Parameters:
param Optional parameters, default is NULL.
x The UserVector<double> to compute for.
Returns:
The number of scaled constraints.
void MinlpProblem::get_sparsity ( vector< Pointer< SparsityInfo > > &  si  )  const
Pointer<SparsityInfo> MinlpProblem::get_sparsity ( int  k  )  const
virtual void MinlpProblem::print ( ostream &  out  )  const [virtual]

Prints some information about the problem.

Prints out:

  • The problem type, dimension and name.
  • Information about the objective function.
  • The block structure.
  • The names of the block-variables.
  • The indices of the discrete and continuous variables.
  • Information about the constraint-functions.
  • The lower-bounds of the dual variables.
Parameters:
out The ostream to print to.
See also:
obj
block
con
i_discr
i_cont
discr
con_eq
lower
upper
problem_type
prob_name
void MinlpProblem::print_as_gams ( ostream &  out  )  const

Prints the problem in gams format.

Working only for MIQQPs!


Friends And Related Function Documentation

ostream& operator<< ( ostream &  out,
const MinlpProblem a 
) [friend]

The output-operator.

Calls print(out).

Parameters:
out The ostream to print to.
a The MinlpProblem to print.
See also:
print(ostream&)

Definition at line 42 of file problem.h.


Member Data Documentation

int MinlpProblem::dim_ [protected]

The dimension.

Definition at line 51 of file problem.h.

A Pointer to an ostream to print problem-relevant information to.

See also:
out_problem

Definition at line 57 of file problem.h.

A Pointer to an ostream to print problem-relevant logging-information to.

See also:
out_problem_log

Definition at line 61 of file problem.h.

The type of the problem.

QIP, QQP or MINLP

Definition at line 82 of file problem.h.

A name for the problem.

See also:
MinlpProblem(ptype, char*, ostream*, ostream*)

Definition at line 87 of file problem.h.

The block structure of the variables.

See also:
add_var(int, int, bool, double, double, char*)

Definition at line 92 of file problem.h.

The names of the variables.

See also:
add_var(int, int, bool, double, double, char*)

Definition at line 97 of file problem.h.

The objective function.

See also:
add_obj(SepQcFunc*)

Definition at line 103 of file problem.h.

The constraints functions.

See also:
add_con(SepQcFunc&, bool, char*)

Definition at line 108 of file problem.h.

The names of the constraints.

See also:
add_con(SepQcFunc&, bool, char*)

Definition at line 113 of file problem.h.

vector<bool> MinlpProblem::con_eq

Indicates, which constraints are equations and which are inequation.

See also:
add_con(SepQcFunc&, bool, char*)

Definition at line 118 of file problem.h.

vector<int> MinlpProblem::i_discr

The indices of the discrete variables.

See also:
add_var(int, int, bool, double, double, char*)

Definition at line 123 of file problem.h.

vector<int> MinlpProblem::i_cont

The indices of the continuous variables.

See also:
add_var(int, int, bool, double, double, char*)

Definition at line 128 of file problem.h.

vector<bool> MinlpProblem::discr

Indicates, whether variable is discrete (true) or continuous (false).

See also:
add_var(int, int, bool, double, double, char*)

Definition at line 133 of file problem.h.

The lower bounds of the variables.

See also:
add_var(int, int, bool, double, double, char*)

Definition at line 138 of file problem.h.

The upper bounds of the variables.

See also:
add_var(int, int, bool, double, double, char*)

Definition at line 143 of file problem.h.

Used for fixing the discrete variables.

Definition at line 147 of file problem.h.


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

Generated on 10 Mar 2013 for LaGO by  doxygen 1.6.1