A few days ago Rob Pratt provided a valuable solution to my post entitled "Help Wanted: Coding a Constraint". I now find that I need expand on that constraint a bit.
To restate the problem: the goal to find the optimal orientations for a set of cameras. For specific pairs of cameras, certain orientations are considered "forbidden". Mr. Pratt provided a solution for one such forbidden situation: when both members of the camera pair are oriented in the same direction resulting in a complete overlap or duplication of the field of view.
Another "forbidden" situation is when the members of the camera pair are aimed in partially overlapping orientations. There are 8 Orientations in the model. It is desired to avoid solutions where the two selected cameras are assigned to adjacent azimuths. For example, it is undesireable for one camera to be at azimuth=45 and the other camera to be at either of the adjacent azimuths of 90 or 360 as that would result in excessive overlap of the fields of view.
The current code for Proc Optmodel is provided below. Note that the index set ORIENTATION is a cheracter variable that expresses both the azimuth angle and elevation angle. So part of the question is how to extract the azimuth portion of ORIENTATION and use that in the formulation of the constraint.
Thanks in advance for your help with this,
Regards,
Gene
Proc Optmodel;
/* Read CoverageMatrix data into index sets*/
set <str> stations;
read data work.station_id into stations=[station];
set <str> ORIENTATIONS=/'45/35' '90/35' '135/35' '180/35' '225/35' '270/35' '315/35' '360/35' /;
set <str> Targets;
read data work.targets into TARGETS=[target];
num Matrix {stations, ORIENTATIONS, TARGETS};
read data work.RoO_Matrix into [station orientation target]
Matrix=k;
/* Set Constants*/
/* optimal number of cameras covering each target*/
%Let k=3;
num k=&k;
/*Declare Variables*/
var CHI {stations, ORIENTATIONS} binary;
var IsTriplyCovered {TARGETS} binary;
impvar XIT{target in TARGETS}=sum{station in stations, orientation in
orientations} matrix[station, orientation, target] *Chi[station,
orientation];
/* Declare Model*/
max NumTriplyCovered=sum{t in TARGETS} IsTriplyCovered[t];
/*Subject to Following Constraints*/
con CHI_constraint {station in stations}:
sum{orientation in ORIENTATIONS}CHI[station, orientation] <=1;
con TriplyCoveredCon {t in TARGETS}: XIT[t] >=k * IsTriplyCovered[t];
/*Rob Pratt's Code for "Conlfict Constraint"*/
set Station_Pairs={<'US000S','US001R'>,<'US000V','US001Q'>};
con NotSameOrientation {<s1,s2> in Station_Pairs, o in ORIENTATIONS}:
CHI[s1,o] + CHI[s2,o]<=1;
/* Call Solver and Save Results:*/
solve with milp/ relobjgap=0;
create data work.OptimalSolution_&RoO from
[station orientation]={c in stations, o in orientations: CHI[c, o]>0.5} CHI;
quit;
ORIENTATION_STRING is a set of strings, but you are trying to use it as the second subscript of matrix[], which expects a single string. The following statement uses the string concatenation operator || to construct the desired string from the <a,e> pair:
impvar XIT{target in TARGETS} = sum{station in STATIONS, <a,e> in ORIENTATIONS} matrix[station, a||'/'||e, target] * Chi[station,a,e];
Here's one approach, where I have replaced the strings with pairs of numbers:
proc optmodel;
set STATIONS = /A B C D/;
/* set ORIENTATIONS = /'45/35' '90/35' '135/35' '180/35' '225/35' '270/35' '315/35' '360/35'/;*/
set ORIENTATIONS = {<45,35>, <90,35>, <135,35>, <180,35>, <225,35>, <270,35>, <315,35>, <360,35>};
var CHI {STATIONS, ORIENTATIONS} binary;
set STATION_PAIRS = {<'A','B'>, <'C','D'>};
set AZIMUTHS = setof {<a,e> in ORIENTATIONS} a;
put AZIMUTHS=;
set AZIMUTH_PAIRS = {a1 in AZIMUTHS, a2 in AZIMUTHS: mod(a1-a2+360,360) <= 45};
put AZIMUTH_PAIRS=;
con NotAdjacentAzimuths {<s1,s2> in STATION_PAIRS, <a1,a2> in AZIMUTH_PAIRS}:
sum {<a,e> in ORIENTATIONS: a in {a1,a2}} (CHI[s1,a,e] + CHI[s2,a,e]) <= 1;
expand;
quit;
Note that this "clique" constraint subsumes the "conflict" constraint (from my answer to your previous question) that prevents identical azimuths from being assigned to both stations in a pair.
Hi Rob,
Thanks so much for this suggestion. I think I understand your approach. However, in order to implement it, I think I need to somehow modify the dataset work.RoO_Matrix so that the ORIENTATION variable (which is a string variable) conforms to your proposed index set ORIENTATIONS (which is a pair of numbers). I don't know how to accomplish that. Can you suggest an approach?
Thanks.
Gene
You can use the INPUT and SCAN functions to do this, either in the DATA step or in PROC OPTMODEL. Here's the latter approach:
set MY_STRINGS = /'45/35' '90/35' '135/35' '180/35' '225/35' '270/35' '315/35' '360/35'/;
set ORIENTATIONS = setof {s in MY_STRINGS} <input(scan(s,1,'/'),best.),input(scan(s,2,'/'),best.)>;
put ORIENTATIONS=;
The PUT statement yields the following in the log:
ORIENTATIONS={<45,35>,<90,35>,<135,35>,<180,35>,<225,35>,<270,35>,<315,35>,<360,35>}
Rob,
Thanks for this suggestion. When I tried to implement it, I got errors starting with the declaration of the implicit variable XIT. I'm not clear on what's wrong here nor how to fix it The log output is shown below. I would be very grateful if you can take a look at this and help me get it sorted out.
Thanks again for taking the time to help me with this,
Gene
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
SYMBOLGEN: Macro variable _SASWSTEMP_ resolves to /home/u44673568/.sasstudio/.images/33c33bd7-7cdb-43d5-80e2-09efc7a773a1
SYMBOLGEN: Some characters in the above value which were subject to macro quoting have been unquoted for printing.
SYMBOLGEN: Macro variable GRAPHINIT resolves to GOPTIONS RESET=ALL GSFNAME=_GSFNAME;
NOTE: ODS statements in the SAS Studio environment may disable some output features.
69
70 Proc Optmodel;
71 /* Read CoverageMatrix data into index sets*/
72 set <str> stations;
73 read data work.station_id into stations=[station];
NOTE: There were 15 observations read from the data set WORK.STATION_ID.
74
75 set <str> ORIENTATION_STRING=/'45/35' '90/35' '135/35' '180/35' '225/35' '270/35' '315/35' '360/35' /;
76 set ORIENTATIONS = setof {s in orientation_string}
77 <input(scan(s,1,'/'),best.),input(scan(s,2,'/'),best.)>;
78 put orientations=;
ORIENTATIONS={<45,35>,<90,35>,<135,35>,<180,35>,<225,35>,<270,35>,<315,35>,<360,35>}
79
80
81 set <str> Targets;
82 read data work.targets into TARGETS=[target];
NOTE: There were 136206 observations read from the data set WORK.TARGETS.
83 num Matrix {stations, ORIENTATION_string, TARGETS};
84 read data work.RoO_Matrix into [station orientation_string target]
85 Matrix=k;
NOTE: There were 16344720 observations read from the data set WORK.ROO_MATRIX.
86
87 /* Set Constants*/
88 /* optimal number of cameras covering each target*/
89 %Let k=3;
90 num k=&k;
SYMBOLGEN: Macro variable K resolves to 3
91 /*Declare Variables*/
92 var CHI {stations, ORIENTATIONS} binary;
93 var IsTriplyCovered {TARGETS} binary;
94 impvar XIT{target in TARGETS}=sum{station in stations, orientation in
95 orientations} matrix[station, orientation_string, target] *Chi[station,
_ _
516 620
96 orientation];
_
619
ERROR 516-782: The indexing does not match the set element length, 1 NE 2.
ERROR 620-782: Subscript 2 may not be a set.
ERROR 619-782: The subscript count does not match array 'CHI', 2 NE 3.
97
98 /* Declare Model*/
99 max NumTriplyCovered=sum{t in TARGETS} IsTriplyCovered[t];
100
101 /*Subject to Following Constraints*/
102 con CHI_constraint {station in stations}:
103 sum{orientation in ORIENTATIONS}CHI[station, orientation] <=1;
_ _
516 619
ERROR 516-782: The indexing does not match the set element length, 1 NE 2.
ERROR 619-782: The subscript count does not match array 'CHI', 2 NE 3.
104 con TriplyCoveredCon {t in TARGETS}: XIT[t] >=k * IsTriplyCovered[t];
105
106 /*Rob Pratt's Code for "Conlfict Constraint"*/
107 set Station_Pairs={<'US000S','US001R'>,<'US000V','US001Q'>};
108 /* con NotSameOrientation {<s1,s2> in Station_Pairs, o in ORIENTATIONS}: */
109 /* CHI[s1,o] + CHI[s2,o]<=1; */
110
111 set AZIMUTHS = setof {<a,e> in ORIENTATIONS} a;
112 put AZIMUTHS=;
AZIMUTHS={45,90,135,180,225,270,315,360}
113 set AZIMUTH_PAIRS = {a1 in AZIMUTHS, a2 in AZIMUTHS: mod(a1-a2+360,360) <= 45};
114 put AZIMUTH_PAIRS=;
AZIMUTH_PAIRS={<45,45>,<45,360>,<90,45>,<90,90>,<135,90>,<135,135>,<180,135>,<180,180>,<225,180>,<225,225>,<270,225>,<270,270>,<315,
270>,<315,315>,<360,315>,<360,360>}
115 con NotAdjacentAzimuths {<s1,s2> in STATION_PAIRS, <a1,a2> in AZIMUTH_PAIRS}:
116 sum {<a,e> in ORIENTATIONS: a in {a1,a2}} (CHI[s1,a,e] + CHI[s2,a,e]) <= 1;
117 expand;
NOTE: Problem generation will use 2 threads.
NOTE: Previous errors might cause the problem to be resolved incorrectly.
ERROR: The constraint 'CHI_constraint' has an incomplete declaration.
ERROR: The implicit variable 'XIT' has an incomplete declaration.
NOTE: The problem has 136326 variables (0 free, 0 fixed).
NOTE: The problem uses 136206 implicit variables.
NOTE: The problem has 136326 binary and 0 integer variables.
NOTE: The problem has 32 linear constraints (32 LE, 0 EQ, 0 GE, 0 range).
NOTE: The problem has 96 linear constraint coefficients.
NOTE: The problem has 136206 nonlinear constraints (0 LE, 0 EQ, 136206 GE, 0 range).
NOTE: Unable to create problem instance due to previous errors.
118
119 /* Call Solver and Save Results:*/
120 solve with milp/ relobjgap=0;
NOTE: Unable to create problem instance due to previous errors.
121 create data work.OptimalSolution_&RoO from
SYMBOLGEN: Macro variable ROO resolves to 2000
122 [station orientation]={c in stations, o in orientations: CHI[c, o]>0.5} CHI;
_ _ ___
516 619 681
583
ERROR 516-782: The indexing does not match the set element length, 1 NE 2.
ERROR 619-782: The subscript count does not match array 'CHI', 2 NE 3.
ERROR 681-782: The implied subscript count does not match the index set, 2 NE 3.
ERROR 583-782: The implied subscript count does not match array 'CHI', 2 NE 3.
123 quit;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE OPTMODEL used (Total process time):
real time 38.42 seconds
user cpu time 36.63 seconds
system cpu time 2.21 seconds
memory 2651460.17k
OS Memory 2733476.00k
Timestamp 11/23/2021 05:57:18 PM
Step Count 79 Switch Count 52
Page Faults 0
Page Reclaims 752659
Page Swaps 0
Voluntary Context Switches 4231
Involuntary Context Switches 114
Block Input Operations 0
Block Output Operations 40
124 /*Print Results*/
125
125 ! proc print data=work.optimalsolution_&RoO;
SYMBOLGEN: Macro variable ROO resolves to 2000
ERROR: File WORK.OPTIMALSOLUTION_2000.DATA does not exist.
126
SYMBOLGEN: Macro variable ROO resolves to 2000
SYMBOLGEN: Macro variable ROO resolves to 2000
126 ! Title "Optimal Solution RoO=&RoO x &RoO km";
127 run;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.00 seconds
user cpu time 0.00 seconds
system cpu time 0.00 seconds
memory 218.12k
OS Memory 28832.00k
Timestamp 11/23/2021 05:57:18 PM
Step Count 80 Switch Count 1
Page Faults 0
Page Reclaims 17
Page Swaps 0
Voluntary Context Switches 10
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 0
128 /* Create Macro Variables for Station and Optimal Solution*/
129
129 ! data macrovariables;
130
SYMBOLGEN: Macro variable ROO resolves to 2000
130 ! set optimalsolution_&RoO;
ERROR: File WORK.OPTIMALSOLUTION_2000.DATA does not exist.
131 suffix=put(_n_,5.);
132 call symput (cats('Sta_Code',suffix),Station);
133 call symput (cats('Opt_Orientation',suffix),Orientation);
134 run;
NOTE: Numeric values have been converted to character values at the places given by: (Line):(Column).
132:43 133:50
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.MACROVARIABLES may be incomplete. When this step was stopped there were 0 observations and 3 variables.
WARNING: Data set WORK.MACROVARIABLES was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
user cpu time 0.00 seconds
system cpu time 0.00 seconds
memory 680.68k
OS Memory 29092.00k
Timestamp 11/23/2021 05:57:18 PM
Step Count 81 Switch Count 0
Page Faults 0
Page Reclaims 58
Page Swaps 0
Voluntary Context Switches 0
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 16
135
136 data plot;
137 set RoO_Matrix;
138 where k=1;
139 x=input(scan(target,1,'/'),8.);
140 y=input(scan(target,2,'/'),8.);
141 z=input(scan(target,3,'/'),8.);
142 run;
NOTE: There were 933866 observations read from the data set WORK.ROO_MATRIX.
WHERE k=1;
NOTE: The data set WORK.PLOT has 933866 observations and 7 variables.
NOTE: DATA statement used (Total process time):
real time 0.82 seconds
user cpu time 0.61 seconds
system cpu time 0.21 seconds
memory 3446.46k
OS Memory 31912.00k
Timestamp 11/23/2021 05:57:19 PM
Step Count 82 Switch Count 5
Page Faults 0
Page Reclaims 536
Page Swaps 0
Voluntary Context Switches 20
Involuntary Context Switches 3
Block Input Operations 0
Block Output Operations 131848
143 proc sort data=plot;
144 by z descending station orientation;
ERROR: Variable ORIENTATION not found.
145 run;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SORT used (Total process time):
real time 0.00 seconds
user cpu time 0.01 seconds
system cpu time 0.00 seconds
memory 1834.31k
OS Memory 29860.00k
Timestamp 11/23/2021 05:57:19 PM
Step Count 83 Switch Count 0
Page Faults 0
Page Reclaims 241
Page Swaps 0
Voluntary Context Switches 0
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 0
146 ods graphics / reset width=6.4in height=6.4in;
147 proc sgplot data=plot aspect=1;
148 by z;
149 where ((station="&Sta_Code1" and orientation= "&Opt_Orientation1") or
WARNING: Apparent symbolic reference STA_CODE1 not resolved.
WARNING: Apparent symbolic reference OPT_ORIENTATION1 not resolved.
150 (station="&Sta_Code2" and orientation="&Opt_Orientation2") or
WARNING: Apparent symbolic reference STA_CODE2 not resolved.
WARNING: Apparent symbolic reference OPT_ORIENTATION2 not resolved.
151 (station="&Sta_Code3" and orientation="&Opt_Orientation3") or
WARNING: Apparent symbolic reference STA_CODE3 not resolved.
WARNING: Apparent symbolic reference OPT_ORIENTATION3 not resolved.
152 (station="&Sta_Code4" and orientation="&Opt_Orientation4") or
WARNING: Apparent symbolic reference STA_CODE4 not resolved.
WARNING: Apparent symbolic reference OPT_ORIENTATION4 not resolved.
153 (station="&Sta_Code5" and orientation="&Opt_Orientation5") or
WARNING: Apparent symbolic reference STA_CODE5 not resolved.
WARNING: Apparent symbolic reference OPT_ORIENTATION5 not resolved.
154 (station="&Sta_Code6" and orientation="&Opt_Orientation6") or
WARNING: Apparent symbolic reference STA_CODE6 not resolved.
WARNING: Apparent symbolic reference OPT_ORIENTATION6 not resolved.
155 (station="&Sta_Code7" and orientation="&Opt_Orientation7") or
WARNING: Apparent symbolic reference STA_CODE7 not resolved.
WARNING: Apparent symbolic reference OPT_ORIENTATION7 not resolved.
156 (station="&Sta_Code8" and orientation="&Opt_Orientation8") or
WARNING: Apparent symbolic reference STA_CODE8 not resolved.
WARNING: Apparent symbolic reference OPT_ORIENTATION8 not resolved.
157 (station="&Sta_Code9" and orientation="&Opt_Orientation9") or
WARNING: Apparent symbolic reference STA_CODE9 not resolved.
WARNING: Apparent symbolic reference OPT_ORIENTATION9 not resolved.
158 (station="&Sta_Code10" and orientation="&Opt_Orientation10") or
WARNING: Apparent symbolic reference STA_CODE10 not resolved.
WARNING: Apparent symbolic reference OPT_ORIENTATION10 not resolved.
159 (station="&Sta_Code11" and orientation="&Opt_Orientation11") or
WARNING: Apparent symbolic reference STA_CODE11 not resolved.
WARNING: Apparent symbolic reference OPT_ORIENTATION11 not resolved.
160 (station="&Sta_Code12" and orientation="&Opt_Orientation12") or
WARNING: Apparent symbolic reference STA_CODE12 not resolved.
WARNING: Apparent symbolic reference OPT_ORIENTATION12 not resolved.
161 (station="&Sta_Code13" and orientation="&Opt_Orientation13") or
WARNING: Apparent symbolic reference STA_CODE13 not resolved.
WARNING: Apparent symbolic reference OPT_ORIENTATION13 not resolved.
162 (station="&Sta_Code14" and orientation="&Opt_Orientation14") or
WARNING: Apparent symbolic reference STA_CODE14 not resolved.
WARNING: Apparent symbolic reference OPT_ORIENTATION14 not resolved.
163 (station="&Sta_Code15" and orientation="&Opt_Orientation15"));
WARNING: Apparent symbolic reference STA_CODE15 not resolved.
WARNING: Apparent symbolic reference OPT_ORIENTATION15 not resolved.
ERROR: Variable orientation is not on file WORK.PLOT.
164
165 Title "New Azimuth (N),New Elevation Angles by Level";
166 scatter x=x y=y /group=station transparency=.85 markerattrs=(symbol=circlefilled);
167 xaxis grid min=-800 max=800;
168 yaxis grid min=-800 max=800;
169 run;
NOTE: PROCEDURE SGPLOT used (Total process time):
real time 0.00 seconds
user cpu time 0.00 seconds
system cpu time 0.00 seconds
memory 1945.46k
OS Memory 29860.00k
Timestamp 11/23/2021 05:57:19 PM
Step Count 84 Switch Count 1
Page Faults 0
Page Reclaims 243
Page Swaps 0
Voluntary Context Switches 7
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 8
170
171
172
173 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
SYMBOLGEN: Macro variable GRAPHTERM resolves to GOPTIONS NOACCESSIBLE;
183
User: u44673568
ORIENTATIONS is now a set of pairs of numbers <a,e> rather than a set of strings. You need to change orientation in ORIENTATIONS to <a,e> in ORIENTATIONS. Also, CHI now has three subscripts instead of two, so change CHI[station,orientation] to CHI[station,a,e].
Rob,
I made your recommended changes but Proc Optmodel is still unhappy with how the implicit variable XIT is being defined. The log file output is below:
Thanks for helping me with this....
Gene
My Libraries
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
SYMBOLGEN: Macro variable _SASWSTEMP_ resolves to /home/u44673568/.sasstudio/.images/50c783a8-040f-4709-854f-70155036260a
SYMBOLGEN: Some characters in the above value which were subject to macro quoting have been unquoted for printing.
SYMBOLGEN: Macro variable GRAPHINIT resolves to GOPTIONS RESET=ALL GSFNAME=_GSFNAME;
NOTE: ODS statements in the SAS Studio environment may disable some output features.
69
70 Proc Optmodel;
71 /* Read CoverageMatrix data into index sets*/
72 set <str> stations;
73 read data work.station_id into stations=[station];
NOTE: There were 15 observations read from the data set WORK.STATION_ID.
74
75 set Station_Pairs={<'US000S','US001R'>,<'US000V','US001Q'>};
76
77 set <str> ORIENTATION_STRING=/'45/35' '90/35' '135/35' '180/35' '225/35' '270/35' '315/35' '360/35' /;
78 set ORIENTATIONS = setof {s in orientation_string}
79 <input(scan(s,1,'/'),best.),input(scan(s,2,'/'),best.)>;
80 put orientations=;
ORIENTATIONS={<45,35>,<90,35>,<135,35>,<180,35>,<225,35>,<270,35>,<315,35>,<360,35>}
81
82
83
84 set <str> Targets;
85 read data work.targets into TARGETS=[target];
NOTE: There were 136206 observations read from the data set WORK.TARGETS.
86 num Matrix {stations, ORIENTATION_string, TARGETS};
87 read data work.RoO_Matrix into [station orientation_string target]
88 Matrix=k;
NOTE: There were 16344720 observations read from the data set WORK.ROO_MATRIX.
89
90 /* Set Constants*/
91 /* optimal number of cameras covering each target*/
92 %Let k=3;
93 num k=&k;
SYMBOLGEN: Macro variable K resolves to 3
94
95 /*Declare Variables*/
96 var CHI {stations, ORIENTATIONS} binary;
97 var IsTriplyCovered {TARGETS} binary;
98 impvar XIT{target in TARGETS}=sum{station in stations, <a,e> in
99 orientations} matrix[station, orientation_string, target] *Chi[station,a,e];
_
620
ERROR 620-782: Subscript 2 may not be a set.
100
101 /* Declare Model*/
102 max NumTriplyCovered=sum{t in TARGETS} IsTriplyCovered[t];
103
104 /*Subject to Following Constraints*/
105 con CHI_constraint {station in stations}:
106 sum{<a,e> in ORIENTATIONS}CHI[station,a,e] <=1;
107
108 con TriplyCoveredCon {t in TARGETS}: XIT[t] >=k * IsTriplyCovered[t];
109
110 set AZIMUTHS = setof {<a,e> in ORIENTATIONS} a;
111 put AZIMUTHS=;
AZIMUTHS={45,90,135,180,225,270,315,360}
112 set AZIMUTH_PAIRS = {a1 in AZIMUTHS, a2 in AZIMUTHS: mod(a1-a2+360,360) <= 45};
113 put AZIMUTH_PAIRS=;
AZIMUTH_PAIRS={<45,45>,<45,360>,<90,45>,<90,90>,<135,90>,<135,135>,<180,135>,<180,180>,<225,180>,<225,225>,<270,225>,<270,270>,<315,
270>,<315,315>,<360,315>,<360,360>}
114
115 con NotAdjacentAzimuths {<s1,s2> in STATION_PAIRS, <a1,a2> in AZIMUTH_PAIRS}:
116 sum {<a,e> in ORIENTATIONS: a in {a1,a2}} (CHI[s1,a,e] + CHI[s2,a,e]) <= 1;
117 expand;
NOTE: Problem generation will use 2 threads.
NOTE: Previous errors might cause the problem to be resolved incorrectly.
ERROR: The implicit variable 'XIT' has an incomplete declaration.
NOTE: The problem has 136326 variables (0 free, 0 fixed).
NOTE: The problem uses 136206 implicit variables.
NOTE: The problem has 136326 binary and 0 integer variables.
NOTE: The problem has 47 linear constraints (47 LE, 0 EQ, 0 GE, 0 range).
NOTE: The problem has 216 linear constraint coefficients.
NOTE: The problem has 136206 nonlinear constraints (0 LE, 0 EQ, 136206 GE, 0 range).
NOTE: Unable to create problem instance due to previous errors.
118
119 /* Call Solver and Save Results:*/
120 solve with milp/ relobjgap=0;
NOTE: Unable to create problem instance due to previous errors.
121 create data work.OptimalSolution_&RoO from
SYMBOLGEN: Macro variable ROO resolves to 2000
122 [station a e]={c in stations, <a,e> in orientations: CHI[c,a,e]>0.5} CHI;
NOTE: The data set WORK.OPTIMALSOLUTION_2000 has 0 observations and 4 variables.
123 quit;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE OPTMODEL used (Total process time):
real time 36.32 seconds
user cpu time 34.40 seconds
system cpu time 2.30 seconds
memory 2651482.51k
OS Memory 2733480.00k
Timestamp 11/23/2021 07:23:07 PM
Step Count 283 Switch Count 52
Page Faults 0
Page Reclaims 738951
Page Swaps 0
Voluntary Context Switches 2892
Involuntary Context Switches 67
Block Input Operations 0
Block Output Operations 296
ORIENTATION_STRING is a set of strings, but you are trying to use it as the second subscript of matrix[], which expects a single string. The following statement uses the string concatenation operator || to construct the desired string from the <a,e> pair:
impvar XIT{target in TARGETS} = sum{station in STATIONS, <a,e> in ORIENTATIONS} matrix[station, a||'/'||e, target] * Chi[station,a,e];
Rob:
Thanks for walking me through this solution. I'll mark your last response as SOLVED as that response took care of the last problem in the code.
Thanks so much for your patient assistance. This was a big help to my project.
Regards,
Gene
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.
Find more tutorials on the SAS Users YouTube channel.