<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof">
<span style="font-family: "Segoe UI Web (West European)", "Segoe UI", -apple-system, "system-ui", Roboto, "Helvetica Neue", sans-serif; font-size: 12px; display: inline !important; background-color: rgb(255, 255, 255);" class="ContentPasted0">Pierre,</span></div>
<div style="line-break:after-white-space">
<div>1) Is there any hope to get PDIPDM to use a MatNest?</div>
<div><br>
</div>
<div class="ContentPasted1"><span style="color: rgb(48, 58, 242);">KKT matrix is indefinite and ill-conditioned, which must be solved using a direct matrix factorization method. For the current implementation, we use MUMPS Cholesky as default. To use MatNest,
what direct solver to use, SCHUR_FACTOR? I do not know how to get it work. </span></div>
<div><br>
</div>
<div>2) Is this fixed <a href="https://lists.mcs.anl.gov/pipermail/petsc-dev/2020-September/026398.html" data-auth="NotApplicable">https://lists.mcs.anl.gov/pipermail/petsc-dev/2020-September/026398.html</a> ?</div>
<div>I cannot get users to transition away from Ipopt because of these two missing features.</div>
<div><br>
</div>
<div><span style="color: rgb(48, 58, 242);">The existing pdipm is the result of a MS student intern project. None of us involved are experts on the optimization solvers. We made a straightforward parallelization of Ipopt. It indeed needs further work, e.g.,
more features, better matrix storage, convergence criteria... To our knowledge, parallel pdipm is not available other than our pdipm. We should improve our pdipm. </span></div>
<div><span style="color: rgb(48, 58, 242);">Hong</span></div>
<div><br>
</div>
<div>
<div>
<blockquote type="cite">
<div>On 20 Apr 2023, at 5:47 PM, Zhang, Hong via petsc-users <petsc-users@mcs.anl.gov> wrote:</div>
<br class="x_Apple-interchange-newline">
<div>
<div class="x_elementToProof x_ContentPasted0 x_ContentPasted1" style="font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; background-color: rgb(255, 255, 255);">
<span class="x_ContentPasted2" style="font-family: Calibri, sans-serif; font-size: 14.6667px; display: inline !important; background-color: rgb(255, 255, 255);">Karthik,</span><br>
</div>
<div class="x_elementToProof x_ContentPasted0 x_ContentPasted1" style="font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; background-color: rgb(255, 255, 255);">
We built a KKT matrix in TaoSNESJacobian_PDIPM() (see petsc/src/tao/constrained/impls/ipm/pdipm.c) which assembles several small matrices into a large KKT matrix in mpiaij format. You could take the same approach to insert P and P^T into your K.</div>
<div class="x_elementToProof x_ContentPasted0 x_ContentPasted1" style="font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; background-color: rgb(255, 255, 255);">
FYI, I attached our paper.</div>
<div class="x_elementToProof x_ContentPasted0 x_ContentPasted1" style="font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; background-color: rgb(255, 255, 255);">
Hong</div>
<div id="x_appendonsend" style="font-family:Helvetica; font-size:12px; font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none">
</div>
<hr tabindex="-1" style="font-family:Helvetica; font-size:12px; font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; display:inline-block; width:826.125px">
<span style="font-family:Helvetica; font-size:12px; font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; float:none; display:inline!important"></span>
<div id="x_divRplyFwdMsg" dir="ltr" style="font-family:Helvetica; font-size:12px; font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none">
<font face="Calibri, sans-serif" style="font-size:11pt"><b>From:</b><span class="x_Apple-converted-space"> </span>petsc-users <petsc-users-bounces@mcs.anl.gov> on behalf of Matthew Knepley <knepley@gmail.com><br>
<b>Sent:</b><span class="x_Apple-converted-space"> </span>Thursday, April 20, 2023 5:37 AM<br>
<b>To:</b><span class="x_Apple-converted-space"> </span>Karthikeyan Chockalingam - STFC UKRI <karthikeyan.chockalingam@stfc.ac.uk><br>
<b>Cc:</b><span class="x_Apple-converted-space"> </span>petsc-users@mcs.anl.gov <petsc-users@mcs.anl.gov><br>
<b>Subject:</b><span class="x_Apple-converted-space"> </span>Re: [petsc-users] question about MatSetLocalToGlobalMapping</font>
<div> </div>
</div>
<div style="font-family:Helvetica; font-size:12px; font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none">
<div dir="ltr">
<div dir="ltr">On Thu, Apr 20, 2023 at 6:13 AM Karthikeyan Chockalingam - STFC UKRI via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov" data-auth="NotApplicable">petsc-users@mcs.anl.gov</a>> wrote:<br>
</div>
<div class="x_x_gmail_quote">
<blockquote class="x_x_gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left-width:1px; border-left-style:solid; border-left-color:rgb(204,204,204); padding-left:1ex">
<div class="x_x_msg4059408548263094035">
<div lang="EN-GB">
<div class="x_x_m_-6455518359002065503WordSection1">
<div style="margin-top:0px; margin-bottom:0px">Hello,</div>
<div style="margin-top:0px; margin-bottom:0px"><u></u> <u></u></div>
<div style="margin-top:0px; margin-bottom:0px">I created a new thread, thought would it be more appropriate (and is a continuation of my previous post). I want to construct the below K matrix (which is composed of submatrices)</div>
<div style="margin-top:0px; margin-bottom:0px"><u></u> <u></u></div>
<div style="margin-top:0px; margin-bottom:0px"><span style="">K = [A P^T</span><span style="font-size: 10pt; color: rgb(33, 33, 33);"><u></u><u></u></span></div>
<div style="margin-top:0px; margin-bottom:0px"><span style=""> P 0]<u></u><u></u></span></div>
<div style="margin-top:0px; margin-bottom:0px"><span style=""><u></u> <u></u></span></div>
<div style="margin-top:0px; margin-bottom:0px"><span style="">Where K is of type MatMPIAIJ. I first constructed the top left [A] using MatSetValues().<u></u><u></u></span></div>
<div style="margin-top:0px; margin-bottom:0px"><span style=""><u></u> <u></u></span></div>
<div style="margin-top:0px; margin-bottom:0px"><span style="">Now, I would like to construct the bottom left [p] and top right [p^T]<span class="x_Apple-converted-space"> </span></span>using MatSetValuesLocal().</div>
<div style="margin-top:0px; margin-bottom:0px"><u></u> <u></u></div>
<div style="margin-top:0px; margin-bottom:0px">To use MatSetValuesLocal(), I first have to create a local-to-global mapping using ISLocalToGlobalMappingCreate. I have created two mapping row_mapping and column_mapping.</div>
</div>
</div>
</div>
</blockquote>
<div><br>
</div>
<div>I do not understand why they are not the same map. Maybe I was unclear before. It looks like you have two fields, say phi and lambda, where lambda is a Lagrange multiplier imposing some constraint. Then you get a saddle point like this. You can imagine
matrices</div>
<div><br>
</div>
<div> (phi, phi) --> A</div>
<div> (phi, lambda) --> P^T</div>
<div> (lambda, phi) --> P</div>
<div><br>
</div>
<div>So you make a L2G map for the phi field and the lambda field. Oh, you are calling them row and col map, but they are my phi and lambda</div>
<div>maps. I do not like the row and col names since in P they reverse.</div>
<div> </div>
<blockquote class="x_x_gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left-width:1px; border-left-style:solid; border-left-color:rgb(204,204,204); padding-left:1ex">
<div class="x_x_msg4059408548263094035">
<div lang="EN-GB">
<div class="x_x_m_-6455518359002065503WordSection1">
<div style="margin-top:0px; margin-bottom:0px"><span style="">Q1) At what point should I declare<span class="x_Apple-converted-space"> </span></span>MatSetLocalToGlobalMapping – is it just before I use MatSetValuesLocal()?</div>
</div>
</div>
</div>
</blockquote>
<div><br>
</div>
<div>Okay, it is good you are asking this because my thinking was somewhat confused. I think the precise steps are:</div>
<div><br>
</div>
<div> 1) Create the large saddle point matrix K</div>
<div><br>
</div>
<div> 1a) We must call <a href="https://petsc.org/main/manualpages/Mat/MatSetLocalToGlobalMapping/" data-auth="NotApplicable">https://petsc.org/main/manualpages/Mat/MatSetLocalToGlobalMapping/</a><span class="x_Apple-converted-space"> </span>on it. In the
simplest case, this just maps</div>
<div> the local rows numbers [0, Nrows) to the global rows numbers [rowStart, rowStart + Nrows).</div>
<div><br>
</div>
<div> 2) To form each piece:</div>
<div><br>
</div>
<div> 2a) Extract that block using <a href="https://petsc.org/main/manualpages/Mat/MatGetLocalSubMatrix/" data-auth="NotApplicable">https://petsc.org/main/manualpages/Mat/MatGetLocalSubMatrix/</a></div>
<div><br>
</div>
<div> This gives back a Mat object that you subsequently restore using <a href="https://petsc.org/main/manualpages/Mat/MatRestoreLocalSubMatrix/" data-auth="NotApplicable">https://petsc.org/main/manualpages/Mat/MatRestoreLocalSubMatrix/</a></div>
<div><br>
</div>
<div> 2b) Insert values using<span class="x_Apple-converted-space"> </span><a href="https://petsc.org/main/manualpages/Mat/MatSetValuesLocal/" data-auth="NotApplicable">https://petsc.org/main/manualpages/Mat/MatSetValuesLocal/</a></div>
<div><br>
</div>
<div> The local indices used for insertion here are indices relative to the block itself, and the L2G map for this matrix</div>
<div> has been rewritten to insert into that block in the larger matrix. Thus this looks like just calling MatSetValuesLocal()</div>
<div> on the smaller matrix block, but inserts correctly into the larger matrix.</div>
<div><br>
</div>
<div>Therefore, the code you write code in 2) could work equally well making the large matrix from 1), or independent smaller matrix blocks.</div>
<div><br>
</div>
<div>Does this make sense?</div>
<div><br>
</div>
<div> Thanks,</div>
<div><br>
</div>
<div> Matt</div>
<div> </div>
<blockquote class="x_x_gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left-width:1px; border-left-style:solid; border-left-color:rgb(204,204,204); padding-left:1ex">
<div class="x_x_msg4059408548263094035">
<div lang="EN-GB">
<div class="x_x_m_-6455518359002065503WordSection1">
<div style="margin-top:0px; margin-bottom:0px">I will use MatSetLocalToGlobalMapping(K, row_mapping, column_mapping) to build<span class="x_Apple-converted-space"> </span><span style="">the bottom left [P].<u></u><u></u></span></div>
<div style="margin-top:0px; margin-bottom:0px"><span style=""><u></u> <u></u></span></div>
<div style="margin-top:0px; margin-bottom:0px"><span style=""><u></u> <u></u></span></div>
<div style="margin-top:0px; margin-bottom:0px"><span style="">Q2) Can now I reset the mapping as<span class="x_Apple-converted-space"> </span></span>MatSetLocalToGlobalMapping(K, column_mapping, row_mapping) to build<span class="x_Apple-converted-space"> </span><span style="">the
top right [P^T]?<span class="x_Apple-converted-space"> </span><u></u><u></u></span></div>
<div style="margin-top:0px; margin-bottom:0px"><span style=""><u></u> <u></u></span></div>
<div style="margin-top:0px; margin-bottom:0px"><u></u> <u></u></div>
<div style="margin-top:0px; margin-bottom:0px">Many thanks!<span style=""><u></u><u></u></span></div>
<div style="margin-top:0px; margin-bottom:0px"><span style=""><u></u> <u></u></span></div>
<div style="margin-top:0px; margin-bottom:0px"><span style="">Kind regards,<u></u><u></u></span></div>
<div style="margin-top:0px; margin-bottom:0px"><span style="">Karthik.<u></u><u></u></span></div>
<div style="margin-top:0px; margin-bottom:0px"><span style=""><u></u> <u></u></span></div>
<div style="margin-top:0px; margin-bottom:0px"><span style=""><u></u> <u></u></span></div>
<div style="margin-top:0px; margin-bottom:0px"><span style=""><u></u> <u></u></span></div>
<div style="margin-top:0px; margin-bottom:0px"><span style=""><u></u> <u></u></span></div>
<div style="margin-top:0px; margin-bottom:0px"><span style=""><u></u> <u></u></span></div>
<div style="margin-top:0px; margin-bottom:0px"><u></u> <u></u></div>
<div style="margin-top:0px; margin-bottom:0px"><u></u> <u></u></div>
<div style="margin-top:0px; margin-bottom:0px"><span style="font-size: 10pt; color: rgb(33, 33, 33);"><u></u> <u></u></span></div>
<div style="margin-top:0px; margin-bottom:0px"><u></u> <u></u></div>
</div>
</div>
</div>
</blockquote>
</div>
<br clear="all">
<div><br>
</div>
<span class="x_x_gmail_signature_prefix">--<span class="x_Apple-converted-space"> </span></span><br>
<div dir="ltr" class="x_x_gmail_signature">
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr">
<div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>
-- Norbert Wiener</div>
<div><br>
</div>
<div><a href="http://www.cse.buffalo.edu/~knepley/" data-auth="NotApplicable">https://www.cse.buffalo.edu/~knepley/</a><br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<span id="x_cid:AA825F93-5460-43A9-BD3E-EC5B64921BC3"><IET Generation Trans Dist - 2022 - Sundermann - Parallel primal‐dual interior point method for the solution of dynamic.pdf></span></div>
</blockquote>
</div>
<br>
</div>
</div>
</body>
</html>