<?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: Constraint with disjoint intervals in Mathematical Optimization, Discrete-Event Simulation, and OR</title>
    <link>https://communities.sas.com/t5/Mathematical-Optimization/Constraint-with-disjoint-intervals/m-p/571269#M2815</link>
    <description>&lt;P&gt;What does the rest of your model look like?&lt;/P&gt;</description>
    <pubDate>Thu, 04 Jul 2019 18:07:55 GMT</pubDate>
    <dc:creator>RobPratt</dc:creator>
    <dc:date>2019-07-04T18:07:55Z</dc:date>
    <item>
      <title>Constraint with disjoint intervals</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Constraint-with-disjoint-intervals/m-p/571209#M2812</link>
      <description>&lt;P&gt;I need to set a constraint like this:&amp;nbsp;&lt;STRONG&gt;x in [1,2] or x = 0&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;I tried with&lt;/P&gt;
&lt;PRE&gt;constraint c1: 1 &amp;lt;= x &amp;lt;=2 or x = 0&lt;/PRE&gt;
&lt;P&gt;but it doesn't work. What is the right syntax?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jul 2019 10:36:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Constraint-with-disjoint-intervals/m-p/571209#M2812</guid>
      <dc:creator>Edoedoedo</dc:creator>
      <dc:date>2019-07-04T10:36:58Z</dc:date>
    </item>
    <item>
      <title>Re: Constraint with disjoint intervals</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Constraint-with-disjoint-intervals/m-p/571261#M2813</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc optmodel;
   var X &amp;gt;= 0 &amp;lt;= 2;
   var Y binary;

   /* if Y = 0 then X &amp;lt;= 0, else X &amp;lt;= X.ub (redundant) */
   con C1: X &amp;lt;= X.ub * Y;

   /* if Y = 1 then X &amp;gt;= 1, else X &amp;gt;= 0 (redundant) */
   con C2: X &amp;gt;= Y;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jul 2019 16:25:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Constraint-with-disjoint-intervals/m-p/571261#M2813</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2019-07-04T16:25:00Z</dc:date>
    </item>
    <item>
      <title>Re: Constraint with disjoint intervals</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Constraint-with-disjoint-intervals/m-p/571266#M2814</link>
      <description>&lt;P&gt;Thanks! Unfortunately my problem is non linear, so the solver is nlp.&lt;/P&gt;
&lt;P&gt;And using binary variables, it says:&lt;/P&gt;
&lt;PRE id="pre_sasLog_3715" class="sasLog" style="background-color: transparent; -webkit-user-select: text; -webkit-user-modify: read-only; -webkit-touch-callout: default; border-top-width: 0px; border-bottom-width: 0px;"&gt;ERROR: The NLP solver does not allow integer variables.&lt;/PRE&gt;</description>
      <pubDate>Thu, 04 Jul 2019 17:58:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Constraint-with-disjoint-intervals/m-p/571266#M2814</guid>
      <dc:creator>Edoedoedo</dc:creator>
      <dc:date>2019-07-04T17:58:16Z</dc:date>
    </item>
    <item>
      <title>Re: Constraint with disjoint intervals</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Constraint-with-disjoint-intervals/m-p/571269#M2815</link>
      <description>&lt;P&gt;What does the rest of your model look like?&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jul 2019 18:07:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Constraint-with-disjoint-intervals/m-p/571269#M2815</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2019-07-04T18:07:55Z</dc:date>
    </item>
    <item>
      <title>Re: Constraint with disjoint intervals</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Constraint-with-disjoint-intervals/m-p/571270#M2816</link>
      <description>&lt;P&gt;Here is the whole model:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc fcmp outlib=work.funcs.f;
    function f1(Q, H);
        return (
          (7.18895803108255)+(Q)*(0.90898166129053)+(H)*(-0.52518338771685)+(Q**2)*(-0.07243939757267)+(Q)*(H)*(-0.0101157174044)+(H**2)*(0.01140027697845)+(Q**3)*(0.00271247731414)+(Q**2)*(H)*(0.00078575662965)+(Q)*(H**2)*(-8.0331130545237E-7)+(H**3)*(-0.00010011945215)+(Q**4)*(-0.00005707623607)+(Q**3)*(H)*(-0.0000145464761)+(Q**2)*(H**2)*(-4.0740624504878E-6)+(Q)*(H**3)*(5.6715539778245E-7)+(H**4)*(3.0399728809992E-7)+(Q**5)*(6.2706019750555E-7)+(Q**4)*(H)*(-4.9275589970883E-8)+(Q**3)*(H**2)*(1.1402170133176E-7)+(Q**2)*(H**3)*(-1.1450221400824E-8)
        );
    endsub;

    function f2(Q, H);
        return (
          (9.56532591440209)+(Q)*(1.56477959347719)+(H)*(-0.58834848839521)+(Q**2)*(-0.14923333670627)+(Q)*(H)*(-0.02042582402532)+(H**2)*(0.01042030607175)+(Q**3)*(0.00551139580932)+(Q**2)*(H)*(0.00200710134061)+(Q)*(H**2)*(0.00006229314138)+(H**3)*(-0.00006493899805)+(Q**4)*(-0.00009774971067)+(Q**3)*(H)*(-0.00004756024059)+(Q**2)*(H**2)*(-0.00001062838926)+(Q)*(H**3)*(3.7950591182214E-7)+(Q**5)*(8.5938390272548E-7)+(Q**4)*(H)*(1.7658335207072E-7)+(Q**3)*(H**2)*(2.2050828738805E-7)+(H**5)*(8.7276517928309E-10)
        );
    endsub;
    
    function g1(Q1,Q2); return ( 0.003134  * ((Q1+Q2)**2) + 0.003089 * (Q1**2) ); endsub;
    function g2(Q1,Q2); return ( 0.003134  * ((Q1+Q2)**2) + 0.003089 * (Q2**2) ); endsub;
