Quintiq file version 2.0
|
#parent: #root
|
Method UpdateMinMaxCoefficient (
|
Real coefficient,
|
MPConstraint constr,
|
MPVariable variable
|
)
|
{
|
Description: 'Updates the minimum and maximum coefficient of this coefficientscaling'
|
TextBody:
|
[*
|
// Select the CoefficientScaling associated with this constraint and this variable
|
|
workaroundname := 'MP' + constr.Name() + 'Constraint';
|
constraintscalingtypename := CapacityPlanningSuboptimizer::GetConstraintScaleType( workaroundname ); // this is broken: typeofexpression( constr ).ShortName() );
|
variablescalingtypename := CapacityPlanningSuboptimizer::GetVariableScaleType( typeofexpression( variable ).ShortName() );
|
|
coefficientscaling := this.GetScalingType( constraintscalingtypename, variablescalingtypename );
|
|
// Update the min and max coefficient of this CoefficientScaling
|
coeff := abs( coefficient );
|
if( not isnull( coefficientscaling ) and coeff <> 0 and coeff.IsFinite() )
|
{
|
if( coeff < coefficientscaling.MinCoefficient() )
|
{
|
coefficientscaling.MinCoefficient( coeff );
|
coefficientscaling.ConstraintNameMinCoefficient( constr.Name() );
|
coefficientscaling.VariableNameMinCoefficient( variable.Name() );
|
}
|
if( coeff > coefficientscaling.MaxCoefficient() )
|
{
|
coefficientscaling.MaxCoefficient( coeff );
|
coefficientscaling.ConstraintNameMaxCoefficient( constr.Name() );
|
coefficientscaling.VariableNameMaxCoefficient( variable.Name() );
|
}
|
}
|
*]
|
}
|