Skip to content

Commit

Permalink
add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
a-zakir committed Sep 22, 2023
1 parent 0acbe28 commit 1be50fb
Showing 1 changed file with 37 additions and 3 deletions.
40 changes: 37 additions & 3 deletions src/solver/optimisation/constraints/ConstraintBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,16 @@ class VariableManager

} // namespace Variable

/*! this class build up a the business object 'Constraint',
Math:
|coeff11 coeff12 .. coeff1n||var1| |sign_1| |rhs1| |constraint1||sign_1||rhs1|
|.. .. ...||....| |......| |....| <===> |...........||......||....|
|coeffn1 coeffn2 .. coeffnn||varn| |sign_n| |rhsn| |constraintn||sign_n||rhsn|
it propose a set of methods to attach 'Variables' to the Constraint
ex: calling NTCDirect() implies adding Direct NTC Variable to the current Constraint
finally the build() method gather all variables and put them into the matrix
*/
class ConstraintBuilder
{
public:
Expand Down Expand Up @@ -294,6 +304,11 @@ class ConstraintBuilder
}
};

/*!
@brief set the the operator of the constraint (sign)
@param op: the operator of the constraint to op
@return reference of *this
*/
ConstraintBuilder& SetOperator(char op)
{
if (op == '<' || op == '=' || op == '>')
Expand All @@ -306,16 +321,33 @@ class ConstraintBuilder
return *this;
}

/*!
@brief set the sign of the constraint to '=',
building a constraint equal to rhs
@return reference of *this
*/
ConstraintBuilder& equalTo()
{
operator_ = '=';
return *this;
}

/*!
@brief set the sign of the constraint to '<',
building a constraint less than rhs
@return reference of *this
*/
ConstraintBuilder& lessThan()
{
operator_ = '<';
return *this;
}

/*!
@brief set the sign of the constraint to '>',
building a constraint greather than rhs
@return reference of *this
*/
ConstraintBuilder& greaterThan()
{
operator_ = '>';
Expand Down Expand Up @@ -344,13 +376,15 @@ class ConstraintBuilder
void AddVariable(int index, double coeff);

/*
@param offset: offset from the current time step
@param delta: number of time steps for the variable
@return VariableManager object
* @param offset: offset from the current time step
* @param delta: number of time steps for the variable
* @return VariableManager object
*/
Variable::VariableManager GetVariableManager(int offset = 0, int delta = 0);
};

/*! factory class to */
class ConstraintFactory
{
public:
Expand Down

0 comments on commit 1be50fb

Please sign in to comment.