run;

%let Q1max = 30.4;
%let Q2max = 29.5;
%let P1min = 2.5;
%let P2min = 3.3;
%let P1max = 21.7;
%let P2max = 21.6;
%let PSETL = 1;
%let PSETR = 43;
%let HSETL = 70;
%let HSETR = 94;
%let STEP  = 0.5;


options cmplib=work.funcs;

proc optmodel nthreads=64;
   number P;
   number H;

   var Q1 &amp;gt;= 0 &amp;lt;= &amp;amp;Q1max;
   var Q2 &amp;gt;= 0 &amp;lt;= &amp;amp;Q2max;
   
   impvar HL1 = H - g1(Q1,Q2);
   impvar HL2 = H - g2(Q1,Q2);

   impvar P1 = Q1 * HL1 * f1(Q1, HL1) * 9.81 / 1000;
   impvar P2 = Q2 * HL2 * f2(Q2, HL2) * 9.81 / 1000;

   minimize Q = Q1 + Q2;

   constraint P = P1 + P2;

   constraint 0 &amp;lt;= P1 &amp;lt;= &amp;amp;P1max; /* (*) */
   constraint 0 &amp;lt;= P2 &amp;lt;= &amp;amp;P2max; /* (*) */

   set PSET = &amp;amp;PSETL .. &amp;amp;PSETR by &amp;amp;STEP;
   set HSET = &amp;amp;HSETL .. &amp;amp;HSETR by &amp;amp;STEP;

   num Qopt {PSET, HSET};
   num Q1opt {PSET, HSET};
   num Q2opt {PSET, HSET};
   num P1opt {PSET, HSET};
   num P2opt {PSET, HSET};
   str solstatus {PSET, HSET};
   num opterror {PSET, HSET};
   do P = PSET;
	  do H = HSET;
		solve with nlp / maxiter=10000 multistart=(maxstarts=10) seed=54321;
		put P= H= HL1= HL2= P1= P2= Q1= Q2= _solution_status_=;
		Qopt[P,H] = Q.sol;
		Q1opt[P,H] = Q1.sol;
		Q2opt[P,H] = Q2.sol;
		P1opt[P,H] = P1;
		P2opt[P,H] = P2;
		solstatus[P,H] = _solution_status_;
		opterror[P,H] = _OROPTMODEL_NUM_['OPTIMALITY_ERROR'];
	  end;
   end;
   create data Qdata from [P H] P1opt P2opt Q1opt Q2opt Qopt solstatus opterror;
quit;


