<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Non-linear optimization fails when bounds constraints are applied in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Non-linear-optimization-fails-when-bounds-constraints-are/m-p/837765#M6206</link>
    <description>&lt;P&gt;Greetings,&lt;BR /&gt;&lt;BR /&gt;I am currently developing an application which requires the use of a non-linear solver. In our application, it would be beneficial to be able to place loose but definite bounds constraints on the possible solution set, and hence we were intending to use the bound-constrained version of the non-linear solver. However, after running some test cases, we have found that the bound-constrained solver will often fail to reach an appropriate solution, even in cases where the unconstrained solver would have no problem, and both the initial values and the desired solution were well within the bound-constraints placed on the solver. I am not an expert on non-linear solvers nor on MKL, so I am not sure if these undesired results are due to my misunderstanding of the problem formulation, or misapplication of the MKL library to this problem, or some other factor; if possible, could somebody perhaps indicate what is being done incorrectly in this situation.&lt;BR /&gt;&lt;BR /&gt;Here is an example test we have run (it is an intentionally trivial program, this is in no way reflective of our intended usage of the mkl solver in the application proper. I have provided a custom random function and pre-defined seed only so that it could immediately give a failure case for the purpose of illustration):&lt;BR /&gt;[bash]//general includes&lt;BR /&gt;#include &amp;lt;C:/Program Files/Intel/MKL/10.2.4.032/include/mkl.h&amp;gt;&lt;BR /&gt;#include &lt;BR /&gt;#include &lt;BR /&gt;#include &lt;BR /&gt;using namespace std;&lt;BR /&gt;&lt;BR /&gt;#define MKL_DIR "C:/Progra~1/Intel/MKL/10.2.4.032"&lt;BR /&gt;&lt;BR /&gt;//linking to the mkl libraries&lt;BR /&gt;#ifdef _WIN64&lt;BR /&gt;&lt;BR /&gt;#pragma comment( lib, MKL_DIR "/em64t/lib/mkl_intel_thread.lib" )&lt;BR /&gt;#pragma comment( lib, MKL_DIR "/em64t/lib/mkl_core.lib" )&lt;BR /&gt;#pragma comment( lib, MKL_DIR "/em64t/lib/libguide.lib" )&lt;BR /&gt;#pragma comment( lib, MKL_DIR "/em64t/lib/mkl_intel_lp64.lib" )&lt;BR /&gt;&lt;BR /&gt;#else&lt;BR /&gt;&lt;BR /&gt;#pragma comment( lib, MKL_DIR "/ia32/lib/mkl_intel_thread.lib" )&lt;BR /&gt;#pragma comment( lib, MKL_DIR "/ia32/lib/mkl_intel_c.lib" )&lt;BR /&gt;#pragma comment( lib, MKL_DIR "/ia32/lib/mkl_core.lib" )&lt;BR /&gt;#pragma comment( lib, MKL_DIR "/ia32/lib/libguide.lib" )&lt;BR /&gt;&lt;BR /&gt;#endif&lt;BR /&gt;&lt;BR /&gt;//custom random function provided to allow illustration of this case&lt;BR /&gt;//regardless of target system configuration&lt;BR /&gt;//from POSIX.1-2001&lt;BR /&gt;static unsigned int nextSeed = 1; &lt;BR /&gt;&lt;BR /&gt;void CustomSRand( unsigned int seed )&lt;BR /&gt;{&lt;BR /&gt; nextSeed = seed;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;int CustomRand()&lt;BR /&gt;{&lt;BR /&gt; nextSeed = nextSeed*1103515245 + 12345;&lt;BR /&gt; return int((nextSeed/65536) % RAND_MAX);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;//configuration parameters to the non-linear solvers (see mkl docs for details)&lt;BR /&gt;struct MKLNonLinearConfig&lt;BR /&gt;{&lt;BR /&gt; double epsilon[6];&lt;BR /&gt;&lt;BR /&gt; MKL_INT maxIterations;&lt;BR /&gt; MKL_INT maxTrialIterations;&lt;BR /&gt;&lt;BR /&gt; double initialStepBound;&lt;BR /&gt; double jacobianPrecision;&lt;BR /&gt;};&lt;BR /&gt;&lt;BR /&gt;//output data from the non-linear solvers&lt;BR /&gt;struct MKLNonLinearResults&lt;BR /&gt;{&lt;BR /&gt; MKL_INT iterationsUsed;&lt;BR /&gt; MKL_INT stopCriterion;&lt;BR /&gt; double initialResiduals;&lt;BR /&gt; double finalResiduals;&lt;BR /&gt;};&lt;BR /&gt;&lt;BR /&gt;//data used inside the objective function&lt;BR /&gt;struct NonLinearData&lt;BR /&gt;{&lt;BR /&gt; double targetAValue;&lt;BR /&gt; double targetBValue;&lt;BR /&gt; double lowerXBounds;&lt;BR /&gt; double upperXBounds;&lt;BR /&gt;};&lt;BR /&gt;&lt;BR /&gt;//a reasonably simple non-linear function: 'a' and 'b' are the parameters&lt;BR /&gt;//I want to solve for, x is the position to evaluate the function at&lt;BR /&gt;double NonLinearFunction( double a, double b, double x ) &lt;BR /&gt;{&lt;BR /&gt; return a*std::exp( -b*x );&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;//this objective will sample a number of points between the bounds specified in the user data, and give the residuals for&lt;BR /&gt;//the solver's current parameters compared to the target parameters&lt;BR /&gt;void MKLObjective( MKL_INT* pNumResiduals, MKL_INT* pNumParams, double* params, double* residuals, void* userData )&lt;BR /&gt;{&lt;BR /&gt; const NonLinearData* data = static_cast( userData );&lt;BR /&gt;&lt;BR /&gt; const double stepIncrement = (data-&amp;gt;upperXBounds - data-&amp;gt;lowerXBounds) / ((*pNumResiduals)-1);&lt;BR /&gt;&lt;BR /&gt; assert( *pNumParams == 2 );&lt;BR /&gt;&lt;BR /&gt; double currentX = data-&amp;gt;lowerXBounds;&lt;BR /&gt;&lt;BR /&gt; for ( size_t i = 0; i &amp;lt; size_t(*pNumResiduals); ++i )&lt;BR /&gt; {&lt;BR /&gt; residuals&lt;I&gt; = NonLinearFunction( data-&amp;gt;targetAValue, data-&amp;gt;targetBValue, currentX ) - NonLinearFunction( params[0], params[1], currentX );&lt;BR /&gt; currentX += stepIncrement;&lt;BR /&gt; }&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;//solver without bounds constraints&lt;BR /&gt;void MKLNonLinearSolve( MKL_INT numParams, MKL_INT numResiduals, MKLNonLinearConfig* config, NonLinearData* userData, double* inoutParams, MKLNonLinearResults* results )&lt;BR /&gt;{&lt;BR /&gt; double* residuals = new double[numResiduals];&lt;BR /&gt; double* jacobian = new double[numParams*numResiduals];&lt;BR /&gt;&lt;BR /&gt; _TRNSP_HANDLE_t mklOperationHandle = 0;&lt;BR /&gt;&lt;BR /&gt; MKL_INT initResult = dtrnlsp_init( &amp;amp;mklOperationHandle, &amp;amp;numParams, &amp;amp;numResiduals, inoutParams, config-&amp;gt;epsilon, &amp;amp;config-&amp;gt;maxIterations, &amp;amp;config-&amp;gt;maxTrialIterations, &amp;amp;config-&amp;gt;initialStepBound );&lt;BR /&gt; assert( initResult == TR_SUCCESS );&lt;BR /&gt;&lt;BR /&gt; MKL_INT rciRequest = 0;&lt;BR /&gt;&lt;BR /&gt; do&lt;BR /&gt; {&lt;BR /&gt; MKL_INT solveResult = dtrnlsp_solve( &amp;amp;mklOperationHandle, residuals, jacobian, &amp;amp;rciRequest );&lt;BR /&gt; assert( solveResult == TR_SUCCESS );&lt;BR /&gt;&lt;BR /&gt; switch( rciRequest )&lt;BR /&gt; {&lt;BR /&gt; case 1:&lt;BR /&gt; MKLObjective( &amp;amp;numResiduals, &amp;amp;numParams, inoutParams, residuals, static_cast(userData) );&lt;BR /&gt; break;&lt;BR /&gt; case 2:&lt;BR /&gt; MKL_INT jacobianResult = djacobix( &amp;amp;MKLObjective, &amp;amp;numParams, &amp;amp;numResiduals, jacobian, inoutParams, &amp;amp;config-&amp;gt;jacobianPrecision, static_cast(userData) );&lt;BR /&gt; assert( jacobianResult == TR_SUCCESS );&lt;BR /&gt; break;&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; while( rciRequest &amp;gt;= 0 );&lt;BR /&gt;&lt;BR /&gt; MKL_INT getResult = dtrnlsp_get( &amp;amp;mklOperationHandle, &amp;amp;results-&amp;gt;iterationsUsed, &amp;amp;results-&amp;gt;stopCriterion, &amp;amp;results-&amp;gt;initialResiduals, &amp;amp;results-&amp;gt;finalResiduals );&lt;BR /&gt; assert( getResult == TR_SUCCESS );&lt;BR /&gt;&lt;BR /&gt; MKL_INT deleteResult = dtrnlsp_delete( &amp;amp;mklOperationHandle );&lt;BR /&gt; assert( deleteResult == TR_SUCCESS );&lt;BR /&gt;&lt;BR /&gt; delete [] residuals;&lt;BR /&gt; delete [] jacobian;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;//solver with bounds constraints&lt;BR /&gt;void MKLNonLinearSolveWithConstraints( MKL_INT numParams, MKL_INT numResiduals, MKLNonLinearConfig* config, NonLinearData* userData, double* lowerBounds, double* upperBounds, double* inoutParams, MKLNonLinearResults* results )&lt;BR /&gt;{&lt;BR /&gt; double* residuals = new double[numResiduals];&lt;BR /&gt; double* jacobian = new double[numParams*numResiduals];&lt;BR /&gt;&lt;BR /&gt; _TRNSPBC_HANDLE_t mklOperationHandle = 0;&lt;BR /&gt;&lt;BR /&gt; MKL_INT initResult = dtrnlspbc_init( &amp;amp;mklOperationHandle, &amp;amp;numParams, &amp;amp;numResiduals, inoutParams, lowerBounds, upperBounds, config-&amp;gt;epsilon, &amp;amp;config-&amp;gt;maxIterations, &amp;amp;config-&amp;gt;maxTrialIterations, &amp;amp;config-&amp;gt;initialStepBound );&lt;BR /&gt; assert( initResult == TR_SUCCESS );&lt;BR /&gt;&lt;BR /&gt; MKL_INT rciRequest = 0;&lt;BR /&gt;&lt;BR /&gt; do&lt;BR /&gt; {&lt;BR /&gt; MKL_INT solveResult = dtrnlspbc_solve( &amp;amp;mklOperationHandle, residuals, jacobian, &amp;amp;rciRequest );&lt;BR /&gt;&lt;BR /&gt; assert( solveResult == TR_SUCCESS );&lt;BR /&gt;&lt;BR /&gt; switch( rciRequest )&lt;BR /&gt; {&lt;BR /&gt; case 1:&lt;BR /&gt; MKLObjective( &amp;amp;numResiduals, &amp;amp;numParams, inoutParams, residuals, static_cast(userData) );&lt;BR /&gt; break;&lt;BR /&gt; case 2:&lt;BR /&gt; MKL_INT jacobianResult = djacobix( &amp;amp;MKLObjective, &amp;amp;numParams, &amp;amp;numResiduals, jacobian, inoutParams, &amp;amp;config-&amp;gt;jacobianPrecision, static_cast(userData) );&lt;BR /&gt; assert( jacobianResult == TR_SUCCESS );&lt;BR /&gt; break;&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; while( rciRequest &amp;gt;= 0 );&lt;BR /&gt;&lt;BR /&gt; MKL_INT getResult = dtrnlspbc_get( &amp;amp;mklOperationHandle, &amp;amp;results-&amp;gt;iterationsUsed, &amp;amp;results-&amp;gt;stopCriterion, &amp;amp;results-&amp;gt;initialResiduals, &amp;amp;results-&amp;gt;finalResiduals );&lt;BR /&gt; assert( getResult == TR_SUCCESS );&lt;BR /&gt;&lt;BR /&gt; MKL_INT deleteResult = dtrnlspbc_delete( &amp;amp;mklOperationHandle );&lt;BR /&gt; assert( deleteResult == TR_SUCCESS );&lt;BR /&gt;&lt;BR /&gt; delete [] residuals;&lt;BR /&gt; delete [] jacobian;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;//a utility function to create random double values&lt;BR /&gt;double randomDouble( double lowerBound, double upperBound )&lt;BR /&gt;{&lt;BR /&gt; return lowerBound + ((upperBound - lowerBound) * (double(CustomRand()) / double(RAND_MAX)));&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;///Entry Point///&lt;BR /&gt;int main( int argc, char** argv )&lt;BR /&gt;{&lt;BR /&gt; //this seed will give a failure condition on the first iteration&lt;BR /&gt; unsigned int randomSeed = 1271347576;&lt;BR /&gt; CustomSRand( randomSeed );&lt;BR /&gt;&lt;BR /&gt; //specify the configuration parameters&lt;BR /&gt; MKLNonLinearConfig config;&lt;BR /&gt;&lt;BR /&gt; config.maxIterations = 1000;&lt;BR /&gt; config.maxTrialIterations = 1000;&lt;BR /&gt; config.epsilon[0] = 0.00001;&lt;BR /&gt; config.epsilon[1] = 0.00001;&lt;BR /&gt; config.epsilon[2] = 0.00001;&lt;BR /&gt; config.epsilon[3] = 0.00001;&lt;BR /&gt; config.epsilon[4] = 0.00001;&lt;BR /&gt; config.epsilon[5] = 0.00001;&lt;BR /&gt; config.initialStepBound = 100.0;&lt;BR /&gt; config.jacobianPrecision = 0.00001;&lt;BR /&gt;&lt;BR /&gt; //specify the data to be used in the objective function&lt;BR /&gt; NonLinearData userData;&lt;BR /&gt;&lt;BR /&gt; userData.targetAValue = randomDouble( -10.0, 10.0 );&lt;BR /&gt; userData.targetBValue = randomDouble( -3.0, 3.0 );&lt;BR /&gt; userData.lowerXBounds = -3.0;&lt;BR /&gt; userData.upperXBounds = 3.0;&lt;BR /&gt;&lt;BR /&gt; //set up the starting paramters based on the target data&lt;BR /&gt; //(I keep a copy of the starting data for comparison at the end)&lt;BR /&gt; double startingParameters[2];&lt;BR /&gt;&lt;BR /&gt; double unconstrainedSolverResults[2];&lt;BR /&gt; double constrainedSolverResults[2];&lt;BR /&gt;&lt;BR /&gt; startingParameters[0] = userData.targetAValue * randomDouble( 0.5, 1.5 );&lt;BR /&gt; startingParameters[1] = userData.targetBValue * randomDouble( 0.5, 1.5 );&lt;BR /&gt;&lt;BR /&gt; //place loose constraints on the parameters&lt;BR /&gt; double lowerBounds[2] = { -100.0, -100.0 };&lt;BR /&gt; double upperBounds[2] = { 100.0, 100.0 };&lt;BR /&gt;&lt;BR /&gt; MKLNonLinearResults unconstrainedResults;&lt;BR /&gt; MKLNonLinearResults constrainedResults;&lt;BR /&gt;&lt;BR /&gt; std::memcpy( unconstrainedSolverResults, startingParameters, sizeof(double)*2 );&lt;BR /&gt; MKLNonLinearSolve( 2, 10, &amp;amp;config, &amp;amp;userData, unconstrainedSolverResults, &amp;amp;unconstrainedResults );&lt;BR /&gt;&lt;BR /&gt; std::memcpy( constrainedSolverResults, startingParameters, sizeof(double)*2 );&lt;BR /&gt; MKLNonLinearSolveWithConstraints( 2, 10, &amp;amp;config, &amp;amp;userData, lowerBounds, upperBounds, constrainedSolverResults, &amp;amp;constrainedResults );&lt;BR /&gt;&lt;BR /&gt; std::cout &amp;lt;&amp;lt; "Seed = " &amp;lt;&amp;lt; randomSeed &amp;lt;&amp;lt; std::endl;&lt;BR /&gt; std::cout &amp;lt;&amp;lt; std::endl;&lt;BR /&gt; std::cout &amp;lt;&amp;lt; "Unconstrained Solver:" &amp;lt;&amp;lt; std::endl;&lt;BR /&gt; std::cout &amp;lt;&amp;lt; "Initial Parameters: a = " &amp;lt;&amp;lt; startingParameters[0] &amp;lt;&amp;lt; "\tb = " &amp;lt;&amp;lt; startingParameters[1] &amp;lt;&amp;lt; std::endl;&lt;BR /&gt; std::cout &amp;lt;&amp;lt; "Final Parameters: a = " &amp;lt;&amp;lt; unconstrainedSolverResults[0] &amp;lt;&amp;lt; "\tb = " &amp;lt;&amp;lt; unconstrainedSolverResults[1] &amp;lt;&amp;lt; std::endl;&lt;BR /&gt; std::cout &amp;lt;&amp;lt; "Target Parameters: a = " &amp;lt;&amp;lt; userData.targetAValue &amp;lt;&amp;lt; "\tb = " &amp;lt;&amp;lt; userData.targetBValue &amp;lt;&amp;lt; std::endl;&lt;BR /&gt; std::cout &amp;lt;&amp;lt; "Results: Iterations = " &amp;lt;&amp;lt; unconstrainedResults.iterationsUsed &amp;lt;&amp;lt; " Stop Condition = " &amp;lt;&amp;lt; unconstrainedResults.stopCriterion &amp;lt;&amp;lt; std::endl;&lt;BR /&gt; std::cout &amp;lt;&amp;lt; "Initial Residuals = " &amp;lt;&amp;lt; unconstrainedResults.initialResiduals &amp;lt;&amp;lt; " Final Residuals = " &amp;lt;&amp;lt; unconstrainedResults.finalResiduals &amp;lt;&amp;lt; std::endl;&lt;BR /&gt; std::cout &amp;lt;&amp;lt; std::endl;&lt;BR /&gt; std::cout &amp;lt;&amp;lt; "Constrained Solver:" &amp;lt;&amp;lt; std::endl;&lt;BR /&gt; std::cout &amp;lt;&amp;lt; "Initial Parameters: a = " &amp;lt;&amp;lt; startingParameters[0] &amp;lt;&amp;lt; "\tb = " &amp;lt;&amp;lt; startingParameters[1] &amp;lt;&amp;lt; std::endl;&lt;BR /&gt; std::cout &amp;lt;&amp;lt; "Final Parameters: a = " &amp;lt;&amp;lt; constrainedSolverResults[0] &amp;lt;&amp;lt; "\tb = " &amp;lt;&amp;lt; constrainedSolverResults[1] &amp;lt;&amp;lt; std::endl;&lt;BR /&gt; std::cout &amp;lt;&amp;lt; "Target Parameters: a = " &amp;lt;&amp;lt; userData.targetAValue &amp;lt;&amp;lt; "\tb = " &amp;lt;&amp;lt; userData.targetBValue &amp;lt;&amp;lt; std::endl;&lt;BR /&gt; std::cout &amp;lt;&amp;lt; "Results: Iterations = " &amp;lt;&amp;lt; constrainedResults.iterationsUsed &amp;lt;&amp;lt; " Stop Condition = " &amp;lt;&amp;lt; constrainedResults.stopCriterion &amp;lt;&amp;lt; std::endl;&lt;BR /&gt; std::cout &amp;lt;&amp;lt; "Initial Residuals = " &amp;lt;&amp;lt; constrainedResults.initialResiduals &amp;lt;&amp;lt; " Final Residuals = " &amp;lt;&amp;lt; constrainedResults.finalResiduals &amp;lt;&amp;lt; std::endl;&lt;BR /&gt;&lt;BR /&gt; return 0;&lt;BR /&gt;}[/bash] &lt;BR /&gt;When run, it gives the following results:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Seed = 1271347576&lt;BR /&gt;&lt;BR /&gt;Unconstrained Solver:&lt;BR /&gt;Initial Parameters: a = 3.69707 b = -1.66525&lt;BR /&gt;Final Parameters: a = 5.33677 b = -2.29319&lt;BR /&gt;Target Parameters: a = 5.33677 b = -2.29319&lt;BR /&gt;Results: Iterations = 14 Stop Condition = 3&lt;BR /&gt;Initial Residuals = 4740.99 Final Residuals = 5.13598e-006&lt;BR /&gt;&lt;BR /&gt;Constrained Solver:&lt;BR /&gt;Initial Parameters: a = 3.69707 b = -1.66525&lt;BR /&gt;Final Parameters: a = 3.73313 b = -2.03975&lt;BR /&gt;Target Parameters: a = 5.33677 b = -2.29319&lt;BR /&gt;Results: Iterations = 11 Stop Condition = 2&lt;BR /&gt;Initial Residuals = 4740.99 Final Residuals = 3561.57&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Needless to say, I'm rather confused about why the addition of bounds constraints changed the result of the solver, and prevented it from finding an appropriate solution, when otherwise all other paramters to the solver were the same. I have also had similar problems when I trying to tightly constrain some of the parameters by setting the upper and lower bounds to be equal, in which case the solver would frequently outright ignore not only those tightly constrained bounds, but all bounds constraints provided and return with an absolutely insane solution. Is there something I am doing incorrectly, or some aspect of the solver that I am not correctly taking into account? And is it incorrect to specify the an equal value for both the upper and lower bounds constraints on a given parameter, or must there always besome non-empty range between them for the solver to work correctly?&lt;BR /&gt;&lt;BR /&gt;Thank you for your time&lt;BR /&gt;- Stephen Kiazyk&lt;BR /&gt;&lt;BR /&gt;Edit: my apologies, I cannot seem to get angle brackets to work at all, hopefully the code is still clear.&lt;/I&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 19 Apr 2010 14:13:52 GMT</pubDate>
    <dc:creator>stephen_kiazyk</dc:creator>
    <dc:date>2010-04-19T14:13:52Z</dc:date>
    <item>
      <title>Non-linear optimization fails when bounds constraints are applied</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Non-linear-optimization-fails-when-bounds-constraints-are/m-p/837765#M6206</link>
      <description>&lt;P&gt;Greetings,&lt;BR /&gt;&lt;BR /&gt;I am currently developing an application which requires the use of a non-linear solver. In our application, it would be beneficial to be able to place loose but definite bounds constraints on the possible solution set, and hence we were intending to use the bound-constrained version of the non-linear solver. However, after running some test cases, we have found that the bound-constrained solver will often fail to reach an appropriate solution, even in cases where the unconstrained solver would have no problem, and both the initial values and the desired solution were well within the bound-constraints placed on the solver. I am not an expert on non-linear solvers nor on MKL, so I am not sure if these undesired results are due to my misunderstanding of the problem formulation, or misapplication of the MKL library to this problem, or some other factor; if possible, could somebody perhaps indicate what is being done incorrectly in this situation.&lt;BR /&gt;&lt;BR /&gt;Here is an example test we have run (it is an intentionally trivial program, this is in no way reflective of our intended usage of the mkl solver in the application proper. I have provided a custom random function and pre-defined seed only so that it could immediately give a failure case for the purpose of illustration):&lt;BR /&gt;[bash]//general includes&lt;BR /&gt;#include &amp;lt;C:/Program Files/Intel/MKL/10.2.4.032/include/mkl.h&amp;gt;&lt;BR /&gt;#include &lt;BR /&gt;#include &lt;BR /&gt;#include &lt;BR /&gt;using namespace std;&lt;BR /&gt;&lt;BR /&gt;#define MKL_DIR "C:/Progra~1/Intel/MKL/10.2.4.032"&lt;BR /&gt;&lt;BR /&gt;//linking to the mkl libraries&lt;BR /&gt;#ifdef _WIN64&lt;BR /&gt;&lt;BR /&gt;#pragma comment( lib, MKL_DIR "/em64t/lib/mkl_intel_thread.lib" )&lt;BR /&gt;#pragma comment( lib, MKL_DIR "/em64t/lib/mkl_core.lib" )&lt;BR /&gt;#pragma comment( lib, MKL_DIR "/em64t/lib/libguide.lib" )&lt;BR /&gt;#pragma comment( lib, MKL_DIR "/em64t/lib/mkl_intel_lp64.lib" )&lt;BR /&gt;&lt;BR /&gt;#else&lt;BR /&gt;&lt;BR /&gt;#pragma comment( lib, MKL_DIR "/ia32/lib/mkl_intel_thread.lib" )&lt;BR /&gt;#pragma comment( lib, MKL_DIR "/ia32/lib/mkl_intel_c.lib" )&lt;BR /&gt;#pragma comment( lib, MKL_DIR "/ia32/lib/mkl_core.lib" )&lt;BR /&gt;#pragma comment( lib, MKL_DIR "/ia32/lib/libguide.lib" )&lt;BR /&gt;&lt;BR /&gt;#endif&lt;BR /&gt;&lt;BR /&gt;//custom random function provided to allow illustration of this case&lt;BR /&gt;//regardless of target system configuration&lt;BR /&gt;//from POSIX.1-2001&lt;BR /&gt;static unsigned int nextSeed = 1; &lt;BR /&gt;&lt;BR /&gt;void CustomSRand( unsigned int seed )&lt;BR /&gt;{&lt;BR /&gt; nextSeed = seed;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;int CustomRand()&lt;BR /&gt;{&lt;BR /&gt; nextSeed = nextSeed*1103515245 + 12345;&lt;BR /&gt; return int((nextSeed/65536) % RAND_MAX);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;//configuration parameters to the non-linear solvers (see mkl docs for details)&lt;BR /&gt;struct MKLNonLinearConfig&lt;BR /&gt;{&lt;BR /&gt; double epsilon[6];&lt;BR /&gt;&lt;BR /&gt; MKL_INT maxIterations;&lt;BR /&gt; MKL_INT maxTrialIterations;&lt;BR /&gt;&lt;BR /&gt; double initialStepBound;&lt;BR /&gt; double jacobianPrecision;&lt;BR /&gt;};&lt;BR /&gt;&lt;BR /&gt;//output data from the non-linear solvers&lt;BR /&gt;struct MKLNonLinearResults&lt;BR /&gt;{&lt;BR /&gt; MKL_INT iterationsUsed;&lt;BR /&gt; MKL_INT stopCriterion;&lt;BR /&gt; double initialResiduals;&lt;BR /&gt; double finalResiduals;&lt;BR /&gt;};&lt;BR /&gt;&lt;BR /&gt;//data used inside the objective function&lt;BR /&gt;struct NonLinearData&lt;BR /&gt;{&lt;BR /&gt; double targetAValue;&lt;BR /&gt; double targetBValue;&lt;BR /&gt; double lowerXBounds;&lt;BR /&gt; double upperXBounds;&lt;BR /&gt;};&lt;BR /&gt;&lt;BR /&gt;//a reasonably simple non-linear function: 'a' and 'b' are the parameters&lt;BR /&gt;//I want to solve for, x is the position to evaluate the function at&lt;BR /&gt;double NonLinearFunction( double a, double b, double x ) &lt;BR /&gt;{&lt;BR /&gt; return a*std::exp( -b*x );&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;//this objective will sample a number of points between the bounds specified in the user data, and give the residuals for&lt;BR /&gt;//the solver's current parameters compared to the target parameters&lt;BR /&gt;void MKLObjective( MKL_INT* pNumResiduals, MKL_INT* pNumParams, double* params, double* residuals, void* userData )&lt;BR /&gt;{&lt;BR /&gt; const NonLinearData* data = static_cast( userData );&lt;BR /&gt;&lt;BR /&gt; const double stepIncrement = (data-&amp;gt;upperXBounds - data-&amp;gt;lowerXBounds) / ((*pNumResiduals)-1);&lt;BR /&gt;&lt;BR /&gt; assert( *pNumParams == 2 );&lt;BR /&gt;&lt;BR /&gt; double currentX = data-&amp;gt;lowerXBounds;&lt;BR /&gt;&lt;BR /&gt; for ( size_t i = 0; i &amp;lt; size_t(*pNumResiduals); ++i )&lt;BR /&gt; {&lt;BR /&gt; residuals&lt;I&gt; = NonLinearFunction( data-&amp;gt;targetAValue, data-&amp;gt;targetBValue, currentX ) - NonLinearFunction( params[0], params[1], currentX );&lt;BR /&gt; currentX += stepIncrement;&lt;BR /&gt; }&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;//solver without bounds constraints&lt;BR /&gt;void MKLNonLinearSolve( MKL_INT numParams, MKL_INT numResiduals, MKLNonLinearConfig* config, NonLinearData* userData, double* inoutParams, MKLNonLinearResults* results )&lt;BR /&gt;{&lt;BR /&gt; double* residuals = new double[numResiduals];&lt;BR /&gt; double* jacobian = new double[numParams*numResiduals];&lt;BR /&gt;&lt;BR /&gt; _TRNSP_HANDLE_t mklOperationHandle = 0;&lt;BR /&gt;&lt;BR /&gt; MKL_INT initResult = dtrnlsp_init( &amp;amp;mklOperationHandle, &amp;amp;numParams, &amp;amp;numResiduals, inoutParams, config-&amp;gt;epsilon, &amp;amp;config-&amp;gt;maxIterations, &amp;amp;config-&amp;gt;maxTrialIterations, &amp;amp;config-&amp;gt;initialStepBound );&lt;BR /&gt; assert( initResult == TR_SUCCESS );&lt;BR /&gt;&lt;BR /&gt; MKL_INT rciRequest = 0;&lt;BR /&gt;&lt;BR /&gt; do&lt;BR /&gt; {&lt;BR /&gt; MKL_INT solveResult = dtrnlsp_solve( &amp;amp;mklOperationHandle, residuals, jacobian, &amp;amp;rciRequest );&lt;BR /&gt; assert( solveResult == TR_SUCCESS );&lt;BR /&gt;&lt;BR /&gt; switch( rciRequest )&lt;BR /&gt; {&lt;BR /&gt; case 1:&lt;BR /&gt; MKLObjective( &amp;amp;numResiduals, &amp;amp;numParams, inoutParams, residuals, static_cast(userData) );&lt;BR /&gt; break;&lt;BR /&gt; case 2:&lt;BR /&gt; MKL_INT jacobianResult = djacobix( &amp;amp;MKLObjective, &amp;amp;numParams, &amp;amp;numResiduals, jacobian, inoutParams, &amp;amp;config-&amp;gt;jacobianPrecision, static_cast(userData) );&lt;BR /&gt; assert( jacobianResult == TR_SUCCESS );&lt;BR /&gt; break;&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; while( rciRequest &amp;gt;= 0 );&lt;BR /&gt;&lt;BR /&gt; MKL_INT getResult = dtrnlsp_get( &amp;amp;mklOperationHandle, &amp;amp;results-&amp;gt;iterationsUsed, &amp;amp;results-&amp;gt;stopCriterion, &amp;amp;results-&amp;gt;initialResiduals, &amp;amp;results-&amp;gt;finalResiduals );&lt;BR /&gt; assert( getResult == TR_SUCCESS );&lt;BR /&gt;&lt;BR /&gt; MKL_INT deleteResult = dtrnlsp_delete( &amp;amp;mklOperationHandle );&lt;BR /&gt; assert( deleteResult == TR_SUCCESS );&lt;BR /&gt;&lt;BR /&gt; delete [] residuals;&lt;BR /&gt; delete [] jacobian;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;//solver with bounds constraints&lt;BR /&gt;void MKLNonLinearSolveWithConstraints( MKL_INT numParams, MKL_INT numResiduals, MKLNonLinearConfig* config, NonLinearData* userData, double* lowerBounds, double* upperBounds, double* inoutParams, MKLNonLinearResults* results )&lt;BR /&gt;{&lt;BR /&gt; double* residuals = new double[numResiduals];&lt;BR /&gt; double* jacobian = new double[numParams*numResiduals];&lt;BR /&gt;&lt;BR /&gt; _TRNSPBC_HANDLE_t mklOperationHandle = 0;&lt;BR /&gt;&lt;BR /&gt; MKL_INT initResult = dtrnlspbc_init( &amp;amp;mklOperationHandle, &amp;amp;numParams, &amp;amp;numResiduals, inoutParams, lowerBounds, upperBounds, config-&amp;gt;epsilon, &amp;amp;config-&amp;gt;maxIterations, &amp;amp;config-&amp;gt;maxTrialIterations, &amp;amp;config-&amp;gt;initialStepBound );&lt;BR /&gt; assert( initResult == TR_SUCCESS );&lt;BR /&gt;&lt;BR /&gt; MKL_INT rciRequest = 0;&lt;BR /&gt;&lt;BR /&gt; do&lt;BR /&gt; {&lt;BR /&gt; MKL_INT solveResult = dtrnlspbc_solve( &amp;amp;mklOperationHandle, residuals, jacobian, &amp;amp;rciRequest );&lt;BR /&gt;&lt;BR /&gt; assert( solveResult == TR_SUCCESS );&lt;BR /&gt;&lt;BR /&gt; switch( rciRequest )&lt;BR /&gt; {&lt;BR /&gt; case 1:&lt;BR /&gt; MKLObjective( &amp;amp;numResiduals, &amp;amp;numParams, inoutParams, residuals, static_cast(userData) );&lt;BR /&gt; break;&lt;BR /&gt; case 2:&lt;BR /&gt; MKL_INT jacobianResult = djacobix( &amp;amp;MKLObjective, &amp;amp;numParams, &amp;amp;numResiduals, jacobian, inoutParams, &amp;amp;config-&amp;gt;jacobianPrecision, static_cast(userData) );&lt;BR /&gt; assert( jacobianResult == TR_SUCCESS );&lt;BR /&gt; break;&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; while( rciRequest &amp;gt;= 0 );&lt;BR /&gt;&lt;BR /&gt; MKL_INT getResult = dtrnlspbc_get( &amp;amp;mklOperationHandle, &amp;amp;results-&amp;gt;iterationsUsed, &amp;amp;results-&amp;gt;stopCriterion, &amp;amp;results-&amp;gt;initialResiduals, &amp;amp;results-&amp;gt;finalResiduals );&lt;BR /&gt; assert( getResult == TR_SUCCESS );&lt;BR /&gt;&lt;BR /&gt; MKL_INT deleteResult = dtrnlspbc_delete( &amp;amp;mklOperationHandle );&lt;BR /&gt; assert( deleteResult == TR_SUCCESS );&lt;BR /&gt;&lt;BR /&gt; delete [] residuals;&lt;BR /&gt; delete [] jacobian;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;//a utility function to create random double values&lt;BR /&gt;double randomDouble( double lowerBound, double upperBound )&lt;BR /&gt;{&lt;BR /&gt; return lowerBound + ((upperBound - lowerBound) * (double(CustomRand()) / double(RAND_MAX)));&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;///Entry Point///&lt;BR /&gt;int main( int argc, char** argv )&lt;BR /&gt;{&lt;BR /&gt; //this seed will give a failure condition on the first iteration&lt;BR /&gt; unsigned int randomSeed = 1271347576;&lt;BR /&gt; CustomSRand( randomSeed );&lt;BR /&gt;&lt;BR /&gt; //specify the configuration parameters&lt;BR /&gt; MKLNonLinearConfig config;&lt;BR /&gt;&lt;BR /&gt; config.maxIterations = 1000;&lt;BR /&gt; config.maxTrialIterations = 1000;&lt;BR /&gt; config.epsilon[0] = 0.00001;&lt;BR /&gt; config.epsilon[1] = 0.00001;&lt;BR /&gt; config.epsilon[2] = 0.00001;&lt;BR /&gt; config.epsilon[3] = 0.00001;&lt;BR /&gt; config.epsilon[4] = 0.00001;&lt;BR /&gt; config.epsilon[5] = 0.00001;&lt;BR /&gt; config.initialStepBound = 100.0;&lt;BR /&gt; config.jacobianPrecision = 0.00001;&lt;BR /&gt;&lt;BR /&gt; //specify the data to be used in the objective function&lt;BR /&gt; NonLinearData userData;&lt;BR /&gt;&lt;BR /&gt; userData.targetAValue = randomDouble( -10.0, 10.0 );&lt;BR /&gt; userData.targetBValue = randomDouble( -3.0, 3.0 );&lt;BR /&gt; userData.lowerXBounds = -3.0;&lt;BR /&gt; userData.upperXBounds = 3.0;&lt;BR /&gt;&lt;BR /&gt; //set up the starting paramters based on the target data&lt;BR /&gt; //(I keep a copy of the starting data for comparison at the end)&lt;BR /&gt; double startingParameters[2];&lt;BR /&gt;&lt;BR /&gt; double unconstrainedSolverResults[2];&lt;BR /&gt; double constrainedSolverResults[2];&lt;BR /&gt;&lt;BR /&gt; startingParameters[0] = userData.targetAValue * randomDouble( 0.5, 1.5 );&lt;BR /&gt; startingParameters[1] = userData.targetBValue * randomDouble( 0.5, 1.5 );&lt;BR /&gt;&lt;BR /&gt; //place loose constraints on the parameters&lt;BR /&gt; double lowerBounds[2] = { -100.0, -100.0 };&lt;BR /&gt; double upperBounds[2] = { 100.0, 100.0 };&lt;BR /&gt;&lt;BR /&gt; MKLNonLinearResults unconstrainedResults;&lt;BR /&gt; MKLNonLinearResults constrainedResults;&lt;BR /&gt;&lt;BR /&gt; std::memcpy( unconstrainedSolverResults, startingParameters, sizeof(double)*2 );&lt;BR /&gt; MKLNonLinearSolve( 2, 10, &amp;amp;config, &amp;amp;userData, unconstrainedSolverResults, &amp;amp;unconstrainedResults );&lt;BR /&gt;&lt;BR /&gt; std::memcpy( constrainedSolverResults, startingParameters, sizeof(double)*2 );&lt;BR /&gt; MKLNonLinearSolveWithConstraints( 2, 10, &amp;amp;config, &amp;amp;userData, lowerBounds, upperBounds, constrainedSolverResults, &amp;amp;constrainedResults );&lt;BR /&gt;&lt;BR /&gt; std::cout &amp;lt;&amp;lt; "Seed = " &amp;lt;&amp;lt; randomSeed &amp;lt;&amp;lt; std::endl;&lt;BR /&gt; std::cout &amp;lt;&amp;lt; std::endl;&lt;BR /&gt; std::cout &amp;lt;&amp;lt; "Unconstrained Solver:" &amp;lt;&amp;lt; std::endl;&lt;BR /&gt; std::cout &amp;lt;&amp;lt; "Initial Parameters: a = " &amp;lt;&amp;lt; startingParameters[0] &amp;lt;&amp;lt; "\tb = " &amp;lt;&amp;lt; startingParameters[1] &amp;lt;&amp;lt; std::endl;&lt;BR /&gt; std::cout &amp;lt;&amp;lt; "Final Parameters: a = " &amp;lt;&amp;lt; unconstrainedSolverResults[0] &amp;lt;&amp;lt; "\tb = " &amp;lt;&amp;lt; unconstrainedSolverResults[1] &amp;lt;&amp;lt; std::endl;&lt;BR /&gt; std::cout &amp;lt;&amp;lt; "Target Parameters: a = " &amp;lt;&amp;lt; userData.targetAValue &amp;lt;&amp;lt; "\tb = " &amp;lt;&amp;lt; userData.targetBValue &amp;lt;&amp;lt; std::endl;&lt;BR /&gt; std::cout &amp;lt;&amp;lt; "Results: Iterations = " &amp;lt;&amp;lt; unconstrainedResults.iterationsUsed &amp;lt;&amp;lt; " Stop Condition = " &amp;lt;&amp;lt; unconstrainedResults.stopCriterion &amp;lt;&amp;lt; std::endl;&lt;BR /&gt; std::cout &amp;lt;&amp;lt; "Initial Residuals = " &amp;lt;&amp;lt; unconstrainedResults.initialResiduals &amp;lt;&amp;lt; " Final Residuals = " &amp;lt;&amp;lt; unconstrainedResults.finalResiduals &amp;lt;&amp;lt; std::endl;&lt;BR /&gt; std::cout &amp;lt;&amp;lt; std::endl;&lt;BR /&gt; std::cout &amp;lt;&amp;lt; "Constrained Solver:" &amp;lt;&amp;lt; std::endl;&lt;BR /&gt; std::cout &amp;lt;&amp;lt; "Initial Parameters: a = " &amp;lt;&amp;lt; startingParameters[0] &amp;lt;&amp;lt; "\tb = " &amp;lt;&amp;lt; startingParameters[1] &amp;lt;&amp;lt; std::endl;&lt;BR /&gt; std::cout &amp;lt;&amp;lt; "Final Parameters: a = " &amp;lt;&amp;lt; constrainedSolverResults[0] &amp;lt;&amp;lt; "\tb = " &amp;lt;&amp;lt; constrainedSolverResults[1] &amp;lt;&amp;lt; std::endl;&lt;BR /&gt; std::cout &amp;lt;&amp;lt; "Target Parameters: a = " &amp;lt;&amp;lt; userData.targetAValue &amp;lt;&amp;lt; "\tb = " &amp;lt;&amp;lt; userData.targetBValue &amp;lt;&amp;lt; std::endl;&lt;BR /&gt; std::cout &amp;lt;&amp;lt; "Results: Iterations = " &amp;lt;&amp;lt; constrainedResults.iterationsUsed &amp;lt;&amp;lt; " Stop Condition = " &amp;lt;&amp;lt; constrainedResults.stopCriterion &amp;lt;&amp;lt; std::endl;&lt;BR /&gt; std::cout &amp;lt;&amp;lt; "Initial Residuals = " &amp;lt;&amp;lt; constrainedResults.initialResiduals &amp;lt;&amp;lt; " Final Residuals = " &amp;lt;&amp;lt; constrainedResults.finalResiduals &amp;lt;&amp;lt; std::endl;&lt;BR /&gt;&lt;BR /&gt; return 0;&lt;BR /&gt;}[/bash] &lt;BR /&gt;When run, it gives the following results:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Seed = 1271347576&lt;BR /&gt;&lt;BR /&gt;Unconstrained Solver:&lt;BR /&gt;Initial Parameters: a = 3.69707 b = -1.66525&lt;BR /&gt;Final Parameters: a = 5.33677 b = -2.29319&lt;BR /&gt;Target Parameters: a = 5.33677 b = -2.29319&lt;BR /&gt;Results: Iterations = 14 Stop Condition = 3&lt;BR /&gt;Initial Residuals = 4740.99 Final Residuals = 5.13598e-006&lt;BR /&gt;&lt;BR /&gt;Constrained Solver:&lt;BR /&gt;Initial Parameters: a = 3.69707 b = -1.66525&lt;BR /&gt;Final Parameters: a = 3.73313 b = -2.03975&lt;BR /&gt;Target Parameters: a = 5.33677 b = -2.29319&lt;BR /&gt;Results: Iterations = 11 Stop Condition = 2&lt;BR /&gt;Initial Residuals = 4740.99 Final Residuals = 3561.57&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Needless to say, I'm rather confused about why the addition of bounds constraints changed the result of the solver, and prevented it from finding an appropriate solution, when otherwise all other paramters to the solver were the same. I have also had similar problems when I trying to tightly constrain some of the parameters by setting the upper and lower bounds to be equal, in which case the solver would frequently outright ignore not only those tightly constrained bounds, but all bounds constraints provided and return with an absolutely insane solution. Is there something I am doing incorrectly, or some aspect of the solver that I am not correctly taking into account? And is it incorrect to specify the an equal value for both the upper and lower bounds constraints on a given parameter, or must there always besome non-empty range between them for the solver to work correctly?&lt;BR /&gt;&lt;BR /&gt;Thank you for your time&lt;BR /&gt;- Stephen Kiazyk&lt;BR /&gt;&lt;BR /&gt;Edit: my apologies, I cannot seem to get angle brackets to work at all, hopefully the code is still clear.&lt;/I&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Apr 2010 14:13:52 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Non-linear-optimization-fails-when-bounds-constraints-are/m-p/837765#M6206</guid>
      <dc:creator>stephen_kiazyk</dc:creator>
      <dc:date>2010-04-19T14:13:52Z</dc:date>
    </item>
    <item>
      <title>I ran into problems with</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Non-linear-optimization-fails-when-bounds-constraints-are/m-p/837766#M6207</link>
      <description>I ran into problems with dtrnlspbc_solve ignoring bounds, and looking on the forum came across this topic.  I have run Stephen's code and can reproduce the odd behaviour with MKL version 11.0.  

