<?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 find the BEST combination of two CID to Score this?! in Mathematical Optimization, Discrete-Event Simulation, and OR</title>
    <link>https://communities.sas.com/t5/Mathematical-Optimization/How-to-find-the-BEST-combination-of-two-CID-to-Score-this/m-p/975223#M4358</link>
    <description>&lt;P&gt;The final result is 1 or 0 for the 18 treatments.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It would be 18 1/0 for the 18 treatments, with the final TOTAL SCORE [or total_scores for top candidates].&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 17 Sep 2025 10:52:07 GMT</pubDate>
    <dc:creator>hellohere</dc:creator>
    <dc:date>2025-09-17T10:52:07Z</dc:date>
    <item>
      <title>How to find the BEST combination of two CID to Score this?!</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/How-to-find-the-BEST-combination-of-two-CID-to-Score-this/m-p/975130#M4346</link>
      <description>&lt;P&gt;&lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/1636" target="_blank"&gt;@RobPratt&lt;/A&gt;&amp;nbsp;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have the dataset, attached.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are two dates[dt] and each has bloc 3~9[bloc]. Tried with 18 conditions[condi_id].&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The goal is to find the best TWO-condition combination to meet the GOAL/PENALITY:&lt;/P&gt;
&lt;P&gt;1)&amp;nbsp; Meet _tmin_orig &amp;gt; _tmin OR&amp;nbsp;_tmin_orig &amp;gt; _tmin_ew OR&amp;nbsp;_tmin_orig &amp;gt; _tmin_wt_r OR&amp;nbsp;_tmin_orig &amp;gt; _tmin_wt_r2.&lt;/P&gt;
&lt;P&gt;IF YES, score ONE/1; IF NOT, score -5/Negative 5&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any help are welcome. Thanks,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dataset.png" style="width: 595px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/109996i3DF946416DF1B6A8/image-size/large?v=v2&amp;amp;px=999" role="button" title="dataset.png" alt="dataset.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Sep 2025 23:46:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/How-to-find-the-BEST-combination-of-two-CID-to-Score-this/m-p/975130#M4346</guid>
      <dc:creator>hellohere</dc:creator>
      <dc:date>2025-09-15T23:46:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the BEST combination of two CID to Score this?!</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/How-to-find-the-BEST-combination-of-two-CID-to-Score-this/m-p/975143#M4347</link>
      <description>So what is your Object Function ? and what is your desired output ?</description>
      <pubDate>Tue, 16 Sep 2025 06:31:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/How-to-find-the-BEST-combination-of-two-CID-to-Score-this/m-p/975143#M4347</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2025-09-16T06:31:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the BEST combination of two CID to Score this?!</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/How-to-find-the-BEST-combination-of-two-CID-to-Score-this/m-p/975145#M4348</link>
      <description>&lt;P&gt;To MAXize the SCORE.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;OUTPUT, the 1/0 for choice on the 2-cid combination.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;</description>
      <pubDate>Tue, 16 Sep 2025 08:47:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/How-to-find-the-BEST-combination-of-two-CID-to-Score-this/m-p/975145#M4348</guid>
      <dc:creator>hellohere</dc:creator>
      <dc:date>2025-09-16T08:47:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the BEST combination of two CID to Score this?!</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/How-to-find-the-BEST-combination-of-two-CID-to-Score-this/m-p/975146#M4349</link>
      <description>2-cid combination is picking up 2 condi_id or 2 bloc ?&lt;BR /&gt;Your group variable is dt or bloc or dt+bloc ?&lt;BR /&gt;&lt;BR /&gt;Since you only could get 1 or -5 ,that means pick up two 1s is the best choice. You can calculate the score for each row and pick the best combination by hand , right ?</description>
      <pubDate>Tue, 16 Sep 2025 08:59:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/How-to-find-the-BEST-combination-of-two-CID-to-Score-this/m-p/975146#M4349</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2025-09-16T08:59:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the BEST combination of two CID to Score this?!</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/How-to-find-the-BEST-combination-of-two-CID-to-Score-this/m-p/975158#M4350</link>
      <description>&lt;P&gt;group variables are date[dt] and bloc[bloc]. SCORE for each row is ready to calculation.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need find the best two-condition[condi_id] combination to have the highest SCORE.&lt;/P&gt;
