# variables#

## Functions#

### affine#

inline void ioh::problem::transformation::variables::affine(std::vector<double> &x, const std::vector<std::vector<double>> &m, const std::vector<double> &b)#

Affine transformation for x using matrix M and vector B.

Parameters:
• x – raw variables

• m – transformation matrix

• b – transformation vector

### asymmetric#

inline void ioh::problem::transformation::variables::asymmetric(std::vector<double> &x, const double beta)#

Asymmetric transformation scaled by beta.

Parameters:
• x – raw variables

• beta – scale of the transformation

### brs#

inline void ioh::problem::transformation::variables::brs(std::vector<double> &x)#

brs transformation on x

Parameters:

x – raw variables

### conditioning#

inline void ioh::problem::transformation::variables::conditioning(std::vector<double> &x, const double alpha)#

conditioning transformation of x

Parameters:
• x – raw variables

• alpha – base of the transformation

### oscillate#

inline void ioh::problem::transformation::variables::oscillate(std::vector<double> &x, const double alpha = 0.1)#

oscillate each variable in x

Parameters:
• x – raw variables

• alpha – the factor of oscillation

### random_flip#

inline void ioh::problem::transformation::variables::random_flip(std::vector<int> &x, const int seed)#

randomly flips a bit

Parameters:
• x – raw variables

• seed – seed for the random flip

### random_reorder#

inline void ioh::problem::transformation::variables::random_reorder(std::vector<int> &x, const int seed)#

randomly reorder the elements from x

Parameters:
• x – raw variables

• seed – seed for the random flip

### random_reorder_reset#

inline std::vector<int> ioh::problem::transformation::variables::random_reorder_reset(const std::vector<int> &x_1, const int seed)#

reset x from x_1 whose elements were randomly reordered from x

Parameters:
• x_1 – the reordered variables

• seed – seed for the random flip

### random_sign_flip#

inline void ioh::problem::transformation::variables::random_sign_flip(std::vector<double> &x, const long seed)#

randomly reverse the sign for each xi

Parameters:
• x – raw variables

• seed – for generating the random vector

### scale#

inline void ioh::problem::transformation::variables::scale(std::vector<double> &x, const double scalar)#

scale x by a scalar

Parameters:
• x – raw variables

• scalar – the factor to scale x by

### scale_and_rotate#

inline void ioh::problem::transformation::variables::scale_and_rotate(const std::vector<double> &x, std::vector<double> &sr_x, std::vector<double> &y, const std::vector<double> &os, const std::vector<std::vector<double>> &mr, const double sh_rate, const bool s_flag, const bool r_flag)#

Performs a series of transformations on the input vector `x`, including scaling and either rotation or affine transformation, based on the flags provided.

This function is a part of the IOHexperimenter’s problem transformations module, which is used to apply various transformations on optimization problem variables. The function takes an input vector `x` and applies a series of transformations including scaling and either rotation (using a rotation matrix `mr`) or an affine transformation. The transformed vector is stored in `sr_x`.

Note

The function uses the `subtract` and `affine` functions for the subtract and affine transformations, respectively.

Note

The `b` vector is initialized to a zero vector as it is used in the affine transformation to add a constant vector to `x`, but in this case, it acts as a no-op.

Parameters:
• x – A constant reference to the input vector that needs to be transformed. It represents the raw variables of the optimization problem.

• sr_x – A reference to the vector where the final transformed variables will be stored. This vector is expected to be initialized with the same size as `x`.

• y – A reference to a vector used as a temporary storage during the transformation process. This vector is expected to be initialized with the same size as `x`.

• os – A constant reference to a vector used in the subtract transformation. It represents the offset values for each variable in `x`.

• mr – A constant reference to a 2D vector representing the rotation matrix or the matrix used in the affine transformation.

• sh_rate – A double representing the scaling factor applied to each variable in `x` during the scaling transformation.

• s_flag – A boolean flag indicating whether the scaling transformation should be applied. If true, scaling is applied; otherwise, it is skipped.

• r_flag – A boolean flag indicating whether the rotation or affine transformation should be applied. If true, rotation or affine transformation is applied; otherwise, it is skipped.

Returns:

void

### subtract#

inline void ioh::problem::transformation::variables::subtract(std::vector<double> &x, const std::vector<double> &offset)#

subtract an offset from each xi

Parameters:
• x – raw variables

• offset – a vector of offsets for each xi

### z_hat#

inline void ioh::problem::transformation::variables::z_hat(std::vector<double> &x, const std::vector<double> &xopt)#

transforms the raw variables using the distance to the optimum

Parameters:
• x – the raw variables

• xopt – the optimum