<?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 Staffing Problem  - NLP Solver does not allow integer problems - &amp;quot;Bad Problem Type&amp;quot; in Mathematical Optimization, Discrete-Event Simulation, and OR</title>
    <link>https://communities.sas.com/t5/Mathematical-Optimization/Staffing-Problem-NLP-Solver-does-not-allow-integer-problems-quot/m-p/508541#M2472</link>
    <description>&lt;P&gt;I have a fairly simple staffing problem. Optimize the minimum number of unfilled hourly slots and number of FTEs per shift with all possible 8 hours shifts in a 24 hour period. All FTEShifts are integer.&lt;BR /&gt;The log message from SAS is as follows: The NLP Solver does not allow integer problems". Results says "bad problem type".&lt;BR /&gt;Removing the integer restriction allows execution, but it is the not the desired solution, as I need integer solutions with the best fit.&lt;BR /&gt;How should I proceed? Thank you for your review.&lt;BR /&gt;The code sample is below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data goal;&lt;BR /&gt;input day $ Hr00 Hr01 Hr02 Hr03 Hr04 Hr05 Hr06 Hr07 Hr08 Hr09 Hr10 Hr11 Hr12 Hr13 Hr14 Hr15 Hr16 Hr17 Hr18 Hr19 Hr20 Hr21 Hr22 Hr23;&lt;BR /&gt;datalines;&lt;BR /&gt;Hol 0.5 0.5 0.5 0.44 0.47 0.61 0.5 1.72 2.28 2.6 2.49 2.52 2.03 1.65 1.42 0.93 1.03 0.75 0.73 0.43 0.54 0.36 0.39 0.25&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;data weight;&lt;BR /&gt;input Hr00 Hr01 Hr02 Hr03 Hr04 Hr05 Hr06 Hr07 Hr08 Hr09 Hr10 Hr11 Hr12 Hr13 Hr14 Hr15 Hr16 Hr17 Hr18 Hr19 Hr20 Hr21 Hr22 Hr23;&lt;BR /&gt;datalines;&lt;BR /&gt;1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;data Staffing_Shifts;&lt;BR /&gt;input Start_Time :TIME5. End_Time :TIME5. Shift_Number Shift_Label :$11. Shift_Duration Hr00 Hr01 Hr02 Hr03 Hr04 Hr05 Hr06 Hr07 Hr08 Hr09 Hr10 Hr11 Hr12 Hr13 Hr14 Hr15 Hr16 Hr17 Hr18 Hr19 Hr20 Hr21 Hr22 Hr23;&lt;BR /&gt;format Start_Time End_Time TIME5.;&lt;BR /&gt;datalines;&lt;BR /&gt;00:00 08:00 01 00:00-08:00 8 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0&lt;BR /&gt;01:00 09:00 02 01:00-09:00 8 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0&lt;BR /&gt;02:00 10:00 03 02:00-10:00 8 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0&lt;BR /&gt;03:00 11:00 04 03:00-11:00 8 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0&lt;BR /&gt;04:00 12:00 05 04:00-12:00 8 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0&lt;BR /&gt;05:00 13:00 06 05:00-13:00 8 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0&lt;BR /&gt;06:00 14:00 07 06:00-14:00 8 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0&lt;BR /&gt;07:00 15:00 08 07:00-15:00 8 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0&lt;BR /&gt;08:00 16:00 09 08:00-16:00 8 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0&lt;BR /&gt;09:00 17:00 10 09:00-17:00 8 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0&lt;BR /&gt;10:00 18:00 11 10:00-18:00 8 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0&lt;BR /&gt;11:00 19:00 12 11:00-19:00 8 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0&lt;BR /&gt;12:00 20:00 13 12:00-20:00 8 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0&lt;BR /&gt;13:00 21:00 14 13:00-21:00 8 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0&lt;BR /&gt;14:00 22:00 15 14:00-22:00 8 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0&lt;BR /&gt;15:00 23:00 16 15:00-23:00 8 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0&lt;BR /&gt;16:00 00:00 17 16:00-00:00 8 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1&lt;BR /&gt;17:00 01:00 18 17:00-01:00 8 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1&lt;BR /&gt;18:00 02:00 19 18:00-02:00 8 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1&lt;BR /&gt;19:00 03:00 20 19:00-03:00 8 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1&lt;BR /&gt;20:00 04:00 21 20:00-04:00 8 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1&lt;BR /&gt;21:00 05:00 22 21:00-05:00 8 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1&lt;BR /&gt;22:00 06:00 23 22:00-06:00 8 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1&lt;BR /&gt;23:00 07:00 24 23:00-07:00 8 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;%let name=Ver0.1;&lt;BR /&gt;TITLE "&amp;amp;name - Version 1" ;&lt;/P&gt;&lt;P&gt;%let NPERIODS=24;&lt;BR /&gt;%let NSHIFTS=24;&lt;BR /&gt;%let MAXSHIFTS=10;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc optmodel PRINTLEVEL=2;&lt;BR /&gt;var FTEPerShift{1..24} &amp;gt;= 0 &amp;lt;= &amp;amp;MAXSHIFTS integer;&lt;/P&gt;&lt;P&gt;/* Shifts - each has different start and stop time periods, and total times&lt;BR /&gt;Rooms - number of rooms needed at each time period&lt;BR /&gt;Weights - relative importance of each time period&lt;BR /&gt;*/&lt;BR /&gt;&lt;BR /&gt;set PERIODS = 0..23;&lt;BR /&gt;set SHIFTS = 1..24;&lt;/P&gt;&lt;P&gt;/* &lt;A href="http://support.sas.com/documentation/cdl/en/ormpug/59679/HTML/default/viewer.htm#optmodel_sect44.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/ormpug/59679/HTML/default/viewer.htm#optmodel_sect44.htm&lt;/A&gt; */&lt;BR /&gt;str GoalWeekDay;&lt;BR /&gt;num InputPeriods{PERIODS};&lt;BR /&gt;read data goal into&lt;BR /&gt;GoalWeekDay=day&lt;BR /&gt;{ p in PERIODS} &amp;lt; InputPeriods[p]=col("Hr"||put(p,z2.) ) &amp;gt;;&lt;BR /&gt;print GoalWeekDay InputPeriods ;&lt;/P&gt;&lt;P&gt;/* Round up for GOAL per Period */&lt;BR /&gt;num Goal{PERIODS};&lt;BR /&gt;for {p in PERIODS}&lt;BR /&gt;Goal[p] = round(InputPeriods[p]+0.5,1);&lt;BR /&gt;print Goal;&lt;/P&gt;&lt;P&gt;/* Get Weighting per Period */&lt;BR /&gt;num Weighting{PERIODS};&lt;BR /&gt;read data weight into&lt;BR /&gt;{ p in PERIODS} &amp;lt; Weighting[p]=col("Hr"||put(p,z2.) ) &amp;gt;;&lt;BR /&gt;print Weighting;&lt;/P&gt;&lt;P&gt;str ShiftLabel{SHIFTS} ;&lt;BR /&gt;num StartTime{SHIFTS}, EndTime{SHIFTS}, ShiftDuration{SHIFTS} ;&lt;BR /&gt;set &amp;lt;num&amp;gt; ShiftNumber ;&lt;/P&gt;&lt;P&gt;num FTEperShiftPeriod{SHIFTS,PERIODS};&lt;/P&gt;&lt;P&gt;read data Staffing_Shifts into&lt;BR /&gt;ShiftNumber =[_N_]&lt;BR /&gt;ShiftLabel =shift_label&lt;BR /&gt;StartTime[_N_]=start_time&lt;BR /&gt;EndTime[_N_]=end_time&lt;BR /&gt;ShiftDuration[_N_]=Shift_Duration&lt;BR /&gt;{ p in PERIODS} &amp;lt; FTEperShiftPeriod[_N_,p]=col("Hr"||put(p,z2.) ) &amp;gt;;&lt;/P&gt;&lt;P&gt;print ShiftLabel StartTime EndTime ShiftDuration FTEperShiftPeriod ;&lt;/P&gt;&lt;P&gt;num FTEShiftPeriod{SHIFTS,PERIODS};&lt;BR /&gt;num FTEPeriod{PERIODS};&lt;/P&gt;&lt;P&gt;/* W O R K I N G S E C T I O N */&lt;BR /&gt;/* Calculate the number per Shift */&lt;BR /&gt;&lt;BR /&gt;for {s in SHIFTS,p in PERIODS} FTEShiftPeriod[s,p] = FTEPerShift[s].sol * FTEperShiftPeriod[s,p];&lt;/P&gt;&lt;P&gt;/* */&lt;BR /&gt;for {p in PERIODS} FTEPeriod[p] = sum {s in SHIFTS} FTEShiftPeriod[s,p];&lt;BR /&gt;&lt;BR /&gt;/* G O A L */&lt;BR /&gt;min TtlDifference = sum {p in PERIODS} ABS( Goal[p]-FTEPeriod[p] ) * Weighting[p];&lt;BR /&gt;&lt;BR /&gt;expand;&lt;/P&gt;&lt;P&gt;solve;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;print TtlShifts TtlDifference FTEPerShift;&lt;BR /&gt;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/* *************************&lt;BR /&gt;* End of 01-SimnpleStaff24&lt;BR /&gt;* ************************* */&lt;/P&gt;</description>
    <pubDate>Mon, 29 Oct 2018 23:06:18 GMT</pubDate>
    <dc:creator>SSTEAD</dc:creator>
    <dc:date>2018-10-29T23:06:18Z</dc:date>
    <item>
      <title>Staffing Problem  - NLP Solver does not allow integer problems - "Bad Problem Type"</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Staffing-Problem-NLP-Solver-does-not-allow-integer-problems-quot/m-p/508541#M2472</link>
      <description>&lt;P&gt;I have a fairly simple staffing problem. Optimize the minimum number of unfilled hourly slots and number of FTEs per shift with all possible 8 hours shifts in a 24 hour period. All FTEShifts are integer.&lt;BR /&gt;The log message from SAS is as follows: The NLP Solver does not allow integer problems". Results says "bad problem type".&lt;BR /&gt;Removing the integer restriction allows execution, but it is the not the desired solution, as I need integer solutions with the best fit.&lt;BR /&gt;How should I proceed? Thank you for your review.&lt;BR /&gt;The code sample is below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data goal;&lt;BR /&gt;input day $ Hr00 Hr01 Hr02 Hr03 Hr04 Hr05 Hr06 Hr07 Hr08 Hr09 Hr10 Hr11 Hr12 Hr13 Hr14 Hr15 Hr16 Hr17 Hr18 Hr19 Hr20 Hr21 Hr22 Hr23;&lt;BR /&gt;datalines;&lt;BR /&gt;Hol 0.5 0.5 0.5 0.44 0.47 0.61 0.5 1.72 2.28 2.6 2.49 2.52 2.03 1.65 1.42 0.93 1.03 0.75 0.73 0.43 0.54 0.36 0.39 0.25&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;data weight;&lt;BR /&gt;input Hr00 Hr01 Hr02 Hr03 Hr04 Hr05 Hr06 Hr07 Hr08 Hr09 Hr10 Hr11 Hr12 Hr13 Hr14 Hr15 Hr16 Hr17 Hr18 Hr19 Hr20 Hr21 Hr22 Hr23;&lt;BR /&gt;datalines;&lt;BR /&gt;1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;data Staffing_Shifts;&lt;BR /&gt;input Start_Time :TIME5. End_Time :TIME5. Shift_Number Shift_Label :$11. Shift_Duration Hr00 Hr01 Hr02 Hr03 Hr04 Hr05 Hr06 Hr07 Hr08 Hr09 Hr10 Hr11 Hr12 Hr13 Hr14 Hr15 Hr16 Hr17 Hr18 Hr19 Hr20 Hr21 Hr22 Hr23;&lt;BR /&gt;format Start_Time End_Time TIME5.;&lt;BR /&gt;datalines;&lt;BR /&gt;00:00 08:00 01 00:00-08:00 8 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0&lt;BR /&gt;01:00 09:00 02 01:00-09:00 8 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0&lt;BR /&gt;02:00 10:00 03 02:00-10:00 8 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0&lt;BR /&gt;03:00 11:00 04 03:00-11:00 8 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0&lt;BR /&gt;04:00 12:00 05 04:00-12:00 8 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0&lt;BR /&gt;05:00 13:00 06 05:00-13:00 8 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0&lt;BR /&gt;06:00 14:00 07 06:00-14:00 8 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0&lt;BR /&gt;07:00 15:00 08 07:00-15:00 8 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0&lt;BR /&gt;08:00 16:00 09 08:00-16:00 8 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0&lt;BR /&gt;09:00 17:00 10 09:00-17:00 8 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0&lt;BR /&gt;10:00 18:00 11 10:00-18:00 8 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0&lt;BR /&gt;11:00 19:00 12 11:00-19:00 8 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0&lt;BR /&gt;12:00 20:00 13 12:00-20:00 8 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0&lt;BR /&gt;13:00 21:00 14 13:00-21:00 8 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0&lt;BR /&gt;14:00 22:00 15 14:00-22:00 8 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0&lt;BR /&gt;15:00 23:00 16 15:00-23:00 8 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0&lt;BR /&gt;16:00 00:00 17 16:00-00:00 8 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1&lt;BR /&gt;17:00 01:00 18 17:00-01:00 8 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1&lt;BR /&gt;18:00 02:00 19 18:00-02:00 8 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1&lt;BR /&gt;19:00 03:00 20 19:00-03:00 8 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1&lt;BR /&gt;20:00 04:00 21 20:00-04:00 8 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1&lt;BR /&gt;21:00 05:00 22 21:00-05:00 8 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1&lt;BR /&gt;22:00 06:00 23 22:00-06:00 8 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1&lt;BR /&gt;23:00 07:00 24 23:00-07:00 8 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;%let name=Ver0.1;&lt;BR /&gt;TITLE "&amp;amp;name - Version 1" ;&lt;/P&gt;&lt;P&gt;%let NPERIODS=24;&lt;BR /&gt;%let NSHIFTS=24;&lt;BR /&gt;%let MAXSHIFTS=10;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc optmodel PRINTLEVEL=2;&lt;BR /&gt;var FTEPerShift{1..24} &amp;gt;= 0 &amp;lt;= &amp;amp;MAXSHIFTS integer;&lt;/P&gt;&lt;P&gt;/* Shifts - each has different start and stop time periods, and total times&lt;BR /&gt;Rooms - number of rooms needed at each time period&lt;BR /&gt;Weights - relative importance of each time period&lt;BR /&gt;*/&lt;BR /&gt;&lt;BR /&gt;set PERIODS = 0..23;&lt;BR /&gt;set SHIFTS = 1..24;&lt;/P&gt;&lt;P&gt;/* &lt;A href="http://support.sas.com/documentation/cdl/en/ormpug/59679/HTML/default/viewer.htm#optmodel_sect44.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/ormpug/59679/HTML/default/viewer.htm#optmodel_sect44.htm&lt;/A&gt; */&lt;BR /&gt;str GoalWeekDay;&lt;BR /&gt;num InputPeriods{PERIODS};&lt;BR /&gt;read data goal into&lt;BR /&gt;GoalWeekDay=day&lt;BR /&gt;{ p in PERIODS} &amp;lt; InputPeriods[p]=col("Hr"||put(p,z2.) ) &amp;gt;;&lt;BR /&gt;print GoalWeekDay InputPeriods ;&lt;/P&gt;&lt;P&gt;/* Round up for GOAL per Period */&lt;BR /&gt;num Goal{PERIODS};&lt;BR /&gt;for {p in PERIODS}&lt;BR /&gt;Goal[p] = round(InputPeriods[p]+0.5,1);&lt;BR /&gt;print Goal;&lt;/P&gt;&lt;P&gt;/* Get Weighting per Period */&lt;BR /&gt;num Weighting{PERIODS};&lt;BR /&gt;read data weight into&lt;BR /&gt;{ p in PERIODS} &amp;lt; Weighting[p]=col("Hr"||put(p,z2.) ) &amp;gt;;&lt;BR /&gt;print Weighting;&lt;/P&gt;&lt;P&gt;str ShiftLabel{SHIFTS} ;&lt;BR /&gt;num StartTime{SHIFTS}, EndTime{SHIFTS}, ShiftDuration{SHIFTS} ;&lt;BR /&gt;set &amp;lt;num&amp;gt; ShiftNumber ;&lt;/P&gt;&lt;P&gt;num FTEperShiftPeriod{SHIFTS,PERIODS};&lt;/P&gt;&lt;P&gt;read data Staffing_Shifts into&lt;BR /&gt;ShiftNumber =[_N_]&lt;BR /&gt;ShiftLabel =shift_label&lt;BR /&gt;StartTime[_N_]=start_time&lt;BR /&gt;EndTime[_N_]=end_time&lt;BR /&gt;ShiftDuration[_N_]=Shift_Duration&lt;BR /&gt;{ p in PERIODS} &amp;lt; FTEperShiftPeriod[_N_,p]=col("Hr"||put(p,z2.) ) &amp;gt;;&lt;/P&gt;&lt;P&gt;print ShiftLabel StartTime EndTime ShiftDuration FTEperShiftPeriod ;&lt;/P&gt;&lt;P&gt;num FTEShiftPeriod{SHIFTS,PERIODS};&lt;BR /&gt;num FTEPeriod{PERIODS};&lt;/P&gt;&lt;P&gt;/* W O R K I N G S E C T I O N */&lt;BR /&gt;/* Calculate the number per Shift */&lt;BR /&gt;&lt;BR /&gt;for {s in SHIFTS,p in PERIODS} FTEShiftPeriod[s,p] = FTEPerShift[s].sol * FTEperShiftPeriod[s,p];&lt;/P&gt;&lt;P&gt;/* */&lt;BR /&gt;for {p in PERIODS} FTEPeriod[p] = sum {s in SHIFTS} FTEShiftPeriod[s,p];&lt;BR /&gt;&lt;BR /&gt;/* G O A L */&lt;BR /&gt;min TtlDifference = sum {p in PERIODS} ABS( Goal[p]-FTEPeriod[p] ) * Weighting[p];&lt;BR /&gt;&lt;BR /&gt;expand;&lt;/P&gt;&lt;P&gt;solve;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;print TtlShifts TtlDifference FTEPerShift;&lt;BR /&gt;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/* *************************&lt;BR /&gt;* End of 01-SimnpleStaff24&lt;BR /&gt;* ************************* */&lt;/P&gt;</description>
      <pubDate>Mon, 29 Oct 2018 23:06:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Staffing-Problem-NLP-Solver-does-not-allow-integer-problems-quot/m-p/508541#M2472</guid>
      <dc:creator>SSTEAD</dc:creator>
      <dc:date>2018-10-29T23:06:18Z</dc:date>
    </item>
    <item>
      <title>Re: Staffing Problem  - NLP Solver does not allow integer problems - "Bad Problem Type"</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Staffing-Problem-NLP-Solver-does-not-allow-integer-problems-quot/m-p/508544#M2473</link>
      <description>&lt;P&gt;You can linearize the absolute error objective as follows:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;impvar FTEShiftPeriod {s in SHIFTS,p in PERIODS} = FTEPerShift[s] * FTEperShiftPeriod[s,p];
