<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";
        color:black;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
tt
        {mso-style-priority:99;
        font-family:"Courier New";}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";
        color:black;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;
        color:black;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";
        color:black;}
span.EmailStyle22
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body bgcolor="white" lang="EN-GB" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Hi Laurie,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">In your example below, you use ssb as a target, not as a minimum. This was working also for me in the previous example, but that is not really what we want?
 F should be the target, but SSB is just a minimum threshold, exactly like a TAC constraint?<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Clara<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext"> flr-list-bounces@lists.r-forge.r-project.org
 [mailto:flr-list-bounces@lists.r-forge.r-project.org] <b>On Behalf Of </b>laurie<br>
<b>Sent:</b> 27 October 2014 15:02<br>
<b>To:</b> flr-list@lists.r-forge.r-project.org<br>
<b>Subject:</b> Re: [FLR-list] ssb constraint with FLash<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-bottom:12.0pt">There are a couple of issues neither of which should cause a problem but may point to a bug somewhere.
<br>
The ple4 object differs from the one Clara is using as it start at age 0 not age 1, plus it doesnt come from XSA so the F in the plusgroup is not the same as in plusgrpoup-1.
<br>
It looks like there is a bug in "[" i.e.<br>
<br>
<tt><span style="font-size:10.0pt">range(ple4[-1])</span></tt><span style="font-size:10.0pt;font-family:"Courier New""><br>
<tt>      min       max plusgroup   minyear   maxyear   minfbar   maxfbar </tt><br>
<tt>        2        10        -1      1957      2008         2         6 </tt><br>
<br>
<br>
</span>The following code works as expected, it is a long winded way of constraining SSB. It points in a problem not in the estimation procedure (LU decomposition) but maybe how it is being set up.<br>
<br>
<span style="font-size:10.0pt;font-family:"Courier New""><br>
<tt>plot(window(stk,start=2006))</tt><br>
<br>
<tt>stk=window(iter(MyObj,1),end=2008)</tt><br>
<tt>stk =fwdWindow(stk,eql,end=2010)</tt><br>
<br>
<tt>target <-fwdControl(data.frame(year  =c(2009,2009),</tt><br>
<tt>                             val     =c(.3,180000),</tt><br>
<tt>                             #min     =c(NA,180000),</tt><br>
<tt>                             quantity=c("f","ssb")))</tt><br>
<br>
<tt>stk.=fwd(stk,ctrl=target ,</tt><br>
<tt>             sr=eql)</tt><br>
</span><br>
<tt><span style="font-size:10.0pt">fbar(stk.)[,ac(2009)]</span></tt><span style="font-size:10.0pt;font-family:"Courier New""><br>
<tt>An object of class "FLQuant"</tt><br>
<tt>, , unit = unique, season = all, area = unique</tt><br>
<br>
<tt>     year</tt><br>
<tt>age   2009   </tt><br>
<tt>  all 0.21768</tt><br>
<br>
<tt>units:  f </tt><br>
<tt>> ssb( stk.)[,ac(2009:2010)]</tt><br>
<tt>An object of class "FLQuant"</tt><br>
<tt>, , unit = unique, season = all, area = unique</tt><br>
<br>
<tt>     year</tt><br>
<tt>age   2009   2010  </tt><br>
<tt>  all 227124 180000</tt><br>
<br>
<tt>units:  NA </tt><br>
<br>
<br>
</span>Note that the SSS constraint refers to the SSB at the end of the year if harvest.spwn.<br>
<span style="font-size:10.0pt;font-family:"Courier New""><br>
</span>Laurie<o:p></o:p></p>
<div>
<p class="MsoNormal">On 27/10/14 10:36, Clara Ulrich wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<pre>Hej, Thanks for help. I send my object - a stf from North Sea Haddock with 10 iterations.<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>Clara<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre><o:p> </o:p></pre>
<pre><o:p> </o:p></pre>
<pre>-----Original Message-----<o:p></o:p></pre>
<pre>From: <a href="mailto:flr-list-bounces@lists.r-forge.r-project.org">flr-list-bounces@lists.r-forge.r-project.org</a> [<a href="mailto:flr-list-bounces@lists.r-forge.r-project.org">mailto:flr-list-bounces@lists.r-forge.r-project.org</a>] On Behalf Of laurie<o:p></o:p></pre>
<pre>Sent: 27 October 2014 09:47<o:p></o:p></pre>
<pre>To: <a href="mailto:flr-list@flr-project.org">flr-list@flr-project.org</a><o:p></o:p></pre>
<pre>Subject: Re: [FLR-list] ssb constraint with FLash<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>Is it a bug or poor documentation?<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>We used to have  a page on TYFLR with all the different HCRs implemented using FLash. This included the STECF ones with numerous sequential constraints, on F, TAC, SSB etc. I have also implemented some simpler interfaces for fwd. I am currently redoing this see <a href="http://rscloud.iccat.int/Tutorials/MSE/hcr.pdf">http://rscloud.iccat.int/Tutorials/MSE/hcr.pdf</a><o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>As well as being documentation this will also provide a set of tests to make sure no bugs creep in during the winter.<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>As Iago says could you provide an example, and if it is not already included in hcr.pdf I will add it. After checking there isnt a bug of course.<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>Laurie<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre><o:p> </o:p></pre>
<pre><o:p> </o:p></pre>
<pre><o:p> </o:p></pre>
<pre><o:p> </o:p></pre>
<pre><o:p> </o:p></pre>
<pre><o:p> </o:p></pre>
<pre><o:p> </o:p></pre>
<pre><o:p> </o:p></pre>
<pre><o:p> </o:p></pre>
<pre>On 27/10/14 09:28, Iago MOSQUEIRA (JRC) wrote:<o:p></o:p></pre>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<pre>Hi,<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>I am trying to replicate the issue, using our dear ple4, but I failed <o:p></o:p></pre>
<pre>to do so. If I set a min value for ssb in 2010, which is higher than <o:p></o:p></pre>
<pre>what<o:p></o:p></pre>
<pre>f=0.8 in 2009 would give me, I get as expected a lower F and the right <o:p></o:p></pre>
<pre>ssb, try code below.<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>Can you send me your FLStock object?<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>Cheers,<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre><o:p> </o:p></pre>
<pre>Iago<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre><o:p> </o:p></pre>
<pre>library(FLash)<o:p></o:p></pre>
<pre>library(FLAssess)<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>data(ple4)<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>ple4 <- stf(ple4,3)<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>maxF <-fwdControl(data.frame(year=2009,val=0.8,quantity="f")) #  an <o:p></o:p></pre>
<pre>example with high F that decreases biomass a lot<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>ple4 <-<o:p></o:p></pre>
<pre>fwd(ple4,ctrl=maxF,sr=list(model="mean",params=FLPar(1)),sr.residuals=<o:p></o:p></pre>
<pre>FLQuant(3500000,dimnames=list(year=2009:2011)))<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>fbar(ple4)[,"2009"]<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>maxF <-fwdControl(data.frame(year=2009,val=c(0.8,NA),min=c(NA,350000),<o:p></o:p></pre>
<pre>quantity=c("f","ssb")))<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>ple4 <-<o:p></o:p></pre>
<pre>fwd(ple4,ctrl=maxF,sr=list(model="mean",params=FLPar(1)),sr.residuals=<o:p></o:p></pre>
<pre>FLQuant(3500000,dimnames=list(year=2009:2011)))<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>fbar(ple4)[,"2009"]<o:p></o:p></pre>
<pre>ssb(ple4)[,"2009"]<o:p></o:p></pre>
<pre>ssb(ple4)[,"2010"]<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre><o:p> </o:p></pre>
<pre>On 25/10/14 21:35, Clara Ulrich wrote:<o:p></o:p></pre>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<pre>Hi all,<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>We are just back from ICES MIXFISH, where we once again made much use <o:p></o:p></pre>
<pre>of FLash power... (still on R 2.15.3 windows 32 bits, we had some <o:p></o:p></pre>
<pre>troubles at the advice meeting in May with using the new FLFleet <o:p></o:p></pre>
<pre>package for R3.1, we haven't tried again - Flash 2.5.0)<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>This time we wanted to some SSB-based HCR - Typically, we have a target F with some SSB minimum constraints - for example the biomass must stay above Bpa, or if the biomass is below Bpa, the target is reduced such as SSB should be at least increasing...<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>But I kept having troubles making it to work - I had tried this some years ago and it worked OK as far as I remember, but last week I did not manage to get around the problem.<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>For example (with target F for 2014, and SSB constraint applying on <o:p></o:p></pre>
<pre>SSB at 1st January 2015 at the end of the fwd year)<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>maxF <-fwdControl(data.frame(year=2014,val=0.8,quantity="f")) #  an <o:p></o:p></pre>
<pre>example with high F that decreases biomass a lot Proj <- <o:p></o:p></pre>
<pre>fwd(MyObj,ctrl=maxF,sr=list(model="mean",params=FLPar(1)),sr.residual<o:p></o:p></pre>
<pre>s=FLQuant(3500000,dimnames=list(year=2014:2015)))<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>This works :<o:p></o:p></pre>
<pre>fbar(Proj)[,"2014"]<o:p></o:p></pre>
<pre>     An object of class "FLQuant"<o:p></o:p></pre>
<pre>     iters:  10<o:p></o:p></pre>
<pre>     , , unit = unique, season = all, area = unique<o:p></o:p></pre>
<pre>          year<o:p></o:p></pre>
<pre>     age   2014<o:p></o:p></pre>
<pre>       all 0.8(0)   <o:p></o:p></pre>
<pre>     units:  f<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>ssb(Proj)[,ac(2014:2015)]<o:p></o:p></pre>
<pre>     An object of class "FLQuant"<o:p></o:p></pre>
<pre>     iters:  10<o:p></o:p></pre>
<pre>     , , unit = unique, season = all, area = unique<o:p></o:p></pre>
<pre>          year<o:p></o:p></pre>
<pre>     age   2014      2015<o:p></o:p></pre>
<pre>     all 172983(0)  77323(0)<o:p></o:p></pre>
<pre>     units:  NA<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>but this does not work (here an example where the SSB constraint <o:p></o:p></pre>
<pre>should be activated)<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>maxF <o:p></o:p></pre>
<pre><-fwdControl(data.frame(year=2014,val=c(0.8,NA),min=c(NA,150000), <o:p></o:p></pre>
<pre>quantity=c("f","ssb"))) Proj <- <o:p></o:p></pre>
<pre>fwd(MyObj,ctrl=maxF,sr=list(model="mean",params=FLPar(1)),sr.residual<o:p></o:p></pre>
<pre>s=FLQuant(3500000,dimnames=list(year=2014:2015)))<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>fbar(Proj)[,"2014"]<o:p></o:p></pre>
<pre>     An object of class "FLQuant"<o:p></o:p></pre>
<pre>     iters:  10<o:p></o:p></pre>
<pre>     , , unit = unique, season = all, area = unique<o:p></o:p></pre>
<pre>          year<o:p></o:p></pre>
<pre>     age   2014<o:p></o:p></pre>
<pre>       all 0.016914(0)      <o:p></o:p></pre>
<pre>     units:  f<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>ssb(Proj)[,ac(2014:2015)]<o:p></o:p></pre>
<pre>     An object of class "FLQuant"<o:p></o:p></pre>
<pre>     iters:  10<o:p></o:p></pre>
<pre>     , , unit = unique, season = all, area = unique<o:p></o:p></pre>
<pre>          year<o:p></o:p></pre>
<pre>     age   2014      2015<o:p></o:p></pre>
<pre>     all 172983(0) 172983(0)<o:p></o:p></pre>
<pre>     units:  NA<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre><o:p> </o:p></pre>
<pre>and this doesn't work either when the SSB is not constraining (e.g. <o:p></o:p></pre>
<pre>SSB limit so low that it is always achieved). Only if I specify ssb <o:p></o:p></pre>
<pre>as a value inn fwdControl does it compute correctly, but that is not <o:p></o:p></pre>
<pre>the idea, it should be a minimum<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre><o:p> </o:p></pre>
<pre>I have tried several ways around this but cannot find out... Any idea of what is getting wrong?<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>Thanks in advance,<o:p></o:p></pre>
<pre>Cheers<o:p></o:p></pre>
<pre>Clara<o:p></o:p></pre>
<pre>_______________________________________________<o:p></o:p></pre>
<pre>flr-list mailing list<o:p></o:p></pre>
<pre><a href="mailto:flr-list@flr-project.org">flr-list@flr-project.org</a><o:p></o:p></pre>
<pre><a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/flr-list">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/flr-list</a><o:p></o:p></pre>
<pre><o:p> </o:p></pre>
</blockquote>
<pre><o:p> </o:p></pre>
</blockquote>
<pre><o:p> </o:p></pre>
<pre>_______________________________________________<o:p></o:p></pre>
<pre>flr-list mailing list<o:p></o:p></pre>
<pre><a href="mailto:flr-list@flr-project.org">flr-list@flr-project.org</a><o:p></o:p></pre>
<pre><a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/flr-list">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/flr-list</a><o:p></o:p></pre>
<p class="MsoNormal"><br>
<br>
<br>
<o:p></o:p></p>
<pre>_______________________________________________<o:p></o:p></pre>
<pre>flr-list mailing list<o:p></o:p></pre>
<pre><a href="mailto:flr-list@flr-project.org">flr-list@flr-project.org</a><o:p></o:p></pre>
<pre><a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/flr-list">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/flr-list</a><o:p></o:p></pre>
</blockquote>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>