Can anyone from Intel address Stephen's (and now my identical) questions?</description>
      <pubDate>Tue, 09 Oct 2012 19:05:46 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Non-linear-optimization-fails-when-bounds-constraints-are/m-p/837766#M6207</guid>
      <dc:creator>Kate_D_</dc:creator>
      <dc:date>2012-10-09T19:05:46Z</dc:date>
    </item>
    <item>
      <title>Please attach a file with the</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Non-linear-optimization-fails-when-bounds-constraints-are/m-p/837767#M6208</link>
      <description>Please attach a file with the problematic source code -- source that can be compiled with no compilation errors. 
&lt;BR /&gt;
Reinstating the missing angle brackets in Stephen's in-line source requires more guesswork than I am inclined to risk.</description>
      <pubDate>Wed, 10 Oct 2012 10:58:29 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Non-linear-optimization-fails-when-bounds-constraints-are/m-p/837767#M6208</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2012-10-10T10:58:29Z</dc:date>
    </item>
    <item>
      <title>Here is a text file</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Non-linear-optimization-fails-when-bounds-constraints-are/m-p/837768#M6209</link>
      <description>Here is a text file containing Stephen's source code. (.h and .cpp files in one text file)</description>
      <pubDate>Wed, 10 Oct 2012 12:59:51 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Non-linear-optimization-fails-when-bounds-constraints-are/m-p/837768#M6209</guid>
      <dc:creator>Kate_D_</dc:creator>
      <dc:date>2012-10-10T12:59:51Z</dc:date>
    </item>
    <item>
      <title>Thanks for posting the code.</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Non-linear-optimization-fails-when-bounds-constraints-are/m-p/837769#M6210</link>
      <description>Thanks for posting the code. &lt;BR /&gt;&lt;BR /&gt;