impvar FTEPeriod {p in PERIODS} = sum {s in SHIFTS} FTEShiftPeriod[s,p];
var Surplus {PERIODS} &amp;gt;= 0;
var Slack {PERIODS} &amp;gt;= 0;
con AbsErrorCon {p in PERIODS}:
   FTEPeriod[p] - Goal[p] = Surplus[p] - Slack[p];
min TtlDifference = sum {p in PERIODS} (Surplus[p] + Slack[p]) * Weighting[p];
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also see the attached example for two compact ways to handle the "wraparound" issue when a shift starts on one day but goes past midnight and ends the next day.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Oct 2018 15:54:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Staffing-Problem-NLP-Solver-does-not-allow-integer-problems-quot/m-p/508544#M2473</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2018-10-30T15:54:51Z</dc:date>
    </item>
    <item>
      <title>Re: Staffing Problem  - NLP Solver does not allow integer problems - "Bad Problem Type"</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Staffing-Problem-NLP-Solver-does-not-allow-integer-problems-quot/m-p/508550#M2475</link>
      <description>&lt;P&gt;Thank you for the quick reply. Adding the two vars does now allow the program to run, but it does not iterate or solve. I am not sure how adding these vars works.&lt;/P&gt;&lt;P&gt;Did I miss something?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the code example. I will review.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Oct 2018 00:24:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Staffing-Problem-NLP-Solver-does-not-allow-integer-problems-quot/m-p/508550#M2475</guid>
      <dc:creator>SSTEAD</dc:creator>
      <dc:date>2018-10-30T00:24:38Z</dc:date>
    </item>
    <item>
      <title>Re: Staffing Problem  - NLP Solver does not allow integer problems - "Bad Problem Type"</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Staffing-Problem-NLP-Solver-does-not-allow-integer-problems-quot/m-p/508773#M2476</link>
      <description>&lt;P&gt;Sorry, my first IMPVAR statement was missing an equals sign, which I have now added.&amp;nbsp; Please try again.&amp;nbsp; The MILP solver should return an optimal solution with objective value 4.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Oct 2018 15:56:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Staffing-Problem-NLP-Solver-does-not-allow-integer-problems-quot/m-p/508773#M2476</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2018-10-30T15:56:33Z</dc:date>
    </item>
    <item>
      <title>Re: Staffing Problem  - NLP Solver does not allow integer problems - "Bad Problem Type"</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Staffing-Problem-NLP-Solver-does-not-allow-integer-problems-quot/m-p/508820#M2477</link>
      <description>&lt;P&gt;It now delivers an optimal solution, with the value of 4.&lt;/P&gt;&lt;P&gt;Thank you very much.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Why are the additional variables needed: Slack and Surplus? They seem extraneous.&lt;/P&gt;&lt;P&gt;I am clearly missing something here. Is is that the minimization formula has to have variables in it?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you again.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Oct 2018 16:53:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Staffing-Problem-NLP-Solver-does-not-allow-integer-problems-quot/m-p/508820#M2477</guid>
      <dc:creator>SSTEAD</dc:creator>
      <dc:date>2018-10-30T16:53:41Z</dc:date>
    </item>
    <item>
      <title>Re: Staffing Problem  - NLP Solver does not allow integer problems - "Bad Problem Type"</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Staffing-Problem-NLP-Solver-does-not-allow-integer-problems-quot/m-p/508872#M2478</link>
      <description>&lt;P&gt;This is a standard linearization technique for absolute value (or L1 norm).&amp;nbsp; At an optimal solution, at least one of Surplus[p] and Slack[p] will be zero, and their sum Surplus[p] + Slack[p] will be the absolute value of FTEPeriod[p] - Goal[p].&amp;nbsp; See examples 11 and 13 &lt;A href="https://go.documentation.sas.com/?docsetId=ormpex&amp;amp;docsetTarget=titlepage.htm&amp;amp;docsetVersion=14.3&amp;amp;locale=en" target="_self"&gt;here&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Oct 2018 18:40:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Staffing-Problem-NLP-Solver-does-not-allow-integer-problems-quot/m-p/508872#M2478</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2018-10-30T18:40:24Z</dc:date>
    </item>
  </channel>
</rss>

