Hi - I'm running an optimization program and running into this error (below). The code is below as well.
Excerpt from log:
NOTE: Problem generation will use 4 threads.
NOTE: The problem has 8740 variables (0 free, 0 fixed).
NOTE: The problem has 9 linear constraints (8 LE, 0 EQ, 1 GE, 0 range).
NOTE: The problem has 33508 linear constraint coefficients.
NOTE: The problem has 0 nonlinear constraints (0 LE, 0 EQ, 0 GE, 0 range).
NOTE: The OPTMODEL presolver is disabled for linear problems.
NOTE: The LP presolver value AUTOMATIC is applied.
NOTE: The LP presolver found this problem to be infeasible or unbounded.
Thank you!
data _null_;
datetime = datetime();
put datetime= datetime18.;
run;
proc means data=NCCS01; var
PROGREV
INVNTRIESALESEND
LNDBLDGSEQUIPEND
INTANGIBLEASSETSEND
OTHRASSETSEND
ADVRTPROMO
INFOTECH
ROYALTSEXPNS
OTHREXPNSF;
run;
*Clear out the Results;
ods html close; ods html;
data inputs;
input input $19.;
datalines;
INVNTRIESALESEND
LNDBLDGSEQUIPEND
INTANGIBLEASSETSEND
OTHRASSETSEND
ADVRTPROMO
INFOTECH
ROYALTSEXPNS
OTHREXPNSF
;
data outputs;
input output $7.;
datalines;
PROGREV
;
/*
options nosource nonotes source2 errors=20;
OPTIONS MLOGIC SYMBOLGEN;
*/
%MACRO CREATEDATA(ID);
DATA DEAPROCESS;
SET NCCS01;
WHERE FFIND = "&ID.";
RUN;
%MEND;
/*FIND ALL FFINDs*/
PROC SQL NOPRINT;
SELECT COUNT(DISTINCT(FFIND))
INTO :FFINDS
FROM NCCS01;
%LET FFINDS = &FFINDS;
SELECT DISTINCT FFIND
INTO :FFIND1-:FFIND&FFINDS.
FROM NCCS01;
QUIT;
%MACRO CALLDEAFFIND();
data DEAPROCESS; set DEAPROCESS;
*The first several PROC OPTMODEL statements declare index sets and parameters and then read the input data:;
proc optmodel;
set <str> INPUTS;
read data inputs into INPUTS=[input];
set <str> OUTPUTS;
read data outputs into OUTPUTS=[output];
set <num> DEADATA;
str GVKEYYEAR {DEADATA};
num input {INPUTS, DEADATA};
num output {OUTPUTS, DEADATA};
read data DEAPROCESS into DEADATA=[_N_] GVKEYYEAR
{i in INPUTS} <input[i,_N_]=col(i)>
{i in OUTPUTS} <output[i,_N_]=col(i)>;
num k;
num efficiency_number {DEADATA};
num weight_sol {DEADATA, DEADATA};
*The following statements correspond directly to the mathematical programming formulation described earlier:;
var Weight {DEADATA} >= 0;
var Inefficiency >= 0;
max Objective = Inefficiency;
con Input_con {i in INPUTS}:
sum {j in DEADATA} input[i,j] * Weight[j] <= input[i,k];
con Output_con {i in OUTPUTS}:
sum {j in DEADATA} output[i,j] * Weight[j] >= output[i,k] * Inefficiency;
*The following statements loop over all garages, call the linear programming solver once per garage, and store the results in the parameters efficiency_number and weight_sol:;
do k = DEADATA;
solve;
efficiency_number[k] = 1 / Inefficiency.sol;
for {j in DEADATA}
weight_sol[k,j] = (if Weight[j].sol > 1e-6 then Weight[j].sol else .);
end;
*After the DO loop terminates, the following statements partition the garages into two sets by using a threshold on the resulting efficiency numbers:;
set EFFICIENT_FIRMS = {j in DEADATA: efficiency_number[j] >= 1};
set INEFFICIENT_FIRMS = DEADATA diff EFFICIENT_FIRMS;
*The following statements print the efficiency numbers, as shown in Figure 23.1, and write them to the efficiency_data data set:;
print GVKEYYEAR efficiency_number;
create data efficiency_data from [firm] GVKEYYEAR efficiency_number;
*The following CREATE DATA statements write the inefficient garages and the corresponding multiples of efficient garages to SAS data sets (in both dense and sparse form), as in Table 14.8 in Williams:;
create data weight_data_dense from [inefficient_firm]=INEFFICIENT_FIRMS
GVKEYYEAR
efficiency_number
{efficient_firm in EFFICIENT_FIRMS} <col('w'||efficient_firm)
=weight_sol[inefficient_firm,efficient_firm]>;
create data weight_data_sparse from
[inefficient_firm efficient_firm]=
{g1 in INEFFICIENT_FIRMS, g2 in EFFICIENT_FIRMS: weight_sol[g1,g2] ne .}
weight_sol;
quit;
ods html close; ods html;
%MEND CALLDEAFFIND;
%MACRO EXPORT(E);
PROC SQL;
CREATE TABLE DEAEXPORT AS
SELECT FIRM,GVKEYYEAR,efficiency_number FROM Efficiency_data;
RUN;
DATA WORK.DEARESULTS&E._EXPORT; SET DEAEXPORT;
RUN;
%MEND EXPORT;
%MACRO GENERATEBYFFIND;
%DO F = 1 %TO &FFINDS;
%CREATEDATA(&&FFIND&F);
%CALLDEAFFIND();
%EXPORT(&F);
%END;
%MEND GENERATEBYFFIND;
%GENERATEBYFFIND;
options source notes source2 errors=20;
I don't immediately see anything wrong with the PROC OPTMODEL code, which is nearly identical to this doc example.
Can you please share the input data so that I can try to replicate and diagnose? If not, please attach the full log.
Thanks Rob!
Let me attach the log. Because the log file was getting full, I saved an excerpt. However, because the procedure is repetitive, the log should contain the necessary details. Specifically, there are numerous points where the log reads, "The LP presolver found this problem to be infeasible or unbounded".
I will need more information to be able to diagnose this. Please add the following statements after the SOLVE statement, and then attach the resulting MPSDATA data set to this discussion:
if _solution_status_='INFEASIBLE_OR_UNBOUNDED' then do;
save mps mpsdata;
leave;
end;
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.