Class to convexify a (decomposed) function. More...
#include <relax.h>
Public Member Functions | |
Convexify (Pointer< Param > param_) | |
void | new_sampleset (UserVector< double > &lower, UserVector< double > &upper, SepQcFunc &f) |
Computes a new sample set for the nonlinear blocks of a function. | |
double | convexify (SepQcFunc &f, bool eq, vector< double > &min_eigval, vector< double > &max_eigval, UserVector< double > &lower, UserVector< double > &upper) |
Computes the cgu or alpha parameters for a function. | |
void | get_decomposed_functions (pair< Pointer< SepQcFunc >, Pointer< SepQcFunc > > &f) |
Gives a convexified function. | |
void | check_convex2 (vector< double > &min_eigval, vector< double > &max_eigval, SepQcFunc &f, const vector< vector< dvector > > &sample_set) |
void | check_convexification (MinlpProblem &conv_prob, MinlpProblem &orig_prob, const ivector &ineq_index, int test_pts=20) |
Checks, if a problem is a convex relaxation of another problem. | |
Public Attributes | |
vector< pair< double, double > > | convexify_c |
Constant parts, generated by alpha or cgu. | |
map< int, double > | characteristica1 |
The shifting parameters which characterize the latest convexification. | |
map< int, double > | characteristica2 |
Private Member Functions | |
void | convexify_cgu (SepQcFunc &f, int k) |
Computes the cgu-parameters for the convexification of the k'th block of f. | |
pair< double, double > | convexify_alpha (SepQcFunc &f, int k, const dvector &low, const dvector &up, Pointer< set< int > > i_quad, Pointer< set< int > > i_nonquadlin) |
Computes the alpha-parameters for the convexification of the k'th block of f. | |
pair< double, double > | convexify_alpha (SepQcFunc &f, int k, const dvector &low, const dvector &up) |
pair< double, double > | convexify_alpha2 (SepQcFunc &f, int k, const dvector &low, const dvector &up) |
Private Attributes | |
Pointer< Param > | param |
Sampling | sampling |
Object to generate sample points. | |
vector< vector< dvector > > | sample_set |
Decomposition | decomp |
double | very_large |
double | cgu_eps |
pair< Pointer< UserVector < double > >, Pointer < UserVector< double > > > | convexify_a |
Diagonal of matrices, generated by alpha or cgu method. | |
pair< Pointer< UserVector < double > >, Pointer < UserVector< double > > > | convexify_b |
Linear parts, generated by alpha or cgu method. | |
vector< bool > | convexified_by_cgu |
Indicates, whether the last function was convexified with the cgu method. |
Class to convexify a (decomposed) function.
Relax | very large options double default 1E+99 Determines, when we use CGU and when we use the alpha-method to convexify a function. If ${}{} < -very$, we use CGU, else we try alpha. If the norm of the computed alpha is > very, we use also CGU. | |
Relax | CGU epsilon options double $$ default 0. An epsilon, which is added to each constraint in the LP, we solve when we compute a CGU. |
Definition at line 33 of file relax.h.
void Convexify::convexify_cgu | ( | SepQcFunc & | f, | |
int | k | |||
) | [private] |
Computes the cgu-parameters for the convexification of the k'th block of f.
f | The function to convexify. | |
k | The block number. |
pair<double, double> Convexify::convexify_alpha | ( | SepQcFunc & | f, | |
int | k, | |||
const dvector & | low, | |||
const dvector & | up, | |||
Pointer< set< int > > | i_quad, | |||
Pointer< set< int > > | i_nonquadlin | |||
) | [private] |
Computes the alpha-parameters for the convexification of the k'th block of f.
f | The function to convexify. | |
k | The block number. | |
low | Lower bounds for the k'th block. | |
up | Upper bounds for the k'th block. |
pair<double, double> Convexify::convexify_alpha | ( | SepQcFunc & | f, | |
int | k, | |||
const dvector & | low, | |||
const dvector & | up | |||
) | [private] |
pair<double, double> Convexify::convexify_alpha2 | ( | SepQcFunc & | f, | |
int | k, | |||
const dvector & | low, | |||
const dvector & | up | |||
) | [private] |
void Convexify::new_sampleset | ( | UserVector< double > & | lower, | |
UserVector< double > & | upper, | |||
SepQcFunc & | f | |||
) |
Computes a new sample set for the nonlinear blocks of a function.
lower | Lower bounds of variables. | |
upper | Upper bounds of variables. | |
f | The function, which block-structure we use. |
double Convexify::convexify | ( | SepQcFunc & | f, | |
bool | eq, | |||
vector< double > & | min_eigval, | |||
vector< double > & | max_eigval, | |||
UserVector< double > & | lower, | |||
UserVector< double > & | upper | |||
) |
Computes the cgu or alpha parameters for a function.
f | The function. | |
eq | Indicates, whether also the parameters for -f should be computed. | |
min_eigval | The minimum eigenvalues for the hessians of each block of f. | |
max_eigval | The maximum eigenvalues for the hessians of each block of f. | |
convex | Indicates, whether f is convex. | |
concave | Indicates, whether f is concave. | |
lower | Lower bounds of variables. | |
upper | Upper bounds of variables. |
Gives a convexified function.
Gives the convexified function in it's decomposed form (the form, which was used in convexify).
f | A pair, where ew can store the convexified f and (sometimes) -f in. At the beginning, it needs to hold the decomposed f at first place, the second needs to empty. |
void Convexify::check_convex2 | ( | vector< double > & | min_eigval, | |
vector< double > & | max_eigval, | |||
SepQcFunc & | f, | |||
const vector< vector< dvector > > & | sample_set | |||
) |
void Convexify::check_convexification | ( | MinlpProblem & | conv_prob, | |
MinlpProblem & | orig_prob, | |||
const ivector & | ineq_index, | |||
int | test_pts = 20 | |||
) |
Checks, if a problem is a convex relaxation of another problem.
Checks, if the minimum eigenvalues of the convexified functions are >=0. Checks, if the function values of the convexified functions are lower than the value of the original functions.
conv_prob | The convexified problem. | |
orig_prob | The original problem to compare with. | |
test_ptr | The number of sample points to use, default is 20. |
Pointer<Param> Convexify::param [private] |
Sampling Convexify::sampling [private] |
vector<vector<dvector> > Convexify::sample_set [private] |
Decomposition Convexify::decomp [private] |
double Convexify::very_large [private] |
double Convexify::cgu_eps [private] |
pair<Pointer<UserVector<double> >, Pointer<UserVector<double> > > Convexify::convexify_a [private] |
pair<Pointer<UserVector<double> >, Pointer<UserVector<double> > > Convexify::convexify_b [private] |
vector<bool> Convexify::convexified_by_cgu [private] |
vector<pair<double, double> > Convexify::convexify_c |
map<int, double> Convexify::characteristica1 |
map<int, double> Convexify::characteristica2 |