BlockIPPlatform
 All Classes Files Functions Variables
Classes | Public Member Functions | Public Attributes | List of all members
StdForm Class Reference

Class for perform conversions between standard form and original problem. More...

#include <StdForm.h>

Collaboration diagram for StdForm:
Collaboration graph
[legend]

Classes

struct  Transform
 

Public Member Functions

 StdForm ()
 Constructor.
 
 ~StdForm ()
 Destructor.
 
void fobj_stdform (int n, double x[], double &fx, double Gx[], double Hx[], void *params)
 Function to calculate the objective function in a transformed variables point.
 
void transformed_to_original_primal_variables (double *x)
 Converts a point from transformed variables to original variables space.
 
void transformed_to_original_dual_variables (double *y, double *w, double *z)
 
void original_to_transformed_primal_variables (double *&xout, double *xin)
 Converts a point from original variables to transformed variables space.
 
void transform_linear_and_quadratic_cost (double *&cost, double *&qcost, double &constant)
 Transforms objective function from original variables to transformed variables space.
 
void original_to_transformed_names (string *&outVarNames, string *inVarNames, string *&outConsNames, string *inConsNames)
 Converts the variable names from original variables to transformed variables space.
 
void delete_new_variables (double *&xout, double *xin)
 

Public Attributes

int numOrigVars
 Number of variables in the original problem.
 
int numTransfVars
 Number of variables in the transformed (standardized) problem.
 
int m_cons
 Number of constraints (including slacks) in the standardized problem.
 
int numTransforms
 Number of transformations performed in variables.
 
int * origVars
 Index to the original variables (that need a transformatiBon in objective function) in original problem, of size numTransforms.
 
int * transfVars
 Index to the original variables (that need a transformation in objective function) in standardized problem, of size numTransforms.
 
Transformtransforms
 Transformations performed in variables, of size numTransforms.
 
double constantFObj
 Constant to add in the objective function.
 
vector< int > * deletedRows
 Index to the rows that have been deleted.
 
double * xOrig
 Optimal solution in the original problem.
 
double * yOrig
 Optimal dual variables in the original problem.
 
double * GxOrig
 Gradient in x in the original problem.
 
double * HxOrig
 Hessian in x in the original problem.
 
double * wOrig
 Optimal dual variables of x_i <= u_i bounds in the original problem.
 
double * zOrig
 Optimal dual variables of x_i >= 0 bounds in the original problem.
 
void(* fobj )(int n, double x[], double &fx, double Gx[], double Hx[], void *params)
 User function to calculate the objective function in a point.
 

Detailed Description

Class for perform conversions between standard form and original problem.

Member Function Documentation

void StdForm::delete_new_variables ( double *&  xout,
double *  xin 
)
Parameters
xoutVector in original variables space, is allocated by the function with new, must be freed with delete[]
xinVector in transformed variables space
void StdForm::fobj_stdform ( int  n,
double  x[],
double &  fx,
double  Gx[],
double  Hx[],
void *  params 
)

Function to calculate the objective function in a transformed variables point.

Converts a point from transformed variables to original variables space and call the user function to calculate the objective function in that point, after that inverts the transformations to return the information in the transformed variables space

Parameters
nNumber of variables in transformed variables space
xPoint in transformed variables space
fxObjective function value in x
GxGradient in x
HxHessian in x
paramsUser parameters to perform objective function calculations
void StdForm::original_to_transformed_names ( string *&  outVarNames,
string *  inVarNames,
string *&  outConsNames,
string *  inConsNames 
)

Converts the variable names from original variables to transformed variables space.

Parameters
outVarNamesVariable names including slacks, output in transformed variables space
inVarNamesVariable names including slacks, input in original variables space
outConsNamesConstraint names including linking constraints, output in transformed variables space
inConsNamesConstraint names including linking constraints, input in original variables space
void StdForm::original_to_transformed_primal_variables ( double *&  xout,
double *  xin 
)

Converts a point from original variables to transformed variables space.

Parameters
xoutPoint in transformed variables space, is allocated by the function with new, must be freed with delete[]
xinPoint in original variables space
void StdForm::transform_linear_and_quadratic_cost ( double *&  cost,
double *&  qcost,
double &  constant 
)

Transforms objective function from original variables to transformed variables space.

Parameters
costLinear cost of variables including slacks, input in original variables space, output in transformed variables space
qcostQuadratic cost of variables including slacks, input in original variables space, output in transformed variables space
constantConstant to add in the objective function
void StdForm::transformed_to_original_dual_variables ( double *  y,
double *  w,
double *  z 
)

Converts the dual variables y of constraints, and (z,w) of lower and upper bounds from transformed to original space.

Constraints of the form lhs <= Ax <= rhs are transformed to Ax+s= rhs, 0<= s<= rhs-lhs. y are the multipliers of Ax+s= rhs, and yOrig_l and yOrig_r the multipliers for, respectively, lhs <= Ax and Ax <=rhs. It can be seen that

  • if y(i)>=0 then yOrig_r(i)= y(i) and yOrig_l(i)=0;
  • if y(i)<=0 then yOrig_l(i)= 0 and and yOrig_l(i)=-y(i). We will only use a single yOrig=y vector, such that when yOrig(i) is positive it is yOrig_r(i), and when negative it is -yOrig_l(i).

Multipliers z are related to upper bounds x<=u, while multipliers w are related to lower bounds l<= x.

Variables without upper bounds do not have z; we will set the corresponding components zOrig(i)=0.

Free variables do not have z and w. We will set the corresponding components of zOrig(i)=wOrig(i)=0.

For variables with the transformation NON_ZERO_LB (x~= x-l) we have that zOrig(i)= z(i) and wOrig(i)= w(i).

For variables with the transformation _INF_LB (x~= -x+u) we have that zOrig(i)= w(i) and wOrig(i)= 0 =z(i).

Parameters
yDual variables of constraint in standardized problem
wDual variables of x_i <= u_i bounds in standardized problem
zDual variables of x_i >= 0 bounds in standardized problem
Note
Dual variables in original problem are stored in yOrig, wOrig and zOrig
void StdForm::transformed_to_original_primal_variables ( double *  x)

Converts a point from transformed variables to original variables space.

Parameters
xPoint in transformed variables space
Note
Point in original variables space is stored in xOrig

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