<p>Shri,</p>
<p>Would it rather be more appropriate to call it a constrained minimizer then ? I have looked at TAO before and hence my curiosity in the new solver. I shall look at the reference you suggested before asking any more naive questions.</p>
<p>Thanks,<br>
Vijay</p>
<div class="gmail_quote">On Jul 25, 2011 11:43 PM, "Shri" <<a href="mailto:abhyshr@mcs.anl.gov">abhyshr@mcs.anl.gov</a>> wrote:<br type="attribution">> <br>> <br>> ----- Original Message -----<br>
>> Barry/Shri,<br>>> <br>>> Is the new VI SNES type in general terms a constrained nonlinear<br>>> solver ? <br>> Yes, where the constraints are on the variables.<br>> <br>> Given a function f(x) with upper and lower bounds on x, the VI solver tries to compute an x* such that for each x_i one of the following conditions is satisfied<br>
> f(x_i) = 0 with xl_i < x_i < xu_i<br>> f(x_i) > 0 with x_i = xl_i<br>> f(x_i) < 0 with x_i = xu_i<br>> <br>> In other words, given a certain constraint as a function of<br>>> the variables of interest, does it find the optimal solution that both<br>
>> minimizes the residual and satisfy the constraint ? <br>> <br>> I would say that the VI solver is not an optimizer but rather a constrained nonlinear solver. <br>> The only constrained optimization it can do is if you provide the gradient as f(x) with <br>
> lower/upper bounds on x.<br>> <br>> <br>> I have been<br>>> looking at L-BFGS constrained optimization methods and from what I<br>>> understand, the variational inequality solver seems to fall under a<br>
>> similar but much broader category. <br>> I suggest you take a look at the TAO package if you are interested in optimization related problems.<br>> <a href="http://www.mcs.anl.gov/research/projects/tao/">http://www.mcs.anl.gov/research/projects/tao/</a><br>
> <br>> <br>> I would much appreciate it if you<br>>> can point me to some papers related to the method. <br>> <br>> <a href="http://www.mcs.anl.gov/~tmunson/papers/semismooth.pdf">http://www.mcs.anl.gov/~tmunson/papers/semismooth.pdf</a><br>
> <br>> And if I<br>>> misunderstood the domain of applicability, please do feel free to<br>>> correct me.<br>>> <br>>> Thanks,<br>>> Vijay<br>>> <br>>> On Mon, Jul 25, 2011 at 9:58 PM, Barry Smith <<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>><br>
>> wrote:<br>>> ><br>>> > On Jul 25, 2011, at 5:50 PM, Jonathan Backs wrote:<br>>> ><br>>> >> Hi Shri,<br>>> >><br>>> >> Thanks for your message and all the helpful tips. If the<br>
>> >> TSVISetVariableBounds() functions are available now, I would like<br>>> >> to try them as well. Is the interface essentially the same as with<br>>> >> SNESVISetVariableBounds()? I will get back to you and Barry when I<br>
>> >> have had a chance to modify my application.<br>>> >><br>>> >> For my problem, I believe it makes sense to have bounds on one of<br>>> >> the variables as well as one function of the variables. The two<br>
>> >> relevant degrees of freedom are the block voltage (one for each<br>>> >> finite difference block) and the electrode voltage (one for each<br>>> >> electrode, which may be present in multiple blocks). The electrode<br>
>> >> voltage should keep a constant phase while the magnitude is<br>>> >> constrained between zero and some maximum. The block voltages near<br>>> >> the electrodes depend on the electrode voltages as well as the<br>
>> >> neighbouring block voltages. The electrode current for a given<br>>> >> electrode is a function of its electrode voltage and several nearby<br>>> >> block voltages, and should be constrained in magnitude between zero<br>
>> >> and some maximum (and the phase unconstrained). Would I need to use<br>>> >> SNESVISetComputeVariableBounds since the electrode current is a<br>>> >> function of the other variables? Would any other provisions need to<br>
>> >> be made for the block voltages, since they depend on the electrode<br>>> >> voltages?<br>>> >><br>>> ><br>>> > You cannot directly make a bound on some function of other<br>
>> > variables. Instead you need to introduce another variable that is<br>>> > defined to be equal to that function and put the bound on that new<br>>> > variable.<br>>> ><br>>> > Barry<br>
>> ><br>>> >> Thank you again,<br>>> >><br>>> >> Jon<br>>> >><br>>> >> On 2011-07-25, at 11:58 AM, Shri wrote:<br>>> >><br>>> >>><br>
>> >>> ----- Original Message -----<br>>> >>>> On Jul 22, 2011, at 4:16 PM, Jonathan Backs wrote:<br>>> >>>><br>>> >>>>> Barry,<br>>> >>>>><br>
>> >>>>> Thank you so much for your response. Lucky, indeed! I look<br>>> >>>>> forward<br>>> >>>>> to trying out these new features.<br>>> >>>>><br>
>> >>>>> I neglected to mention in my original post that my electrical<br>>> >>>>> problem is part of a DAE, which includes a time-dependent<br>>> >>>>> heating<br>
>> >>>>> problem. Can SNESVI constraints be used in conjunction with<br>>> >>>>> TSSetIFunction() and TSSetIJacobian() as well? (Of course, I<br>>> >>>>> only<br>
>> >>>>> need the constraints for the time-independent electrical<br>>> >>>>> portion.)<br>>> >>>><br>>> >>>> We have not yet put that in but Shri is starting to look at that<br>
>> >>>> just<br>>> >>>> now. Basically we would have a TSVISetVariableBounds() and handle<br>>> >>>> everything from there. I suggest you start with a simple time<br>>> >>>> electrical portion with constraints to explore and we'll go from<br>
>> >>>> there. Shri is actually a electrical networks guy and so can<br>>> >>>> speak<br>>> >>>> your language.<br>>> >>><br>>> >>><br>>> >>> I've added TSVISetVariableBounds() for setting the bounds on the<br>
>> >>> variables using the TS object directly.<br>>> >>> A few things that i want to mention here about using the<br>>> >>> variational inequality nonlinear solver (SNESVI).<br>
>> >>> i) Use the runtime option -snes_type vi or explicitly set<br>>> >>> SNESSetType(snes,SNESVI).<br>>> >>> ii) There are two tested algorithms currently available, (a)<br>>> >>> semismooth (-snes_vi_type ss) and (b) active set or reduced space<br>
>> >>> (-snes_vi_type rs).<br>>> >>> iii) Take a look at example,ex61.c, in src/snes/examples/tutorials<br>>> >>> which is a time-stepping nonlinear problem with constraints on the<br>
>> >>> variables. This example does not use the TS object directly but<br>>> >>> rather a time-loop is explicitly written. Another example,ex8.c,<br>>> >>> in src/snes/examples/tests/ is a minimum surface area problem<br>
>> >>> which uses SNESVI.<br>>> >>><br>>> >>> By the way, does your problem have bounds on the variables or<br>>> >>> bounds on some function of the variables?<br>
>> >>><br>>> >>> Shri<br>>> >>><br>>> >>><br>>> >>><br>>> >>>><br>>> >>>> Barry<br>>> >>>><br>
>> >>>><br>>> >>>><br>>> >>>>><br>>> >>>>> Thank you again,<br>>> >>>>><br>>> >>>>> Jon<br>>> >>>>><br>
>> >>>>> On 2011-07-22, at 2:46 PM, Barry Smith wrote:<br>>> >>>>><br>>> >>>>>><br>>> >>>>>> Jon,<br>>> >>>>>><br>
>> >>>>>> You may be in luck. In PETSc-dev<br>>> >>>>>> <a href="http://www.mcs.anl.gov/petsc/petsc-as/developers/index.html">http://www.mcs.anl.gov/petsc/petsc-as/developers/index.html</a> we<br>
>> >>>>>> have now implemented variational inequality non-linear solvers<br>>> >>>>>> with box constraints.<br>>> >>>>>><br>>> >>>>>> That is one has a set of variables u and algebraic equations<br>
>> >>>>>> F(u) = 0 (say of size n each) but in addition one has<br>>> >>>>>> constraints lu <= u <= uu where some or all of lu may be<br>>> >>>>>> negative infinity (no constraints) and some or all of uu may<br>
>> >>>>>> be<br>>> >>>>>> infinity (no constraints). There is also a constraint on the<br>>> >>>>>> sign of F() for those equations associated with active<br>
>> >>>>>> constraints. If your constraints are not in this form<br>>> >>>>>> sometimes<br>>> >>>>>> you can introduce new additional variables to get it in this<br>
>> >>>>>> form. Read up a little on variational inequalities on the web.<br>>> >>>>>><br>>> >>>>>> To use this you provide the usual SNES function and Jacobian<br>
>> >>>>>> but<br>>> >>>>>> you also provide SNESVISetVariableBounds() there is a manual<br>>> >>>>>> page for this function and for for SNESVI at<br>
>> >>>>>> <a href="http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-dev/docs/index.html">http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-dev/docs/index.html</a><br>>> >>>>>> (the link is broken right now but Satish is fixing it). Plus<br>
>> >>>>>> several examples in src/snes/examples/tutorials (in<br>>> >>>>>> petsc-dev).<br>>> >>>>>><br>>> >>>>>> This is all new code so we would be interested in your<br>
>> >>>>>> feedback.<br>>> >>>>>><br>>> >>>>>><br>>> >>>>>> Barry<br>>> >>>>>><br>>> >>>>>><br>
>> >>>>>><br>>> >>>>>><br>>> >>>>>><br>>> >>>>>> On Jul 22, 2011, at 3:33 PM, Jonathan Backs wrote:<br>>> >>>>>><br>
>> >>>>>>> Hi,<br>>> >>>>>>><br>>> >>>>>>> I am trying to add a constraint feature to my first PETSc<br>>> >>>>>>> application, which uses the finite difference method to<br>
>> >>>>>>> calculate<br>>> >>>>>>> the potential distribution produced by a collection of<br>>> >>>>>>> electrodes<br>>> >>>>>>> in a resistive medium. I would like to make this simulation<br>
>> >>>>>>> more<br>>> >>>>>>> realistic by imposing a maximum electric current and a maximum<br>>> >>>>>>> potential difference that can be supplied to each electrode by<br>
>> >>>>>>> the<br>>> >>>>>>> power supply. If the medium between the electrodes is very<br>>> >>>>>>> conductive, the current maximum would be exceeded by the<br>
>> >>>>>>> maximum<br>>> >>>>>>> potential difference, so the potential difference should be<br>>> >>>>>>> decreased from maximum until it produces the maximum current.<br>
>> >>>>>>> On<br>>> >>>>>>> the other hand, the potential difference between the<br>>> >>>>>>> electrodes<br>>> >>>>>>> should remain at maximum as long as the current remains below<br>
>> >>>>>>> maximum (say, for a less conductive medium).<br>>> >>>>>>><br>>> >>>>>>> I added an extra degree of freedom (the electrode voltages) to<br>
>> >>>>>>> my<br>>> >>>>>>> DMDA, and I developed a set of conditional expressions that<br>>> >>>>>>> describe the above constraints, but one problem is that the<br>
>> >>>>>>> logic<br>>> >>>>>>> relies on if-then-else decisions that are made when forming<br>>> >>>>>>> the<br>>> >>>>>>> function/residual and the Jacobian. Once these decisions are<br>
>> >>>>>>> made,<br>>> >>>>>>> of course, the conditions are not checked again until the next<br>>> >>>>>>> function or Jacobian evaluation. The non-linear solver then<br>
>> >>>>>>> tends<br>>> >>>>>>> to oscillate between extreme solutions to the opposing<br>>> >>>>>>> conditions<br>>> >>>>>>> with each iteration, and never converges towards a reasonable<br>
>> >>>>>>> solution.<br>>> >>>>>>><br>>> >>>>>>> Is there a better strategy for solving such problems? Does<br>>> >>>>>>> PETSc<br>
>> >>>>>>> offer mechanisms to aid in their solution? I would very much<br>>> >>>>>>> appreciate any hints.<br>>> >>>>>>><br>>> >>>>>>> Thank you for your time,<br>
>> >>>>>>><br>>> >>>>>>> Jon<br>>> >>>>>><br>>> >>>>><br>>> >>><br>>> >><br>>> ><br>>> ><br>
</div>