In general, a nonlinear unconstrained optimization routine may fail to converge within the specified number of iterations for certain initial values of the unknown variables. Likewise, a bound-constrained optimization routine may fail to converge within the specified number of iterations for the same reason and, in addition, if the bounds are too tight.&lt;BR /&gt; &lt;BR /&gt;

Many successful optimization algorithms do not guarantee that every trial point will satisfy user-specified bounds, whereas other algorithms exist that maintain feasibility (i.e., constraints are satisfied) at all times. In either case, if the user specifies unreasonable bounds -- in particular, if the bounds are tight and/or do not contain the (or one of the) solutions, the algorithm may fail to converge.&lt;BR /&gt;&lt;BR /&gt;

For the specific example in the source code, I found that the bound-constrained optimizer yields the same solution as the unconstrained optimizer if the initial point is given as (5.2, 2.2), the bounds are specified as -100 and +100 for both unknowns, and the "target values" are  a = 5.33677 b = -2.29319.&lt;BR /&gt;&lt;BR /&gt;

The observed failure(s) in the initial post may be caused partly because of trial values being too far from the solution, incorrect bounds, or in using randomly generated numbers for generating the data and other random numbers as initial parameter values.&lt;BR /&gt;&lt;BR /&gt;

The results:
&lt;BLOCKQUOTE&gt;
--------------- Unconstrained Solver ---------------
Initial Parameters: a = 5.2     b = 2.2
Target Parameters:  a = 5.33677 b = 2.29319
Final Parameters:   a = 5.33677 b = 2.29319
        Stop Condition =    3
        Final Residuals =   2.3441e-008