&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Look at the rows marked with (*)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;constraint 0 &amp;lt;= P1 &amp;lt;= &amp;amp;P1max; /* (*) */
constraint 0 &amp;lt;= P2 &amp;lt;= &amp;amp;P2max; /* (*) */&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;As you can see, P1 and P2 have 0 as lower bound, and it worked very well. Now I'm asked to restrict P1 and P2 interval from [0,PMAX] to [PMIN, PMAX], &lt;U&gt;but&lt;/U&gt; zero must remain allowed, so the constraints should become&lt;/P&gt;
&lt;PRE&gt;(P1 = 0) OR (&amp;amp;P1min &amp;lt;= P1 &amp;lt;= &amp;amp;P1max)
(P2 = 0) OR (&amp;amp;P2min &amp;lt;= P2 &amp;lt;= &amp;amp;P2max)&lt;/PRE&gt;
&lt;P&gt;Hence this question. I hope I made myself clear now!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks again,&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jul 2019 18:25:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Constraint-with-disjoint-intervals/m-p/571270#M2816</guid>
      <dc:creator>Edoedoedo</dc:creator>
      <dc:date>2019-07-04T18:25:39Z</dc:date>
    </item>
    <item>
      <title>Re: Constraint with disjoint intervals</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Constraint-with-disjoint-intervals/m-p/571274#M2817</link>
      <description>&lt;P&gt;I have suggestions for two alternative approaches.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One approach is to use the LSO solver:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;   var Y1 binary;
   con P1 &amp;lt;= &amp;amp;P1max * Y1;
   con P1 &amp;gt;= Y1;
   var Y2 binary;
   con P2 &amp;lt;= &amp;amp;P2max * Y2;
   con P2 &amp;gt;= Y2;&lt;BR /&gt;&lt;BR /&gt;   /* and then replace the SOLVE statement as follows */ &lt;BR /&gt;&amp;nbsp;  solve with lso;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The second approach, based on the fact that you have only two disjunctions is to solve four problems and keep the best solution:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Fix P1 = 0 and P2 = 0.&lt;/LI&gt;
&lt;LI&gt;Fix P1 = 0 and impose range constraint&amp;nbsp;&amp;amp;P2min &amp;lt;= P2 &amp;lt;= &amp;amp;P2max.&lt;/LI&gt;
&lt;LI&gt;Fix P2 = 0 and impose range constraint&amp;nbsp;&amp;amp;P1min &amp;lt;= P1 &amp;lt;= &amp;amp;P1max.&lt;/LI&gt;
&lt;LI&gt;Impose two range constraints&amp;nbsp;&amp;amp;P1min &amp;lt;= P1 &amp;lt;= &amp;amp;P1max and&amp;nbsp; &amp;amp;P2min &amp;lt;= P2 &amp;lt;= &amp;amp;P2max.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By the way, the following additional approaches are valid syntax but unlikely to work well:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;   constraint (P1 = 0 OR &amp;amp;P1min &amp;lt;= P1 &amp;lt;= &amp;amp;P1max) &amp;gt;= 1;
   constraint (P2 = 0 OR &amp;amp;P2min &amp;lt;= P2 &amp;lt;= &amp;amp;P2max) &amp;gt;= 1;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;   constraint (P1 = 0) + (&amp;amp;P1min &amp;lt;= P1 &amp;lt;= &amp;amp;P1max) &amp;gt;= 1;
   constraint (P2 = 0) + (&amp;amp;P2min &amp;lt;= P2 &amp;lt;= &amp;amp;P2max) &amp;gt;= 1;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 04 Jul 2019 19:24:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Constraint-with-disjoint-intervals/m-p/571274#M2817</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2019-07-04T19:24:49Z</dc:date>
    </item>
    <item>
      <title>Re: Constraint with disjoint intervals</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Constraint-with-disjoint-intervals/m-p/571333#M2818</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks, we are getting closer&amp;nbsp;&lt;img id="smileyvery-happy" class="emoticon emoticon-smileyvery-happy" src="https://communities.sas.com/i/smilies/16x16_smiley-very-happy.png" alt="Smiley Very Happy" title="Smiley Very Happy" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;About the first approach with lso. I tried to run the model without changing the constraints (so my original problem) to see what are the results comparing nlp with lso.&lt;/P&gt;
