<?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: Can proc optmodel solve nonconvex MIQP problems? in Mathematical Optimization, Discrete-Event Simulation, and OR</title>
    <link>https://communities.sas.com/t5/Mathematical-Optimization/Can-proc-optmodel-solve-nonconvex-MIQP-problems/m-p/458858#M2239</link>
    <description>Not directly, but there are some indirect approaches.  What does your problem formulation look like?</description>
    <pubDate>Mon, 30 Apr 2018 22:16:17 GMT</pubDate>
    <dc:creator>RobPratt</dc:creator>
    <dc:date>2018-04-30T22:16:17Z</dc:date>
    <item>
      <title>Can proc optmodel solve nonconvex MIQP problems?</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Can-proc-optmodel-solve-nonconvex-MIQP-problems/m-p/458854#M2238</link>
      <description>&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 30 Apr 2018 21:46:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Can-proc-optmodel-solve-nonconvex-MIQP-problems/m-p/458854#M2238</guid>
      <dc:creator>jjjch</dc:creator>
      <dc:date>2018-04-30T21:46:26Z</dc:date>
    </item>
    <item>
      <title>Re: Can proc optmodel solve nonconvex MIQP problems?</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Can-proc-optmodel-solve-nonconvex-MIQP-problems/m-p/458858#M2239</link>
      <description>Not directly, but there are some indirect approaches.  What does your problem formulation look like?</description>
      <pubDate>Mon, 30 Apr 2018 22:16:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Can-proc-optmodel-solve-nonconvex-MIQP-problems/m-p/458858#M2239</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2018-04-30T22:16:17Z</dc:date>
    </item>
    <item>
      <title>Re: Can proc optmodel solve nonconvex MIQP problems?</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Can-proc-optmodel-solve-nonconvex-MIQP-problems/m-p/459056#M2240</link>
      <description>&lt;P&gt;Hi Rob, thank you very much for the reply. I created a small case to show the kind of problem I am solving.&lt;/P&gt;</description>
      <pubDate>Tue, 01 May 2018 18:58:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Can-proc-optmodel-solve-nonconvex-MIQP-problems/m-p/459056#M2240</guid>
      <dc:creator>jjjch</dc:creator>
      <dc:date>2018-05-01T18:58:04Z</dc:date>
    </item>
    <item>
      <title>Re: Can proc optmodel solve nonconvex MIQP problems?</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Can-proc-optmodel-solve-nonconvex-MIQP-problems/m-p/459414#M2244</link>
      <description>&lt;P&gt;Are G1[t] and G2[t] required to take integer values?&lt;/P&gt;</description>
      <pubDate>Wed, 02 May 2018 16:54:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Can-proc-optmodel-solve-nonconvex-MIQP-problems/m-p/459414#M2244</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2018-05-02T16:54:54Z</dc:date>
    </item>
    <item>
      <title>Re: Can proc optmodel solve nonconvex MIQP problems?</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Can-proc-optmodel-solve-nonconvex-MIQP-problems/m-p/459451#M2245</link>
      <description>No, they are continuous variables.</description>
      <pubDate>Wed, 02 May 2018 18:13:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Can-proc-optmodel-solve-nonconvex-MIQP-problems/m-p/459451#M2245</guid>
      <dc:creator>jjjch</dc:creator>
      <dc:date>2018-05-02T18:13:20Z</dc:date>
    </item>
    <item>
      <title>Re: Can proc optmodel solve nonconvex MIQP problems?</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Can-proc-optmodel-solve-nonconvex-MIQP-problems/m-p/459474#M2246</link>
      <description>&lt;P&gt;Here's a way to solve the problem with the NLP solver in PROC OPTMODEL by using PROC FCMP to define the rampLimitFunction:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data loadData;
   input t load;
   datalines;
1	100
2	100
3	100
4	110
5	120
6	130
7	170
8	210
9	220
10	230
11	240
12	235
13	245
14	250
15	260
16	270
17	300
18	300
19	290
20	280
21	270
22	260
23	200
24	150
;

proc fcmp outlib=work.funcs.test;
   function rampLimitFunction(g,x);
      if g = 1 then do;
         if x &amp;lt;= 200 then limit = 25 + ((25-5)/(200-50))*(x-200);
         else limit = 25 + ((10-25)/(300-200))*(x-200);
      end;
      else if g = 2 then do;
         if x &amp;lt;= 100 then limit = 50 + ((50-30)/(100-10))*(x-100);
         else limit = 50 + ((30-50)/(200-100))*(x-100);
      end;
      return (limit);
   endsub;
run;

option cmplib=work.funcs;

data fcmpTest1;
   do x = 50 to 300;
      y = rampLimitFunction(1,x);
      output; 
   end;
run;
proc sgplot data=fcmpTest1;
   series x=x y=y;
run;

data fcmpTest2;
   do x = 10 to 200;
      y = rampLimitFunction(2,x);
      output; 
   end;
run;
proc sgplot data=fcmpTest2;
   series x=x y=y;
run;