--------------- Constrained Solver -----------------
Initial Parameters: a = 5.2     b = 2.2
Target Parameters:  a = 5.33677 b = 2.29319
Final Parameters:   a = 5.33677 b = 2.29319
        Stop Condition =    3
        Final Residuals =   2.34438e-008
&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Thu, 11 Oct 2012 01:38:17 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Non-linear-optimization-fails-when-bounds-constraints-are/m-p/837769#M6210</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2012-10-11T01:38:17Z</dc:date>
    </item>
    <item>
      <title>Thank you very much mecej4,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Non-linear-optimization-fails-when-bounds-constraints-are/m-p/837770#M6211</link>
      <description>Thank you very much mecej4,  I too get that answer when I tweaked the userData.lowerXBounds/.upperXBounds, rather than the upper and lower bounds given to the solver.  I perhaps don't understand what is happening in the MKLObjectiveFunciton, I'll look at it again.  Thanks again for replying to my questions.</description>
      <pubDate>Thu, 11 Oct 2012 17:36:51 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Non-linear-optimization-fails-when-bounds-constraints-are/m-p/837770#M6211</guid>
      <dc:creator>Kate_D_</dc:creator>
      <dc:date>2012-10-11T17:36:51Z</dc:date>
    </item>
  </channel>
</rss>