&lt;P&gt;NOTE, here is correlation between .&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is my first OBJective. The second&amp;nbsp; OBJECTIVE is to MAXimize the difference between _tmin_ORIG and one out of the 4 _tmin_xxx&lt;/P&gt;
&lt;P&gt;with constraint of SCORE &amp;gt; a certain Threshold.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cannot by hand. Need OPT.&amp;nbsp; I can do it with Solver inside EXCEL. But later with huge dataset, it is feasible.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Sep 2025 11:22:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/How-to-find-the-BEST-combination-of-two-CID-to-Score-this/m-p/975158#M4350</guid>
      <dc:creator>hellohere</dc:creator>
      <dc:date>2025-09-16T11:22:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the BEST combination of two CID to Score this?!</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/How-to-find-the-BEST-combination-of-two-CID-to-Score-this/m-p/975170#M4351</link>
      <description>&lt;P&gt;MAXimize The SUM of each SCORE&lt;/P&gt;</description>
      <pubDate>Tue, 16 Sep 2025 15:35:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/How-to-find-the-BEST-combination-of-two-CID-to-Score-this/m-p/975170#M4351</guid>
      <dc:creator>hellohere</dc:creator>
      <dc:date>2025-09-16T15:35:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the BEST combination of two CID to Score this?!</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/How-to-find-the-BEST-combination-of-two-CID-to-Score-this/m-p/975171#M4352</link>
      <description>&lt;P&gt;To help clarify the problem, can you please share a feasible (not necessarily optimal) solution and the corresponding objective values?&lt;/P&gt;</description>
      <pubDate>Tue, 16 Sep 2025 15:55:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/How-to-find-the-BEST-combination-of-two-CID-to-Score-this/m-p/975171#M4352</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2025-09-16T15:55:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the BEST combination of two CID to Score this?!</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/How-to-find-the-BEST-combination-of-two-CID-to-Score-this/m-p/975181#M4353</link>
      <description>&lt;P&gt;Here are 18 treatments[/conditions],&amp;nbsp; take 1/0 on each treatment/condition,&amp;nbsp; there are 100+ combination of two-treatment/condition combinations.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The Goal is the find the highest sum of SCORE.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Each Column's Score is either 1 [meet the&amp;nbsp; criteria _tmin_orig&amp;gt;one of four _tmin_xxx] Or -5 if not meet the criteria.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So the output is the binary 1/0[pick or not-pick] on the 18 treatments [2 out 18 is 1 and the left over is 0]&lt;/P&gt;
&lt;P&gt;and the final sum of SCORE.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Sep 2025 17:58:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/How-to-find-the-BEST-combination-of-two-CID-to-Score-this/m-p/975181#M4353</guid>
      <dc:creator>hellohere</dc:creator>
      <dc:date>2025-09-16T17:58:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the BEST combination of two CID to Score this?!</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/How-to-find-the-BEST-combination-of-two-CID-to-Score-this/m-p/975188#M4354</link>
      <description>&lt;P&gt;Here's a way to use the runOptmodel action with groupBy to solve a separate problem for each dt and bloc:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
   set lib.mmind_temp_x;
   if _tmin_orig &amp;gt; _tmin OR _tmin_orig &amp;gt; _tmin_ew OR _tmin_orig &amp;gt; _tmin_wt_r OR _tmin_orig &amp;gt; _tmin_wt_r2
   then score = 1;
   else score = -5;
run;

data mycas.have;
   set have;
run;

proc cas;
   source pgm;
      /* read input data */
      set IDS;
      num score {IDS};
      read data have into IDS=[condi_id] score;

      /* define optimization model */
      var Select {IDS} binary;
      max TotalScore = sum {i in IDS} score[i] * Select[i];
      con Cardinality:
         sum {i in IDS} Select[i] = 2;

      /* call MILP solver */
      solve;

      /* create output data */
      create data want from [condi_id] score Select;
   endsource;

   action optimization.runOptmodel / code=pgm groupBy={'dt','bloc'};
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But you can get the same results by sorting in descending order of score and keeping the top two:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=have out=want;
   by dt bloc descending score;
