Interface for D-optimal designs

Contains functions to generate optimal designs.

For more information see “Two-Level Designs to Estimate All Main Effects and Two-Factor Interactions”, P.T. Eendebak and E.D. Schoen, 2017

Enums

enum coordinate_exchange_method_t

Different methods for the optimization. The default method DOPTIM_SWAP is a coordinate-exchange algorithms.

Values:

enumerator DOPTIM_UPDATE

replace a random element with a random value

enumerator DOPTIM_SWAP

swap two elements at random

enumerator DOPTIM_FLIP

randomly flip an element between 0 and 1

enumerator DOPTIM_AUTOMATIC

automatically select one of the methods

enumerator DOPTIM_NONE

perform no optimization

Functions

double scoreD(const std::vector<double> efficiencies, const std::vector<double> weights)

Calculate score from a set of efficiencies

The score is the weighted sum of the efficiencies.

Parameters:
  • efficiencies – Vector with calculated efficiencies

  • weights – Weights for the efficiencies

Returns:

Weighted sum of the efficiencies

DoptimReturn Doptimize(const arraydata_t &arrayclass, int nrestarts, const std::vector<double> alpha, int verbose, coordinate_exchange_method_t method = DOPTIM_AUTOMATIC, int niter = 300000, double maxtime = 100000, int nabort = 5000)

Generates optimal designs for the specified class of designs

The method uses a coordinate-exchange algorithm to optimze a target function defined by the optimziation paramaters. The optimization is performed multiple times to prevent finding a design in a local minmum of the target function.

The method is described in more detail in “Two-Level Designs to Estimate All Main Effects and Two-Factor Interactions”, Eendebak et al., 2015, Technometrics, https://doi.org/10.1080/00401706.2016.1142903.

Parameters:
  • arrayclass – Class of designs to optimize

  • nrestarts – Number of restarts to perform

  • alpha – Optimization parameters. The target function is alpha_1 D + alpha_2 D_s + alpha D_1

  • verbose – Verbosity level

  • method – Method for optimization algorithm

  • niter – Maximum number of iterations for each restart

  • maxtime – Maximum calculation time. If this time is exceeded, the function is aborted

  • nabort – Maximum number of iterations when no improvement is found

Returns:

A structure with the generated optimal designs

DoptimReturn DoptimizeMixed(const arraylist_t &sols, const arraydata_t &arrayclass, const std::vector<double> alpha, int verbose = 1, int nabort = -1)

Function to generate optimal designs with mixed optimization approach

This function is beta code. See Doptimize for detauls of the parameters.

array_link optimDeff(const array_link &array, const arraydata_t &arrayclass, std::vector<double> alpha, int verbose = 1, coordinate_exchange_method_t optimmethod = DOPTIM_AUTOMATIC, int niter = 100000, int nabort = 0)

Optimize a design according to the optimization function specified.

Arguments:

Parameters:
  • array – Array to be optimized

  • arrayclass – Structure describing the design class

  • alpha – 3x1 array with optimization parameters

  • verbose – Verbosity level

  • optimmethod – Optimization method to use

  • niter – Number of iterations

  • nabort – Number of iterations after which to abort when no improvements are found

Returns:

Optimized designs

struct DoptimReturn
#include <Deff.h>

Structure containing results of the Doptimize function

Public Members

std::vector<std::vector<double>> dds

calculated efficiencies for the generated designs

arraylist_t designs

designs generated

int nrestarts

number of restarts performed

int _nimproved