&lt;P&gt;Let me explain the result: the variables the model finds are Q1 and Q2, for every P and H in a grid (as you can see in the code); then I calculate P1 and P2, and since P1+P2=P I calculate the ratio P1/P to get one number as result; in this way, when the ratio is 100% it means that P1=P and P2=0, when it is 0% it means that P1=0 and P2=P, otherwise 0 &amp;lt; P1,P2 &amp;lt; P.&lt;/P&gt;
&lt;P&gt;In the following graph I display in the P,H grid, this ratio with color: yellow (ratio=100%) blue (ratio=0%) brownish (0 &amp;lt; ratio &amp;lt; 100).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's the solution with nlp:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ott1.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/30765i5F07B1FF3B1F0E75/image-size/large?v=v2&amp;amp;px=999" role="button" title="ott1.png" alt="ott1.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's the solution with lso:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ott2.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/30766iCEBDB717027B48A9/image-size/large?v=v2&amp;amp;px=999" role="button" title="ott2.png" alt="ott2.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;The solution with nlp makes a lot of sense (from the physical point of view of the thing I'm optimizing): when P is low, P1=P and P2=0; when P is medium, P1=0 and P2=P; when P is high, a combination of P1 and P2 is used. And you can see from the picture a sense of "continuity" in the grid. I know it may sound obscure but trust me this result is good!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now the solution with lso seems a lot more noisy: the sense of "continuity" seems not to apply, and also the P low/medium/high is unclear. So before modify the constraint to fit the new problem of this thread, I'd like to get a more stable solution with lso, as "good" as the nlp one. Do you know if the lso can be configured to be more accurate? I read the doc and I saw a lot of parameters, I'm not sure about what to do to improve the results.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As for the second approach: yes I taught about this, and I believe it works fine. However for now I wrote the model with two "units" (you can see the reference to indexes "1" and "2" all over the code), but I'm sure I will be asked later to generalize it to work with N "units". So with N "units", I should have to solve 2^N-1 problems with all the combinations of P_i (zero or non zero) and then compare them, and it sounds hard...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As for the thirds approach, I haven't tried yet, but I think it will not be accurate at all since in this way the error on constraints won't have a metric to see how wrong it is, it would only get a flag "correct" "incorrect".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks again,&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jul 2019 08:29:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Constraint-with-disjoint-intervals/m-p/571333#M2818</guid>
      <dc:creator>Edoedoedo</dc:creator>
      <dc:date>2019-07-05T08:29:04Z</dc:date>
    </item>
    <item>
      <title>Re: Constraint with disjoint intervals</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Constraint-with-disjoint-intervals/m-p/571509#M2819</link>
      <description>&lt;P&gt;Could you please try the experiment with these options:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;solve with lso / absfconv=1e-10 nabsfconv=100 maxgen=500 popsize=500 feastol=1e-7;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Increasing the popsize often improves the solution quality. &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jul 2019 21:56:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Constraint-with-disjoint-intervals/m-p/571509#M2819</guid>
      <dc:creator>josgri</dc:creator>
      <dc:date>2019-07-05T21:56:02Z</dc:date>
    </item>
    <item>
      <title>Re: Constraint with disjoint intervals</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Constraint-with-disjoint-intervals/m-p/571595#M2820</link>
      <description>&lt;P&gt;Unfortunately the solution got worse...&lt;/P&gt;
&lt;P&gt;Here's the result, and most of the points have status MAXGEN instead of ABSFCON.&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="ott3.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/30806i9F529477994AB7A2/image-size/large?v=v2&amp;amp;px=999" role="button" title="ott3.png" alt="ott3.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 06 Jul 2019 18:42:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Constraint-with-disjoint-intervals/m-p/571595#M2820</guid>
      <dc:creator>Edoedoedo</dc:creator>
      <dc:date>2019-07-06T18:42:26Z</dc:date>
    </item>
    <item>
      <title>Re: Constraint with disjoint intervals</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Constraint-with-disjoint-intervals/m-p/571626#M2821</link>
      <description>&lt;P&gt;That is unfortunate.&amp;nbsp; It may be LSO is not a good fit.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I did try the first problem to verify LSO gave comparable results, but did not have time to run through the entire list.&amp;nbsp; If you had an instance in the loop where the objective Q.sol is much worse, that would help to diagnose.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Looking closer, I didn't realize the constraints were nonlinear.&amp;nbsp; The feastol is likely too tight as LSO is a DFO algorithm.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you have time/interest, could you rerun but replace the solve command with:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;solve with lso / absfconv=1e-6 nabsfconv=100 maxgen=100 popsize=500 feastol=1e-3;&lt;BR /&gt;solve with nlp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The second nlp solve is to increase the feasibility of the solution found.&amp;nbsp; When moving to binary we can can add a relaxint option that may work analogously for the mixed integer case.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks. &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 07 Jul 2019 03:08:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Constraint-with-disjoint-intervals/m-p/571626#M2821</guid>
      <dc:creator>josgri</dc:creator>
      <dc:date>2019-07-07T03:08:26Z</dc:date>
    </item>
    <item>
      <title>Re: Constraint with disjoint intervals</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Constraint-with-disjoint-intervals/m-p/571705#M2822</link>
      <description>&lt;P&gt;Yes the constraints are nonlinear, but they are "nice" (in the sense that they are almost always polynomials and in general continuous and derivable, that is why I expect this sense of continuity of the solutions over the grid).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I picked up these two instances:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1)&lt;/P&gt;
