78 const int layer = m-1;
82 double step = 1.0/(pnts-1.0);
87 return child.
generateWeights( n, weight, Weights, weightsLB, weightsUB, formers, layer, lastone, currentone, step );
117 double weight_test = 1.0;
118 for( run1 = 0; run1 < (int) weight.
getDim()-1; run1++ )
119 weight_test -= weight(run1);
121 if( ( weight_test >= weightsLB(layer) - 100.0*
EPS ) &&
122 ( weight_test <= weightsUB(layer) + 100.0*
EPS ) ){
124 if( currentOne >= 0 ){
128 for( run1 = 0; run1 < (int) formers.
getDim(); run1++ )
129 tmp(run1) = formers(run1);
131 tmp(formers.
getDim()) = lastOne;
133 lastOne = currentOne;
140 for( run1 = 0; run1 < (int) formers.
getDim(); run1++ )
141 tmp(run1) = formers(run1);
147 weight(n) = weight_test;
151 for( run1 = 0; run1 < (int) Weights.
getNumRows(); run1++ ){
152 for( run2 = 0; run2 < (int) Weights.
getNumCols(); run2++ )
153 tmp(run1,run2) = Weights(run1,run2);
156 for( run2 = 0; run2 < (int) weight.
getDim(); run2++ )
157 tmp(run2,Weights.
getNumCols()) = weight(run2);
166 double weight_test = weightsLB(n);
168 while( weight_test <= weightsUB(n) + 100.0*
EPS ){
170 if( n == layer-2 ) currentOne = Weights.
getNumCols()+1;
172 weight(n) = weight_test;
175 child.
generateWeights( n+1, weight, Weights, weightsLB, weightsUB, formers, layer, lastOne, currentOne, step );
177 weight_test += (weightsUB(n)-weightsLB(n))*step;
returnValue generateWeights(const int &n, DVector &weight, DMatrix &Weights, const DVector &weightsLB, const DVector &weightsUB, DVector &formers, const int &layer, int &lastOne, int ¤tOne, double &step) const
BEGIN_NAMESPACE_ACADO const double EPS
Generates weights for solving OCPs having multiple objectives.
Allows to pass back messages to the calling function.
#define CLOSE_NAMESPACE_ACADO
Derived & setZero(Index size)
unsigned getNumRows() const
returnValue getWeights(const int &m, const int &pnts, const DVector &weightsLB, const DVector &weightsUB, DMatrix &Weights, DVector &formers) const
unsigned getNumCols() const
#define BEGIN_NAMESPACE_ACADO
WeightGeneration & operator=(const WeightGeneration &arg)
virtual ~WeightGeneration()