<?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: Binary Variables Definition in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Binary-Variables-Definition/m-p/153435#M1402</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is what I recommend, going back to my earlier suggestion.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) generate all possible c vectors&lt;/P&gt;&lt;P&gt;2) for each c vector, solve the optimization problem treating the c as a constant.&lt;/P&gt;&lt;P&gt;this gives you a simple optimization problem with linear constraints.&lt;/P&gt;&lt;P&gt;3) the c vector that gives you the best optimum value coresponds to your global optimum value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's how to get started:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Create a module that solves the problem for a given c vector, treating c as a constant, like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;start optimize(opt_value, opt_vec) global( c);&lt;/P&gt;&lt;P&gt;/* set up constraints */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; call nlpqn(rc, opt_vec, "objective_function"....); /* do optimization&amp;nbsp; for a given c vector*/&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; opt_value = objective_function(opt_vec);&lt;/P&gt;&lt;P&gt;finish;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then loop through all the possible values of c:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ncoeff = 6; /* total number of c variables */&lt;/P&gt;&lt;P&gt;subset_size = 4; /* number of c variables to set to 1 */&lt;/P&gt;&lt;P&gt;perms = allcomb(ncoeff,subset_size); /* get all permutations of 4 out of 6 elements */&lt;/P&gt;&lt;P&gt;optval = 1e30; /* initialize to some some huge value */&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do i = 1 to nrow(perms);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; /* set up c vector */&lt;/P&gt;&lt;P&gt;&amp;nbsp; c = j(ncoeff, 1, 0);&lt;/P&gt;&lt;P&gt;&amp;nbsp; c[&amp;nbsp; perms[i,],&amp;nbsp;&amp;nbsp; 1&amp;nbsp; ] = 1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; run optimize(value, vector);&lt;/P&gt;&lt;P&gt;&amp;nbsp; if value &amp;lt; optval then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* save optimal values */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; optval = value;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; optvec = vector;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; optc = c;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now you should have your optimum decision variables in optvec and optc and your optimum value in optval&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 22 Nov 2013 21:50:10 GMT</pubDate>
    <dc:creator>Hutch_sas</dc:creator>
    <dc:date>2013-11-22T21:50:10Z</dc:date>
    <item>
      <title>Binary Variables Definition</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Binary-Variables-Definition/m-p/153421#M1388</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a decision variable (x) that should be outputted from an optimization problem&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This variable should be outputted as binary, taking only the values of "0" OR "1"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I define that at SAS proc iml?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As I can't find a syntax that puts that as a condition&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In addition, I tried the below equation to be added to the constraints of my optimization problem, which ends up with the same meaning, but it gave no results&lt;/P&gt;&lt;P&gt;x*(1-x)=0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this is very urgent and I have due date with very limited timingssssssssssss&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks a lot&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Nov 2013 12:39:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Binary-Variables-Definition/m-p/153421#M1388</guid>
      <dc:creator>Yasmine</dc:creator>
      <dc:date>2013-11-22T12:39:37Z</dc:date>
    </item>
    <item>
      <title>Re: Binary Variables Definition</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Binary-Variables-Definition/m-p/153422#M1389</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In the SAS DATA step and in PROC IML you can form a logical expression that evaluates to true (1) or false (0).&lt;BR /&gt;For example, if you want to return 1 when x&amp;gt;0.7, just write&lt;/P&gt;&lt;P&gt;result = ( x&amp;gt;0.7 ); /* 0 or 1 */&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Nov 2013 12:47:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Binary-Variables-Definition/m-p/153422#M1389</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2013-11-22T12:47:16Z</dc:date>
    </item>
    <item>
      <title>Re: Binary Variables Definition</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Binary-Variables-Definition/m-p/153423#M1390</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;sorry cant get what you mean quite well,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;here are the below equations that I need to write at sas proc iml:&lt;/P&gt;&lt;P&gt;b+0.1*c&amp;gt;0&lt;/P&gt;&lt;P&gt;where b is a decision variable representing my coefficients at the model&lt;/P&gt;&lt;P&gt;c is a binary decision variable that should be outputted as 0 or 1, so how can I express that at my iml program? &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Nov 2013 12:56:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Binary-Variables-Definition/m-p/153423#M1390</guid>
      <dc:creator>Yasmine</dc:creator>
      <dc:date>2013-11-22T12:56:10Z</dc:date>
    </item>
    <item>
      <title>Re: Binary Variables Definition</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Binary-Variables-Definition/m-p/153424#M1391</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are you using the NLPQN function? If so, I think you need to specify the nonlinear constraint by using the NLC= option. See&lt;/P&gt;&lt;P&gt;the doc chapter &lt;A href="http://support.sas.com/documentation/cdl/en/imlug/66112/HTML/default/viewer.htm#imlug_nonlinearoptexpls_sect015.htm"&gt;"Nonlinear Optimization Examples: Parameter Constraints"&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Nov 2013 14:18:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Binary-Variables-Definition/m-p/153424#M1391</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2013-11-22T14:18:55Z</dc:date>
    </item>
    <item>
      <title>Re: Binary Variables Definition</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Binary-Variables-Definition/m-p/153425#M1392</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;unfortunately, that doesn't solve my problem:&lt;/P&gt;&lt;P&gt;the below is my model I need to write at sas proc iml:&lt;/P&gt;&lt;P&gt;b(i)-0.1*c(i)&amp;gt;0&lt;/P&gt;&lt;P&gt;b(i)-c(i)&amp;lt;0&lt;/P&gt;&lt;P&gt;sum c(i)=4;&lt;/P&gt;&lt;P&gt;given that i=1.........6&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;these equations shows that: if c (it is outputted) =1, then 0.1&amp;lt;b&amp;lt;1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;and if c=0, then b=0&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;This means that I need 4 c's =1 and 2 c's =0&lt;/P&gt;&lt;P&gt;and also I need 2 b's=0 and 4 b's having values ranging from 0.1 to 1&lt;/P&gt;&lt;P&gt;where b is a decision variable representing my coefficients at the model&lt;/P&gt;&lt;P&gt;c is a binary decision variable that should be outputted as 0 or 1, so how can I express that at my iml program? &lt;/P&gt;&lt;P&gt;did you get what I am trying to output?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Nov 2013 14:38:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Binary-Variables-Definition/m-p/153425#M1392</guid>
      <dc:creator>Yasmine</dc:creator>
      <dc:date>2013-11-22T14:38:50Z</dc:date>
    </item>
    <item>
      <title>Re: Binary Variables Definition</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Binary-Variables-Definition/m-p/153426#M1393</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;One quick and dirty way to handle this would be to enumerate the 15 different possibilites for c and optimize b individually for each sub-problem.&amp;nbsp; Are you trying to solve just this specific problem or is it an example of a more general problem you are trying to solve?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Nov 2013 15:32:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Binary-Variables-Definition/m-p/153426#M1393</guid>
      <dc:creator>Hutch_sas</dc:creator>
      <dc:date>2013-11-22T15:32:05Z</dc:date>
    </item>
    <item>
      <title>Re: Binary Variables Definition</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Binary-Variables-Definition/m-p/153427#M1394</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Wow, that would be too difficult as that is just an example of equations at many problems I am trying to handle &lt;img id="smileysad" class="emoticon emoticon-smileysad" src="https://communities.sas.com/i/smilies/16x16_smiley-sad.png" alt="Smiley Sad" title="Smiley Sad" /&gt;&lt;/P&gt;&lt;P&gt;are there any other ways of solving that problem? I have been trying to solve that problem for several monthsssssssssssss&lt;/P&gt;&lt;P&gt;PLEASE HELPPPPPPPPP&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Nov 2013 15:40:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Binary-Variables-Definition/m-p/153427#M1394</guid>
      <dc:creator>Yasmine</dc:creator>
      <dc:date>2013-11-22T15:40:35Z</dc:date>
    </item>
    <item>
      <title>Re: Binary Variables Definition</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Binary-Variables-Definition/m-p/153428#M1395</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;what is your objective function?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Nov 2013 16:15:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Binary-Variables-Definition/m-p/153428#M1395</guid>
      <dc:creator>Hutch_sas</dc:creator>
      <dc:date>2013-11-22T16:15:26Z</dc:date>
    </item>
    <item>
      <title>Re: Binary Variables Definition</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Binary-Variables-Definition/m-p/153429#M1396</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Depending on the problem size and your objective function, there are different ways to solve the problem you describe. If your objective function is linear, then you have a Mixed Integer Linear Program. If you have SAS/OR available to you, then you can use PROC OPTMILP to solve that directly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If your objective function is a general non-linear function, then you have a Mixed Integer Non-linear Programming problem (MINLP) which in general is difficult to solve. If that is the case then in IML your best bet would be to use the Genetic Algorithm routines to try and solve your problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you are trying to fit a traditional statistical model&amp;nbsp; like a linear or logistic regression, then SAS/STAT offers extensive variable selection algorithms you can use to find the optimal set of decision variables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Perhaps if you would describe the original problem that would help in figuring out the best way to solve it..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Nov 2013 17:27:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Binary-Variables-Definition/m-p/153429#M1396</guid>
      <dc:creator>Hutch_sas</dc:creator>
      <dc:date>2013-11-22T17:27:57Z</dc:date>
    </item>
    <item>
      <title>Re: Binary Variables Definition</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Binary-Variables-Definition/m-p/153430#M1397</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try using the &lt;A href="http://en.wikipedia.org/wiki/Augmented_Lagrangian_Method"&gt;augmented Lagrangian method&lt;/A&gt;. The method gets rid of the nonlinear constraint by rewriting the objective function to include a penalty term.&amp;nbsp; By adding a "nuisance parameterm," you can solve the original problem.&amp;nbsp; For example, you might try introducing a new parameter lambda&amp;gt;0 and optimizing the objective function&lt;/P&gt;&lt;P&gt;OrigObjective + lambda*x*(1-x) + 10000*(x*(1-x))##2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In order to get rid of the penalty terms, x will be driven to 0 or 1 during the optimization.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Nov 2013 17:58:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Binary-Variables-Definition/m-p/153430#M1397</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2013-11-22T17:58:34Z</dc:date>
    </item>
    <item>
      <title>Re: Binary Variables Definition</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Binary-Variables-Definition/m-p/153431#M1398</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is my model:&lt;/P&gt;&lt;P&gt;Minimize dp+dn&lt;/P&gt;&lt;P&gt;subject to&lt;BR /&gt;b0+biXij+dn-dp=0&lt;/P&gt;&lt;P&gt;bi-0.1*ci&amp;gt;0&lt;/P&gt;&lt;P&gt;bi-ci&amp;lt;0&lt;/P&gt;&lt;P&gt;sum ci=4&lt;/P&gt;&lt;P&gt;where i=1..........6&lt;/P&gt;&lt;P&gt;j is my set of observations&lt;/P&gt;&lt;P&gt;and my decision variables are:&lt;/P&gt;&lt;P&gt;b, dp, dn, and c&lt;/P&gt;&lt;P&gt;hope that makes my problem more clear for you to please assisttttttttttttttttt&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Nov 2013 18:34:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Binary-Variables-Definition/m-p/153431#M1398</guid>
      <dc:creator>Yasmine</dc:creator>
      <dc:date>2013-11-22T18:34:48Z</dc:date>
    </item>
    <item>
      <title>Re: Binary Variables Definition</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Binary-Variables-Definition/m-p/153432#M1399</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I need also to make a simulation for that problem?&lt;/P&gt;&lt;P&gt;and also sometimes I have non-linear constraints at another problem I am doing simulation for and using at that stage nlpqn at sas proc iml&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Nov 2013 18:35:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Binary-Variables-Definition/m-p/153432#M1399</guid>
      <dc:creator>Yasmine</dc:creator>
      <dc:date>2013-11-22T18:35:56Z</dc:date>
    </item>
    <item>
      <title>Re: Binary Variables Definition</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Binary-Variables-Definition/m-p/153433#M1400</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This appears to be a MILP problem. The best SAS tool to solve this would be PROC OPTMILP in SAS/OR. Do you have that&lt;BR /&gt;available?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Nov 2013 19:49:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Binary-Variables-Definition/m-p/153433#M1400</guid>
      <dc:creator>Hutch_sas</dc:creator>
      <dc:date>2013-11-22T19:49:36Z</dc:date>
    </item>
    <item>
      <title>Re: Binary Variables Definition</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Binary-Variables-Definition/m-p/153434#M1401</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;unfortunately no &lt;img id="smileysad" class="emoticon emoticon-smileysad" src="https://communities.sas.com/i/smilies/16x16_smiley-sad.png" alt="Smiley Sad" title="Smiley Sad" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;is there any other way using sas proc iml please?&lt;/P&gt;&lt;P&gt;I am using nlpqn call&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Nov 2013 20:00:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Binary-Variables-Definition/m-p/153434#M1401</guid>
      <dc:creator>Yasmine</dc:creator>
      <dc:date>2013-11-22T20:00:05Z</dc:date>
    </item>
    <item>
      <title>Re: Binary Variables Definition</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Binary-Variables-Definition/m-p/153435#M1402</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is what I recommend, going back to my earlier suggestion.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) generate all possible c vectors&lt;/P&gt;&lt;P&gt;2) for each c vector, solve the optimization problem treating the c as a constant.&lt;/P&gt;&lt;P&gt;this gives you a simple optimization problem with linear constraints.&lt;/P&gt;&lt;P&gt;3) the c vector that gives you the best optimum value coresponds to your global optimum value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's how to get started:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Create a module that solves the problem for a given c vector, treating c as a constant, like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;start optimize(opt_value, opt_vec) global( c);&lt;/P&gt;&lt;P&gt;/* set up constraints */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; call nlpqn(rc, opt_vec, "objective_function"....); /* do optimization&amp;nbsp; for a given c vector*/&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; opt_value = objective_function(opt_vec);&lt;/P&gt;&lt;P&gt;finish;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then loop through all the possible values of c:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ncoeff = 6; /* total number of c variables */&lt;/P&gt;&lt;P&gt;subset_size = 4; /* number of c variables to set to 1 */&lt;/P&gt;&lt;P&gt;perms = allcomb(ncoeff,subset_size); /* get all permutations of 4 out of 6 elements */&lt;/P&gt;&lt;P&gt;optval = 1e30; /* initialize to some some huge value */&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do i = 1 to nrow(perms);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; /* set up c vector */&lt;/P&gt;&lt;P&gt;&amp;nbsp; c = j(ncoeff, 1, 0);&lt;/P&gt;&lt;P&gt;&amp;nbsp; c[&amp;nbsp; perms[i,],&amp;nbsp;&amp;nbsp; 1&amp;nbsp; ] = 1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; run optimize(value, vector);&lt;/P&gt;&lt;P&gt;&amp;nbsp; if value &amp;lt; optval then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* save optimal values */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; optval = value;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; optvec = vector;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; optc = c;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now you should have your optimum decision variables in optvec and optc and your optimum value in optval&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Nov 2013 21:50:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Binary-Variables-Definition/m-p/153435#M1402</guid>
      <dc:creator>Hutch_sas</dc:creator>
      <dc:date>2013-11-22T21:50:10Z</dc:date>
    </item>
    <item>
      <title>Re: Binary Variables Definition</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Binary-Variables-Definition/m-p/153436#M1403</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks a lot for your support &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;but the problem is that sometimes sum of c's can be equal to 6, 5, 4, 3, 2 OR 1&lt;/P&gt;&lt;P&gt;the sum of c's should take a value that gives the best optimization solution&lt;/P&gt;&lt;P&gt;so now I will be having a big big big bundle of permutations, so are there any new options???????&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sorry for the disturbance and thanks for the support !!!!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 23 Nov 2013 08:41:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Binary-Variables-Definition/m-p/153436#M1403</guid>
      <dc:creator>Yasmine</dc:creator>
      <dc:date>2013-11-23T08:41:02Z</dc:date>
    </item>
    <item>
      <title>Re: Binary Variables Definition</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Binary-Variables-Definition/m-p/153437#M1404</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;any help, pleaseeeeeeeeeeee?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 24 Nov 2013 17:43:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Binary-Variables-Definition/m-p/153437#M1404</guid>
      <dc:creator>Yasmine</dc:creator>
      <dc:date>2013-11-24T17:43:17Z</dc:date>
    </item>
  </channel>
</rss>