&lt;P&gt;P=6, H=85.&lt;/P&gt;
&lt;P&gt;With nlp: Q1=9.58, Q2=0.00, Q=9.58 (status=OPTIMAL).&lt;/P&gt;
&lt;P&gt;With lso: Q1=5.30, Q2=7.60, Q=12.90 (status=MAXGEN).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2)&lt;/P&gt;
&lt;P&gt;P=10, H=91.5.&lt;/P&gt;
&lt;P&gt;With nlp: Q1=13.63, Q2=0.00, Q=13.63 (status=OPTIMAL).&lt;/P&gt;
&lt;P&gt;With lso: Q1=7.26, Q2=9.52, Q=16.78 (status=ABSFCON).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'll try to rerun it with the double solve command.&lt;/P&gt;
&lt;P&gt;In the mean time I think I'll start to implement approach no.2, let's see if it's reliable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks again for all you suggestions!&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jul 2019 07:11:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Constraint-with-disjoint-intervals/m-p/571705#M2822</guid>
      <dc:creator>Edoedoedo</dc:creator>
      <dc:date>2019-07-08T07:11:10Z</dc:date>
    </item>
    <item>
      <title>Re: Constraint with disjoint intervals</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Constraint-with-disjoint-intervals/m-p/571788#M2823</link>
      <description>&lt;P&gt;Thanks a lot for the two examples!&amp;nbsp; I was able to get similar solutions (using sledgehammer sized population:) if I used these two solve commands:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;solve with lso / absfconv=1e-6 nabsfconv=10 maxgen=10 popsize=10000 feastol=1e-2; &lt;BR /&gt;solve with nlp /algorithm=as;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But this could be a game of wack-a-mole.&amp;nbsp; Also it is much slower ... so likely a dead-end unless no 2 does not help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks a lot for the examples.&amp;nbsp; For better or worse, LSO treats all problems as black-boxes and avoids assumptions about derivatives existing.&amp;nbsp; So it may continue to optimize when other solvers get stuck--the price is when derivatives do exist it will still tick-tack to the solution.&amp;nbsp; Thus in general, if everything insight is smooth, the nlp solvers are more appropriate.&amp;nbsp; But adding binary variables will of course induce some (albeit structured) non-smoothness ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jul 2019 14:38:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Constraint-with-disjoint-intervals/m-p/571788#M2823</guid>
      <dc:creator>josgri</dc:creator>
      <dc:date>2019-07-08T14:38:52Z</dc:date>
    </item>
    <item>
      <title>Re: Constraint with disjoint intervals</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Constraint-with-disjoint-intervals/m-p/571830#M2824</link>
      <description>&lt;P&gt;This is something we could do for you in the next release.&amp;nbsp; But for now would need to be done manually:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One potential heuristic to overcome this hurdle if N "units" is greater than 2 is to create a binary LHS sampling (over which variables should be fixed at 0 and which should be free) that predetermines which variables will get fixed for a set of B "tests".&amp;nbsp; There is example code here:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.linkedin.com/pulse/latin-hypercube-sampling-emily-gao/" target="_blank"&gt;https://www.linkedin.com/pulse/latin-hypercube-sampling-emily-gao/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I.e. you could create an LHS sample over the unit-hypercube that is stored in data set "T" that is B x N and read into optmodel. For the ith row of T you would solve a nlp problem where Qj is fixed at 0 if Tij &amp;lt;= .5 and&amp;nbsp; So how many NLP problems you solve is controllable and a function of the number of "experiments" you decide to generate. &amp;nbsp;&amp;nbsp; It is of course a heuristic ...&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jul 2019 15:48:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Constraint-with-disjoint-intervals/m-p/571830#M2824</guid>
      <dc:creator>josgri</dc:creator>
      <dc:date>2019-07-08T15:48:43Z</dc:date>
    </item>
  </channel>
</rss>

