13 #ifndef _OCRA_WEIGHTED_SQUARE_DISTANCE_FUNCTION_H_ 14 #define _OCRA_WEIGHTED_SQUARE_DISTANCE_FUNCTION_H_ 44 template <
class VectorBase>
47 template <
class VectorBase1,
class VectorBase2>
54 template <
class VectorBase>
59 template <
class VectorBase>
70 void doChangePi(
const MatrixXd& Pi,
int index = 0);
71 void doChangeqi(
const VectorXd& qi,
int index = 0);
88 template<
class VectorBase>
89 inline WeightedSquareDistanceFunction::WeightedSquareDistanceFunction(
Variable&
x,
double weight,
const VectorBase& reference)
96 ocra_assert(reference.rows()==1 || reference.cols()==1);
98 if (reference.size() != x.
getSize())
99 throw std::runtime_error(
"[WeightedSquareDistanceFunction::WeightedSquareDistanceFunction] size of reference does not match the size of the variable");
115 template <
class VectorBase1,
class VectorBase2>
116 inline WeightedSquareDistanceFunction::WeightedSquareDistanceFunction(
Variable&
x,
const VectorBase1& weight,
const VectorBase2& reference)
125 ocra_assert(reference.rows()==1 || reference.cols()==1);
127 if (reference.size() != x.
getSize())
128 throw std::runtime_error(
"[WeightedSquareDistanceFunction::WeightedSquareDistanceFunction] size of reference does not match the size of the variable");
129 if (weight.size() != x.
getSize())
130 throw std::runtime_error(
"[WeightedSquareDistanceFunction::WeightedSquareDistanceFunction] size of weight does not match the size of the variable");
137 if ((weight.array()>0).all())
139 else if ((weight.array()<0).all())
146 template <
class VectorBase>
150 throw std::runtime_error(
"[WeightedSquareDistanceFunction::changeWeight] size of weight does not match the size of the variable");
158 propagate<EVT_CHANGE_VALUE>();
162 template <
class VectorBase>
165 if (reference.size() !=
x.
getSize())
166 throw std::runtime_error(
"[WeightedSquareDistanceFunction::changeReference] size of reference does not match the size of the variable");
172 propagate<EVT_CHANGE_VALUE>();
181 #endif //_OCRA_WEIGHTED_SQUARE_DISTANCE_FUNCTION_H_ void doUpdateInputSizeEnd()
void changeReference(const VectorBase &reference)
const VectorXd & getWeight() const
void doChangeqi(const VectorXd &qi, int index=0)
QuadraticFunction functionType_t
Optimization-based Robot Controller namespace. a library of classes to write and solve optimization p...
void testWeightedSquareDistanceFunction()
This class represents a variable in a mathematical sense.
void doUpdateInputSizeBegin()
void changeWeight(double weight)
void updateJacobian() const
void changeConvexityProperty(eFunctionConvexity newProperty)
void doChangeri(double ri, int index=0)
#define ocra_assert(ocra_expression)
#define OCRA_STATIC_ASSERT_VECTOR_OR_DYNAMIC_MATRIX(TYPE)
WeightedSquareDistanceFunction class.
Declaration file of the QuadraticFunction class.
void doChangePi(const MatrixXd &Pi, int index=0)