<div dir="auto">First dolve the unconstrained problem to make sure that works.<div dir="auto"><br></div><div dir="auto">   Matt</div></div><br><div class="gmail_quote"><div dir="ltr">On Sat, Aug 18, 2018, 01:24 Amir <<a href="mailto:mhbaghaei@mail.sjtu.edu.cn">mhbaghaei@mail.sjtu.edu.cn</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>I just tried. But it gives me same pattern. After One iteration, it diverges. I am now sure some thing is wrong with my setting.</div><br><div class="m_1808926612644044052gmail_quote_attribution">On Aug 18 2018, at 12:59 pm, Justin Chang <<a href="mailto:jychang48@gmail.com" target="_blank" rel="noreferrer">jychang48@gmail.com</a>> wrote:</div><blockquote><br><div><div><div>Have you tried <span style="color:rgb(49,49,49)">SNESVINEWTONRSLS? In my experience, I seem to have slightly better luck with that one instead of SNESVINEWTONSSLS</span></div></div><div><br><div><div><div>On Sat, Aug 18, 2018 at 12:56 AM Amir <<a href="https://link.getmailspring.com/link/1534569654.local-a0d70606-12e6-v1.4.2-f587b7b7@getmailspring.com/0?redirect=mailto%3Amhbaghaei%40mail.sjtu.edu.cn&recipient=cGV0c2MtdXNlcnNAbWNzLmFubC5nb3Y%3D" title="mailto:mhbaghaei@mail.sjtu.edu.cn" target="_blank" rel="noreferrer">mhbaghaei@mail.sjtu.edu.cn</a>> wrote:</div></div><blockquote><div>Hi</div><div>I need to apply constraint to primitive variables. I am troubling to set up SNESVI. After running the code, I feel SNES is not actually solving. After one iteration of SNES, I got DIVERGED_LINESEARCH, with NO changing in function norm.</div><div>I think the way I set VI maybe wrong. Sorry for my simple explanation.</div><div>Very thankful for your time.</div><div>Amir</div><div>SNESCreate(PETSC_COMM_WORLD,&snes);</div><div>SNESSetApplicationContext(snes,&user);</div><div>SNESSetDM(snes,<a href="https://link.getmailspring.com/link/1534569654.local-a0d70606-12e6-v1.4.2-f587b7b7@getmailspring.com/1?redirect=http%3A%2F%2Fuser.dm&recipient=cGV0c2MtdXNlcnNAbWNzLmFubC5nb3Y%3D" title="http://user.dm" target="_blank" rel="noreferrer">user.dm</a>);</div><div>SNESSetFunction(snes,NULL,FormFunction,&user);</div><div>FormInitialSolution(user.X,&user);</div><div>SNESSetSolution(snes,user.X);</div><div>SNESMonitorSet(snes,MySNESMonitor,&user,NULL);</div><div>SNESSetType(snes,SNESVINEWTONSSLS);</div><div>SNESSetNormSchedule(snes, SNES_NORM_ALWAYS);</div><div>SNESVISetVariableBounds(snes,user.XLOWER,user.XUPPER);</div><div>SNESGetLineSearch(snes,&linesearch);</div><div>SNESLineSearchSetType(linesearch,SNESLINESEARCHBT);</div><div>SNESLineSearchSetVIFunctions(linesearch, NULL, SNESNormFunction);</div><div>SNESSetFromOptions(snes);</div><div>SNESSolve(snes,NULL,user.X);</div><div><img alt="Open Tracking" width="0" height="0" style="border:0;width:0;height:0" src="https://link.getmailspring.com/open/1534566770.local-ad07529d-23c1-v1.4.2-f587b7b7@getmailspring.com?recipient=cGV0c2MtdXNlcnNAbWNzLmFubC5nb3Y%3D"></div></blockquote></div></div></div></blockquote><img class="m_1808926612644044052mailspring-open" alt="Open Tracking" width="0" height="0" style="border:0;width:0;height:0" src="https://link.getmailspring.com/open/1534569654.local-a0d70606-12e6-v1.4.2-f587b7b7@getmailspring.com?recipient=cGV0c2MtdXNlcnNAbWNzLmFubC5nb3Y%3D"></blockquote></div>