run;&lt;BR /&gt;
data want;
   set want;
   by dt bloc;
   retain rank;
   if first.bloc then rank = 1;
   else rank + 1;
   Select = (rank &amp;lt;= 2);
run;
&lt;BR /&gt;proc sort data=want;
   by dt bloc condi_id;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 16 Sep 2025 19:40:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/How-to-find-the-BEST-combination-of-two-CID-to-Score-this/m-p/975188#M4354</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2025-09-16T19:40:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the BEST combination of two CID to Score this?!</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/How-to-find-the-BEST-combination-of-two-CID-to-Score-this/m-p/975196#M4355</link>
      <description>&lt;P&gt;Thanks.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But I do not have PROC CAS.&amp;nbsp; PC SAS. Anyway by other PROC?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I thought there is correlation between so not simply by sorting. I cannot verify the two yet.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Sep 2025 01:50:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/How-to-find-the-BEST-combination-of-two-CID-to-Score-this/m-p/975196#M4355</guid>
      <dc:creator>hellohere</dc:creator>
      <dc:date>2025-09-17T01:50:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the BEST combination of two CID to Score this?!</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/How-to-find-the-BEST-combination-of-two-CID-to-Score-this/m-p/975206#M4356</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/1636"&gt;@RobPratt&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here are 18 treatments, and to pick 2 out 18. Either 1 of 2 picks , BY DT and BLOC, meets the condition [_tmin_orig &amp;gt; 1/4 _tmin_XXX],&amp;nbsp;&lt;/P&gt;
&lt;P&gt;for that DT-&amp;amp;-BLOC, score is 1; If both do not meet score -5, The GOAL is MAXimize the SUM of score for each DT/BLOC.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I run the code below (NOT OPT). It appears not what desired.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=have out=want;
   by dt bloc descending score;
run;
data want;
   set want;
   by dt bloc;
   retain rank;
   if first.bloc then rank = 1;
   else rank + 1;
   Select = (rank &amp;lt;= 2);
run;
proc sort data=want;
   by dt bloc condi_id;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Sep 2025 07:12:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/How-to-find-the-BEST-combination-of-two-CID-to-Score-this/m-p/975206#M4356</guid>
      <dc:creator>hellohere</dc:creator>
      <dc:date>2025-09-17T07:12:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the BEST combination of two CID to Score this?!</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/How-to-find-the-BEST-combination-of-two-CID-to-Score-this/m-p/975208#M4357</link>
      <description>Can you post an example to explain why it is not what you are looking for?&lt;BR /&gt;E.X.&lt;BR /&gt;dt block  condi_id  score&lt;BR /&gt;1      1               1             4&lt;BR /&gt;1      1               2             3&lt;BR /&gt;1       1              3              2&lt;BR /&gt;1       1               4             1&lt;BR /&gt;&lt;BR /&gt;Why the first two obs is not what you are looking for ?</description>
      <pubDate>Wed, 17 Sep 2025 07:23:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/How-to-find-the-BEST-combination-of-two-CID-to-Score-this/m-p/975208#M4357</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2025-09-17T07:23:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the BEST combination of two CID to Score this?!</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/How-to-find-the-BEST-combination-of-two-CID-to-Score-this/m-p/975223#M4358</link>
      <description>&lt;P&gt;The final result is 1 or 0 for the 18 treatments.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It would be 18 1/0 for the 18 treatments, with the final TOTAL SCORE [or total_scores for top candidates].&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Sep 2025 10:52:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/How-to-find-the-BEST-combination-of-two-CID-to-Score-this/m-p/975223#M4358</guid>
      <dc:creator>hellohere</dc:creator>
      <dc:date>2025-09-17T10:52:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the BEST combination of two CID to Score this?!</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/How-to-find-the-BEST-combination-of-two-CID-to-Score-this/m-p/975236#M4359</link>
      <description>&lt;P&gt;Please disregard this thread.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/1636"&gt;@RobPratt&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let me re-group and repost with clean clarification on the quest.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Sep 2025 13:51:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/How-to-find-the-BEST-combination-of-two-CID-to-Score-this/m-p/975236#M4359</guid>
      <dc:creator>hellohere</dc:creator>
      <dc:date>2025-09-17T13:51:49Z</dc:date>
    </item>
  </channel>
</rss>

