<?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: converting SAS OPTMODEL to SAS/IML in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/converting-SAS-OPTMODEL-to-SAS-IML/m-p/149186#M1325</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will take a look at the option 1.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 19 Mar 2014 19:08:22 GMT</pubDate>
    <dc:creator>neilxu</dc:creator>
    <dc:date>2014-03-19T19:08:22Z</dc:date>
    <item>
      <title>converting SAS OPTMODEL to SAS/IML</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/converting-SAS-OPTMODEL-to-SAS-IML/m-p/149182#M1321</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am converting SAS OPTMODEL codes to SAS/IML, though I am not familiar with both. OPTMODEL is easy to understand but I know IML is much more powerful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If in OPTMODEL, the variable is defined a matrix, it's easy to write constraint, such as x[i,j]-x[i,j+1]&amp;gt;=0.01.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I write the constraint in IML? The online example shows how to write constraint if the variable is a vector, I am not sure how to write when we are dealing with a matrix.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for example, how to convert x[i,j]-x[i,j-1]&amp;gt;=0.01?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Mar 2014 17:36:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/converting-SAS-OPTMODEL-to-SAS-IML/m-p/149182#M1321</guid>
      <dc:creator>neilxu</dc:creator>
      <dc:date>2014-03-19T17:36:20Z</dc:date>
    </item>
    <item>
      <title>Re: converting SAS OPTMODEL to SAS/IML</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/converting-SAS-OPTMODEL-to-SAS-IML/m-p/149183#M1322</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Actually, I would re-consider changing from OPTMODEL to IML. OPTMODEL is specifically designed for optimization and offers the newest and fastest algorithms. You can combine the best features of both IML and OPTMODEL in PROC IML, by using a submit block to run OPTMODEL specifically for the optimization phase, and use IML&amp;nbsp; for any other calculations more easily programmed in a matrix-based mathematical programming language.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Mar 2014 18:02:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/converting-SAS-OPTMODEL-to-SAS-IML/m-p/149183#M1322</guid>
      <dc:creator>Hutch_sas</dc:creator>
      <dc:date>2014-03-19T18:02:11Z</dc:date>
    </item>
    <item>
      <title>Re: converting SAS OPTMODEL to SAS/IML</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/converting-SAS-OPTMODEL-to-SAS-IML/m-p/149184#M1323</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you so much.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Mar 2014 18:19:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/converting-SAS-OPTMODEL-to-SAS-IML/m-p/149184#M1323</guid>
      <dc:creator>neilxu</dc:creator>
      <dc:date>2014-03-19T18:19:17Z</dc:date>
    </item>
    <item>
      <title>Re: converting SAS OPTMODEL to SAS/IML</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/converting-SAS-OPTMODEL-to-SAS-IML/m-p/149185#M1324</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What an interesting question!&amp;nbsp; I haven't done this before, but I think you have two options.&lt;/P&gt;&lt;P&gt;1) Put the contraint as part of the objective function. You can add a penalty to the objective function to penalize solutions that do not satisfy the constraint. For example, the following function returns 0 when x&amp;gt;a and is quadratic when x&amp;lt;a.&amp;nbsp; You can then use the sum-of-squares of the penalized matrix as a penalty function:&lt;/P&gt;&lt;P&gt;proc iml;&lt;/P&gt;&lt;P&gt;start Penalty(m, a);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; v = m-a;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return( choose(v&amp;gt;0, 0, v##2) );&lt;BR /&gt;finish;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;x = j(4,6,1); call randseed(1); call randgen(x,"normal");&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* add lines like these to objective function to penalize elements when x[i,j]-x[i,j+1]&amp;gt;=0.01 */&lt;BR /&gt;d = x[,1:ncol(x)-1] - x[,2:ncol(x)]; &lt;BR /&gt;p = ssq(penalty(d, 0.01));&lt;BR /&gt;print p;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) The BLC matrix (which stands for "boundary and linear constraints") can be used to specify constraints on adjacent elements of x. Look at the segment of the IML documentation&lt;/P&gt;&lt;P&gt;"Nonlinear Optimization Examples"--&amp;gt; "Details"--&amp;gt; "Parameter Constraints"&lt;/P&gt;&lt;P&gt;You would treat the elements of the matrix as if they were a vector (in row-major order).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Personally, I like the constraint approach.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Mar 2014 18:33:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/converting-SAS-OPTMODEL-to-SAS-IML/m-p/149185#M1324</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2014-03-19T18:33:34Z</dc:date>
    </item>
    <item>
      <title>Re: converting SAS OPTMODEL to SAS/IML</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/converting-SAS-OPTMODEL-to-SAS-IML/m-p/149186#M1325</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will take a look at the option 1.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Mar 2014 19:08:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/converting-SAS-OPTMODEL-to-SAS-IML/m-p/149186#M1325</guid>
      <dc:creator>neilxu</dc:creator>
      <dc:date>2014-03-19T19:08:22Z</dc:date>
    </item>
    <item>
      <title>Re: converting SAS OPTMODEL to SAS/IML</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/converting-SAS-OPTMODEL-to-SAS-IML/m-p/149187#M1326</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rick,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your reply. I watched your video on youtube awhile ago and I am following your blog now.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I prefer your option 1 and already did some initial work. I think it's easy to use penalty function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a followup question:&lt;/P&gt;&lt;P&gt;in OPTMODEL, the constraint is x[i,j]-x[i,j+1]&amp;gt;=0.01, however i is from 1 to nrow(x), but j is from&lt;STRONG&gt; i,&lt;/STRONG&gt; instead of &lt;STRONG&gt;1.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;How can I do it in one statement?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Mar 2014 15:30:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/converting-SAS-OPTMODEL-to-SAS-IML/m-p/149187#M1326</guid>
      <dc:creator>neilxu</dc:creator>
      <dc:date>2014-03-20T15:30:35Z</dc:date>
    </item>
    <item>
      <title>Re: converting SAS OPTMODEL to SAS/IML</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/converting-SAS-OPTMODEL-to-SAS-IML/m-p/149188#M1327</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What I would do is to put missing values in the lower triangular elements of x (or a copy of x) and then proceed as before. An easy way to access the lower triangular elements is to use the ROW function and COL function, which were introduced in SAS/IML 12.3.&amp;nbsp; If you are using an earlier version, use the definitions in the following blog post, which also shows how to define and use these function: &lt;A href="http://blogs.sas.com/content/iml/2012/02/29/defining-banded-and-triangular-matrices/" title="http://blogs.sas.com/content/iml/2012/02/29/defining-banded-and-triangular-matrices/"&gt; Defining banded and triangular matrices: Another approach - The DO Loop&lt;/A&gt;&lt;/P&gt;&lt;P&gt;The revised program might look something like this:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;/* add lines like these to objective function to penalize elements when x[i,j]-x[i,j+1]&amp;gt;=0.01, j&amp;gt;=i */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;y = x;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* copy x */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;y[ loc(row(x)&amp;gt;col(x)) ] = .; /* set lower triangular elements to missing */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;d = y[,1:ncol(x)-1] - y[,2:ncol(x)];&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;p = ssq(penalty(d, 0.01));&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Mar 2014 18:16:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/converting-SAS-OPTMODEL-to-SAS-IML/m-p/149188#M1327</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2014-03-20T18:16:23Z</dc:date>
    </item>
    <item>
      <title>Re: converting SAS OPTMODEL to SAS/IML</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/converting-SAS-OPTMODEL-to-SAS-IML/m-p/149189#M1328</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Rick.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I finished converting all constraints from OPTMODEL to IML.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The structure is like this:&lt;/P&gt;&lt;P&gt;PROC IML;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; START PENALTY FUNCTION;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FINISH;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; START OBJECTIVE FUNCTION;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NEW OBJECTIVE FUNCTION=ORIGINAL FUNCTION + PENALTY&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FINISH;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now i tried to set up the optimization part.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The initial guess is p=j(4,4,0.1) /*4 by 4 matrix*/&lt;/P&gt;&lt;P&gt;The option is opt={1,4} /*min function and print detail*/&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However I don't know how to set up constraint here. Or I don't know how to tell SAS this 4 by 4 matrix does not need any constraint (constraints are in objective function).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any suggestion?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Mar 2014 17:26:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/converting-SAS-OPTMODEL-to-SAS-IML/m-p/149189#M1328</guid>
      <dc:creator>neilxu</dc:creator>
      <dc:date>2014-03-26T17:26:03Z</dc:date>
    </item>
    <item>
      <title>Re: converting SAS OPTMODEL to SAS/IML</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/converting-SAS-OPTMODEL-to-SAS-IML/m-p/149190#M1329</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If the parameters are unconstrined, omit the constraint matrix. It is an optional argument.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Mar 2014 22:41:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/converting-SAS-OPTMODEL-to-SAS-IML/m-p/149190#M1329</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2014-03-26T22:41:29Z</dc:date>
    </item>
    <item>
      <title>Re: converting SAS OPTMODEL to SAS/IML</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/converting-SAS-OPTMODEL-to-SAS-IML/m-p/149191#M1330</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I tested my codes as followings:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; START PENALTY FUNCTION;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FINISH;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; START OBJECTIVE_FUNCTION(AAA);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NEW OBJECTIVE FUNCTION=ORIGINAL FUNCTION + PENALTY&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RETURN(ZZZ);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FINISH;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AAA={ ............};&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; test=OBJECTIVE_FUNCTION(AAA);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print test;&lt;/P&gt;&lt;P&gt;and the result is what I expect. So this part is correct.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now I remove AAA and test part, then write:&lt;/P&gt;&lt;P&gt;x0=j(4,4,0.1)&lt;/P&gt;&lt;P&gt;opt={1,4};&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call nlpnra(rc,result,'fun',x0,opt);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I got the error saying "NLPNRA call: Error in argument X0".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Either I should not use NLPNRA function nor the syntax of X0 is wrong.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Which one?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Mar 2014 15:24:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/converting-SAS-OPTMODEL-to-SAS-IML/m-p/149191#M1330</guid>
      <dc:creator>neilxu</dc:creator>
      <dc:date>2014-03-27T15:24:34Z</dc:date>
    </item>
    <item>
      <title>Re: converting SAS OPTMODEL to SAS/IML</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/converting-SAS-OPTMODEL-to-SAS-IML/m-p/149192#M1331</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Does the following work?&lt;/P&gt;&lt;P&gt;test=OBJECTIVE_FUNCTION(x0);&lt;/P&gt;&lt;P&gt;How about this?&lt;/P&gt;&lt;P&gt;call nlpnra(rc,result,'fun',AAA,opt);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Mar 2014 15:39:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/converting-SAS-OPTMODEL-to-SAS-IML/m-p/149192#M1331</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2014-03-27T15:39:07Z</dc:date>
    </item>
    <item>
      <title>Re: converting SAS OPTMODEL to SAS/IML</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/converting-SAS-OPTMODEL-to-SAS-IML/m-p/149193#M1332</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;tried test=OBJECTIVE_FUNCTION(x0);&lt;/P&gt;&lt;P&gt;no error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;tried call nlpnra(rc,result,'fun',AAA,opt);&lt;/P&gt;&lt;P&gt;no luck, same error message.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;however, if I change x0 to x0=j(1,4,0.1);&lt;/P&gt;&lt;P&gt;well, I got this&lt;/P&gt;&lt;P&gt;ERROR: (execution) Invalid subscript or subscript out of range.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;once again, thanks for your help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Mar 2014 16:03:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/converting-SAS-OPTMODEL-to-SAS-IML/m-p/149193#M1332</guid>
      <dc:creator>neilxu</dc:creator>
      <dc:date>2014-03-27T16:03:29Z</dc:date>
    </item>
    <item>
      <title>Re: converting SAS OPTMODEL to SAS/IML</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/converting-SAS-OPTMODEL-to-SAS-IML/m-p/149194#M1333</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; if you change x0 to x0=j(1,4,0.1); then x0 is a vector with four elements, which is why you get "Invalid subscript."&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is nothing more I can offer. You have not posted any code or data, so it is unlikely that I can guess the source of your problem. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Mar 2014 16:58:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/converting-SAS-OPTMODEL-to-SAS-IML/m-p/149194#M1333</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2014-03-27T16:58:52Z</dc:date>
    </item>
    <item>
      <title>Re: converting SAS OPTMODEL to SAS/IML</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/converting-SAS-OPTMODEL-to-SAS-IML/m-p/149195#M1334</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rick, the following is the sample codes I have. (I only keep one penalty value)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc iml;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; start penalty1(m,a);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; v=m-a;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return(choose(v&amp;gt;0,0,v##2));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; finish;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; start sumsqr(a) global(m1);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; d1=a[1:nrow(a)-1,1:ncol(a)];&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; p1=ssq(penalty1(d1,0.01));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ccc=(a-m1)##2;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; zzz=sum(ccc)+p1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return (zzz);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; finish;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; aaa={0.8 0.15 0.04 0.01,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.1 0.8 0.09 0.01,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.05 0.1 0.8 0.05,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 0 0 1};&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; m1={0.7 0.25 0.04 0.01,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.2 0.7 0.09 0.01,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.05 0.2 0.7 0.05,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 0 0 1};&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; test=sumsqr(aaa);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print test;&lt;/P&gt;&lt;P&gt;x0=j(4,4,0.1);&lt;/P&gt;&lt;P&gt;opt={1,4};&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call nlpnra(rc, result, "sumsqr", x0, opt);&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Mar 2014 17:09:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/converting-SAS-OPTMODEL-to-SAS-IML/m-p/149195#M1334</guid>
      <dc:creator>neilxu</dc:creator>
      <dc:date>2014-03-27T17:09:30Z</dc:date>
    </item>
    <item>
      <title>Re: converting SAS OPTMODEL to SAS/IML</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/converting-SAS-OPTMODEL-to-SAS-IML/m-p/149196#M1335</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You are trying to minimize a function, right? So use&lt;BR /&gt;opt={0,4};&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, I just realized that the NLP functions are expecting column vectors, not matrices.&lt;/P&gt;&lt;P&gt;So do this:&lt;/P&gt;&lt;P&gt;start sumsqr(_a) global(m1);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; a = shape(_a, nrow(m1), ncol(m1));&lt;/P&gt;&lt;P&gt; ...&lt;/P&gt;&lt;P&gt;finish;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and then in the main program use&lt;/P&gt;&lt;P&gt;x0 = colvec(x0);&lt;/P&gt;&lt;P&gt;before you call NLPNRA.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Mar 2014 20:58:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/converting-SAS-OPTMODEL-to-SAS-IML/m-p/149196#M1335</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2014-03-27T20:58:55Z</dc:date>
    </item>
    <item>
      <title>Re: converting SAS OPTMODEL to SAS/IML</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/converting-SAS-OPTMODEL-to-SAS-IML/m-p/149197#M1336</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Rick.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;by the way, it seems IML is faster than OPTMODEL.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Mar 2014 15:50:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/converting-SAS-OPTMODEL-to-SAS-IML/m-p/149197#M1336</guid>
      <dc:creator>neilxu</dc:creator>
      <dc:date>2014-03-28T15:50:37Z</dc:date>
    </item>
  </channel>
</rss>