proc optmodel;
   set GENERATORS = 1..2;
   set PERIODS;
   num tmax = max {t in PERIODS} t;
   num q {GENERATORS} = [0.1 0.2];
   num c {GENERATORS} = [20 30];
   num load {PERIODS};
   read data loadData into PERIODS=[t] load;

   var Output {GENERATORS, PERIODS};
   min Objective = sum {g in GENERATORS, t in PERIODS} 
      (q[g]*Output[g,t]^2 + c[g]*Output[g,t]);
   con MeetLoad {t in PERIODS}:
      sum {g in GENERATORS} Output[g,t] = load[t];
   for {t in PERIODS} do;
      Output[1,t].lb = 50;
      Output[1,t].ub = 300;
      Output[2,t].lb = 10;
      Output[2,t].ub = 200;
   end;
   con RampLower {g in GENERATORS, t in PERIODS diff {tmax}}:
      -rampLimitFunction(g,Output[g,t]) &amp;lt;= Output[g,t+1] - Output[g,t];
   con RampUpper {g in GENERATORS, t in PERIODS diff {tmax}}:
      rampLimitFunction(g,Output[g,t]) &amp;gt;= Output[g,t+1] - Output[g,t];

   solve;
   print Output;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 02 May 2018 19:35:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Can-proc-optmodel-solve-nonconvex-MIQP-problems/m-p/459474#M2246</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2018-05-02T19:35:47Z</dc:date>
    </item>
    <item>
      <title>Re: Can proc optmodel solve nonconvex MIQP problems?</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Can-proc-optmodel-solve-nonconvex-MIQP-problems/m-p/459530#M2248</link>
      <description>&lt;P&gt;Thank you very much! Your model is clearer and easier than I thought because your &lt;SPAN&gt;rampLimitFunction&lt;/SPAN&gt; has if statements. I originally thought I will need to introduce a integer variable for each segment of the rampLimit function for each hour each generator. But is it easy to extend the model to include 1000 generators and each rampLimitFunction can have up to 10 segments? Looks like the rampLimitFunction will be very large and hard to write manually.&lt;/P&gt;</description>
      <pubDate>Thu, 03 May 2018 02:07:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Can-proc-optmodel-solve-nonconvex-MIQP-problems/m-p/459530#M2248</guid>
      <dc:creator>jjjch</dc:creator>
      <dc:date>2018-05-03T02:07:21Z</dc:date>
    </item>
    <item>
      <title>Re: Can proc optmodel solve nonconvex MIQP problems?</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Can-proc-optmodel-solve-nonconvex-MIQP-problems/m-p/459686#M2249</link>
      <description>&lt;P&gt;Here's an alternative approach that uses implicit variables instead of PROC FCMP.&amp;nbsp; First populate a data set:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data rampData;
   input generator breakpoint output rate;
   datalines;
1 1  50  5
1 2 200 25
1 3 300 10
2 1  10 30
2 2 100 50
2 3 200 30
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And then use the IMPVAR statement in PROC OPTMODEL:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;   set BREAKPOINTS = 1..3;
   num output_gb {GENERATORS, BREAKPOINTS};
   num rate_gb {GENERATORS, BREAKPOINTS};
   read data rampData into [generator breakpoint] output_gb=output rate_gb=rate;
   impvar RampLimitFunction {g in GENERATORS, t in PERIODS} = 
      if Output[g,t] &amp;lt;= output_gb[g,2]
      then rate_gb[g,1] + ((rate_gb[g,2]-rate_gb[g,1])/(output_gb[g,2]-output_gb[g,1]))*(Output[g,t]-output_gb[g,1])
      else rate_gb[g,2] + ((rate_gb[g,3]-rate_gb[g,2])/(output_gb[g,3]-output_gb[g,2]))*(Output[g,t]-output_gb[g,2]);
   con RampLower {g in GENERATORS, t in PERIODS diff {tmax}}:
      -RampLimitFunction[g,t] &amp;lt;= Output[g,t+1] - Output[g,t];
   con RampUpper {g in GENERATORS, t in PERIODS diff {tmax}}:
      RampLimitFunction[g,t] &amp;gt;= Output[g,t+1] - Output[g,t];
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;For either approach, if you have more generators and segments, you can use the SAS macro language to generate the RampLimitFunction code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 May 2018 14:34:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Can-proc-optmodel-solve-nonconvex-MIQP-problems/m-p/459686#M2249</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2018-05-03T14:34:51Z</dc:date>
    </item>
    <item>
      <title>Re: Can proc optmodel solve nonconvex MIQP problems?</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Can-proc-optmodel-solve-nonconvex-MIQP-problems/m-p/459727#M2250</link>
      <description>&lt;P&gt;&lt;SPAN&gt;RobPratt, thank you! It is amazing that impvar&amp;nbsp;can have if statement too, which simplify the model a lot.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 03 May 2018 16:22:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Can-proc-optmodel-solve-nonconvex-MIQP-problems/m-p/459727#M2250</guid>
      <dc:creator>jjjch</dc:creator>
      <dc:date>2018-05-03T16:22:03Z</dc:date>
    </item>
    <item>
      <title>Re: Can proc optmodel solve nonconvex MIQP problems?</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Can-proc-optmodel-solve-nonconvex-MIQP-problems/m-p/459779#M2251</link>
      <description>&lt;P&gt;Glad to help.&amp;nbsp; I should mention that you can make the code more data driven by introducing a data set:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data generatorData;
   input generator q c lb ub;
   datalines;
1 0.1 20 50 300
2 0.2 30 10 200
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And then reading the data in PROC OPTMODEL:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;   set GENERATORS;
   num q {GENERATORS};
   num c {GENERATORS};
   num lb {GENERATORS};
   num ub {GENERATORS};
   read data generatorData into GENERATORS=[generator] q c lb ub;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then you can include the bounds in the VAR statement:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;   var Output {g in GENERATORS, PERIODS} &amp;gt;= lb[g] &amp;lt;= ub[g];
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 03 May 2018 18:00:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Can-proc-optmodel-solve-nonconvex-MIQP-problems/m-p/459779#M2251</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2018-05-03T18:00:43Z</dc:date>
    </item>
  </channel>
</rss>

