<?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 Re: How to use multiple starting values for PROC NLP in Mathematical Optimization, Discrete-Event Simulation, and OR</title>
    <link>https://communities.sas.com/t5/Mathematical-Optimization/PROC-NLP/m-p/489304#M2377</link>
    <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/1636"&gt;@RobPratt&lt;/a&gt;&lt;/P&gt;&lt;P&gt;but is there any other way to use PROC NLP?. PROC OPTMODEL is very complicated, I have to change the whole code, and this procedure is very difficult to understand to me. It is much appreciated if you could give me instructions on how to do it&lt;/P&gt;</description>
    <pubDate>Thu, 23 Aug 2018 15:16:49 GMT</pubDate>
    <dc:creator>trungcva112</dc:creator>
    <dc:date>2018-08-23T15:16:49Z</dc:date>
    <item>
      <title>PROC NLP</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/PROC-NLP/m-p/489108#M2374</link>
      <description />
      <pubDate>Fri, 07 Sep 2018 05:48:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/PROC-NLP/m-p/489108#M2374</guid>
      <dc:creator>trungcva112</dc:creator>
      <dc:date>2018-09-07T05:48:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to use multiple starting values for PROC NLP</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/PROC-NLP/m-p/489288#M2375</link>
      <description>&lt;P&gt;Anyone has some ideas?&lt;/P&gt;</description>
      <pubDate>Thu, 23 Aug 2018 14:54:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/PROC-NLP/m-p/489288#M2375</guid>
      <dc:creator>trungcva112</dc:creator>
      <dc:date>2018-08-23T14:54:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to use multiple starting values for PROC NLP</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/PROC-NLP/m-p/489294#M2376</link>
      <description>&lt;P&gt;PROC NLP is a legacy procedure that is no longer even documented, and PROC OPTMODEL is recommended instead.&amp;nbsp; With PROC OPTMODEL, you can call the solver in a loop, setting the initial values for the variables before each solver call.&amp;nbsp; In fact, you can use a COFOR loop to solve these independent problems concurrently.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Aug 2018 15:02:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/PROC-NLP/m-p/489294#M2376</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2018-08-23T15:02:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to use multiple starting values for PROC NLP</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/PROC-NLP/m-p/489304#M2377</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/1636"&gt;@RobPratt&lt;/a&gt;&lt;/P&gt;&lt;P&gt;but is there any other way to use PROC NLP?. PROC OPTMODEL is very complicated, I have to change the whole code, and this procedure is very difficult to understand to me. It is much appreciated if you could give me instructions on how to do it&lt;/P&gt;</description>
      <pubDate>Thu, 23 Aug 2018 15:16:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/PROC-NLP/m-p/489304#M2377</guid>
      <dc:creator>trungcva112</dc:creator>
      <dc:date>2018-08-23T15:16:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to use multiple starting values for PROC NLP</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/PROC-NLP/m-p/489317#M2378</link>
      <description>&lt;P&gt;The following code should at least get you started:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc optmodel printlevel=0;
   set INSTANCES;
   num ticker {INSTANCES};
   num date {INSTANCES};
   num alpha_init {INSTANCES};
   num delta_init {INSTANCES};
   num mu_init {INSTANCES};
   num eta_B_init {INSTANCES};
   num eta_S_init {INSTANCES};
   read data initials into INSTANCES=[_N_]
      ticker date alpha_init=alpha delta_init=delta mu_init=mu eta_B_init=eta_B eta_S_init=eta_S;

   set &amp;lt;num,num,num&amp;gt; TICKER_DATE_OBS;
   num B {TICKER_DATE_OBS};
   num S {TICKER_DATE_OBS};
   read data trades into TICKER_DATE_OBS=[ticker date _N_] B S;
   num t_this, d_this;
   set OBS_THIS;

   var alpha &amp;gt;= 0 &amp;lt;= 1, delta &amp;gt;= 0 &amp;lt;= 1;
   var mu &amp;gt;= 0, eta_B &amp;gt;= 0, eta_S &amp;gt;= 0;
   impvar one_minus_d = 1.0 - delta;
   impvar one_minus_alpha = 1.0 - alpha;
   impvar e1 {obs in OBS_THIS} = -1.0*mu - B[t_this,d_this,obs]*log(1+mu/eta_B);
   impvar e2 {obs in OBS_THIS} = -1.0*mu - S[t_this,d_this,obs]*log(1+mu/eta_S);
   impvar e3 {obs in OBS_THIS} = -B[t_this,d_this,obs]*log(1+mu/eta_B) - S[t_this,d_this,obs]*log(1+mu/eta_S);
   impvar emax {obs in OBS_THIS} = max(e1[obs], e2[obs], e3[obs]);
   max loglik = sum {obs in OBS_THIS} (
     -1.0*eta_B + B[t_this,d_this,obs]*log(mu+eta_B)
     -1.0*eta_S + S[t_this,d_this,obs]*log(mu+eta_S)
     + emax[obs]
     + log( 
        alpha * one_minus_d * exp(e2[obs] - emax[obs])
          + alpha * delta * exp(e1[obs] - emax[obs])
            + one_minus_alpha * exp(e3[obs] - emax[obs])
       ));

   str solstatus {INSTANCES};
   num alpha_sol {INSTANCES};
   num delta_sol {INSTANCES};
   num mu_sol {INSTANCES};
   num eta_B_sol {INSTANCES};
   num eta_S_sol {INSTANCES};
   num loglik_sol {INSTANCES};
   for {i in INSTANCES} do;
      t_this = ticker[i];
      d_this = date[i];
      OBS_THIS = {&amp;lt;(t_this),(d_this),obs&amp;gt; in TICKER_DATE_OBS};
      put i= t_this= d_this= monyy7. ' ';
      alpha = alpha_init[i];
      delta = delta_init[i];
      mu    = mu_init[i];
      eta_B = eta_B_init[i];
      eta_S = eta_S_init[i];
      solve;
      solstatus[i] = _solution_status_;
      alpha_sol[i]  = alpha;
      delta_sol[i]  = delta;
      mu_sol[i]     = mu;
      eta_B_sol[i]  = eta_B;
      eta_S_sol[i]  = eta_S;
      loglik_sol[i] = loglik;
   end;
   create data solutions from [instance]=INSTANCES
      ticker date/format=monyy7. solstatus loglik=loglik_sol alpha=alpha_sol delta=delta_sol mu=mu_sol eta_B=eta_B_sol eta_S=eta_S_sol;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 24 Aug 2018 02:37:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/PROC-NLP/m-p/489317#M2378</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2018-08-24T02:37:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to use multiple starting values for PROC NLP</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/PROC-NLP/m-p/489472#M2379</link>
      <description>&lt;P&gt;Thanks &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/1636"&gt;@RobPratt&lt;/a&gt; Now it goes through all the initials&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, I am not able to get the right solution among these. For example, ticker 99999 must have solution: alpha=0.4, delta=0.5, mu=50, eta_B=eta_S=40. I can not find this in the output dataset&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I run my old PROC NLP code, using only 1 set of initials for ticker 99999 (alpha=0.9, delta=0.7, mu=18.5, eta_B=45, eta_S=38.3), it gives me the right solution. So it confirms that the "true" solution lies in one of my initials&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After examining your PROC OPTMODEL, I think the issue might be:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- The PROC NLP uses Newton-Ralphson technique; PROC OPTMODEL uses interior point technique. I searched but I can not find Newton-Ralphson technique or any equivalent in PROC OPTMODEL&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- eta_B, eta_S, mu are strictly &amp;gt; 0 (rather than &amp;gt;=0). However, when I change this constraint by using&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;   var alpha &amp;gt;= 0 &amp;lt;= 1, delta &amp;gt;= 0 &amp;lt;= 1;
   var mu, eta_B, eta_S;
   con mu&amp;gt;0, eta_B&amp;gt;0, eta_S&amp;gt;0;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;It gives me error:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;ERROR:&lt;/FONT&gt; The problem contains strict inequality or predicate constraints that reference non-integer&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; variables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you please advise me on this? Thank you very much&lt;/P&gt;</description>
      <pubDate>Fri, 24 Aug 2018 01:49:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/PROC-NLP/m-p/489472#M2379</guid>
      <dc:creator>trungcva112</dc:creator>
      <dc:date>2018-08-24T01:49:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to use multiple starting values for PROC NLP</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/PROC-NLP/m-p/489479#M2380</link>
      <description>&lt;P&gt;You cannot have strict inequalities.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The issue is that I had initially misinterpreted the trades data set.&amp;nbsp; Please see the corrected code above.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also note that the MULTISTART option&amp;nbsp;for the NLP solver in PROC OPTMODEL can automate the selection of starting points for you, and that would also simplify the code.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Aug 2018 02:41:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/PROC-NLP/m-p/489479#M2380</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2018-08-24T02:41:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to use multiple starting values for PROC NLP</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/PROC-NLP/m-p/489481#M2381</link>
      <description>&lt;P&gt;Thanks &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/1636"&gt;@RobPratt&lt;/a&gt;. You are my hero. It works now&lt;/P&gt;</description>
      <pubDate>Fri, 24 Aug 2018 03:13:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/PROC-NLP/m-p/489481#M2381</guid>
      <dc:creator>trungcva112</dc:creator>
      <dc:date>2018-08-24T03:13:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to use multiple starting values for PROC NLP</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/PROC-NLP/m-p/489613#M2382</link>
      <description>&lt;P&gt;Glad to help.&amp;nbsp; For completeness, here is the multistart approach I mentioned:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc optmodel printlevel=0;
   set &amp;lt;num,num,num&amp;gt; TICKER_DATE_OBS;
   num B {TICKER_DATE_OBS};
   num S {TICKER_DATE_OBS};
   read data trades into TICKER_DATE_OBS=[ticker date _N_] B S;
   num t_this, d_this;
   set OBS_THIS;

   var alpha &amp;gt;= 0 &amp;lt;= 1, delta &amp;gt;= 0 &amp;lt;= 1;
   var mu &amp;gt;= 0, eta_B &amp;gt;= 0, eta_S &amp;gt;= 0;
   impvar one_minus_d = 1.0 - delta;
   impvar one_minus_alpha = 1.0 - alpha;
   impvar e1 {obs in OBS_THIS} = -1.0*mu - B[t_this,d_this,obs]*log(1+mu/eta_B);
   impvar e2 {obs in OBS_THIS} = -1.0*mu - S[t_this,d_this,obs]*log(1+mu/eta_S);
   impvar e3 {obs in OBS_THIS} = -B[t_this,d_this,obs]*log(1+mu/eta_B) - S[t_this,d_this,obs]*log(1+mu/eta_S);
   impvar emax {obs in OBS_THIS} = max(e1[obs], e2[obs], e3[obs]);
   max loglik = sum {obs in OBS_THIS} (
     -1.0*eta_B + B[t_this,d_this,obs]*log(mu+eta_B)
     -1.0*eta_S + S[t_this,d_this,obs]*log(mu+eta_S)
     + emax[obs]
     + log( 
        alpha * one_minus_d * exp(e2[obs] - emax[obs])
          + alpha * delta * exp(e1[obs] - emax[obs])
            + one_minus_alpha * exp(e3[obs] - emax[obs])
       ));

   set TICKER_DATE = setof {&amp;lt;t,d,o&amp;gt; in TICKER_DATE_OBS} &amp;lt;t,d&amp;gt;;
   str solstatus {TICKER_DATE};
   num alpha_sol {TICKER_DATE};
   num delta_sol {TICKER_DATE};
   num mu_sol {TICKER_DATE};
   num eta_B_sol {TICKER_DATE};
   num eta_S_sol {TICKER_DATE};
   num loglik_sol {TICKER_DATE};
   for {&amp;lt;t,d&amp;gt; in TICKER_DATE} do;
      put t= d= monyy7.;
      t_this = t;
      d_this = d;
      OBS_THIS = {&amp;lt;(t_this),(d_this),obs&amp;gt; in TICKER_DATE_OBS};
      solve with nlp / ms;
      solstatus[t,d]  = _solution_status_;
      alpha_sol[t,d]  = alpha;
      delta_sol[t,d]  = delta;
      mu_sol[t,d]     = mu;
      eta_B_sol[t,d]  = eta_B;
      eta_S_sol[t,d]  = eta_S;
      loglik_sol[t,d] = loglik;
   end;
   create data solutions_ms from [ticker date/format=monyy7.]=TICKER_DATE
      solstatus loglik=loglik_sol alpha=alpha_sol delta=delta_sol mu=mu_sol eta_B=eta_B_sol eta_S=eta_S_sol;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 24 Aug 2018 14:37:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/PROC-NLP/m-p/489613#M2382</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2018-08-24T14:37:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to use multiple starting values for PROC NLP</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/PROC-NLP/m-p/489851#M2386</link>
      <description>Brilliant!. Thanks a lot &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/1636"&gt;@RobPratt&lt;/a&gt;&lt;BR /&gt;Just curious, is there any difference between "solve" and "solve with nlp". I searched but it seems not clear to me</description>
      <pubDate>Sun, 26 Aug 2018 00:17:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/PROC-NLP/m-p/489851#M2386</guid>
      <dc:creator>trungcva112</dc:creator>
      <dc:date>2018-08-26T00:17:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to use multiple starting values for PROC NLP</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/PROC-NLP/m-p/490109#M2388</link>
      <description>&lt;P&gt;SOLVE chooses a default solver based on the problem structure.&amp;nbsp; In this case, it chooses the NLP solver.&amp;nbsp; SOLVE WITH NLP explicitly specifies the NLP solver.&amp;nbsp; To include solver options (like MS, in this case), you need the WITH clause.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://go.documentation.sas.com/?docsetId=ormpug&amp;amp;docsetTarget=ormpug_optmodel_syntax11.htm&amp;amp;docsetVersion=14.3&amp;amp;locale=en#ormpug.optmodel.npxsolvestmt" target="_blank"&gt;https://go.documentation.sas.com/?docsetId=ormpug&amp;amp;docsetTarget=ormpug_optmodel_syntax11.htm&amp;amp;docsetVersion=14.3&amp;amp;locale=en#ormpug.optmodel.npxsolvestmt&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Aug 2018 14:58:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/PROC-NLP/m-p/490109#M2388</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2018-08-27T14:58:52Z</dc:date>
    </item>
  </channel>
</rss>

