Skip to content

Commit dc0e5b2

Browse files
committed
fix for boundary handling in Levenberg-M.
There was a problem where the optimisation got stuck as soon as it hit a parameter boundary. This is now fixed, but a more robust handling of small numerical differences is still needed.
1 parent a7ef0d1 commit dc0e5b2

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

copasi/optimization/COptMethodLevenbergMarquardt.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,9 @@ bool COptMethodLevenbergMarquardt::optimise()
184184

185185
size_t Stalled = 0;
186186

187+
mpParentTask->output(COutputInterface::MONITORING);
188+
189+
187190
for (mIteration = 0; (mIteration < mIterationLimit) && (nu != 0.0) && proceed();
188191
mIteration++, Stalled++)
189192
{
@@ -283,7 +286,7 @@ bool COptMethodLevenbergMarquardt::optimise()
283286

284287
COptItem & OptItem = *OptItemList[i];
285288
pointInParameterDomain &= OptItem.setItemValue(mCurrent[i], COptItem::CheckPolicyFlag::All);
286-
pointInParameterDomain &= (Target == mCurrent[i]);
289+
pointInParameterDomain &= ((Target == mCurrent[i]) || abs(mCurrent[i]-mBest[i])< 1e-10 );
287290

288291
if (!pointInParameterDomain)
289292
{

copasi/parameterFitting/CFitItem.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ class CFitItem : public COptItem
124124
friend std::ostream &operator<<(std::ostream &os, const CFitItem & o);
125125

126126
/**
127-
* Set the local value.
127+
* Set the local value. The value reference is changed if it is out of bounds
128128
* @param C_FLOAT64 & value
129129
* @param const CheckPolicyFlag & policy
130130
* @return bool success

0 commit comments

Comments
 (0)