BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Previous assignment was not aligned properly:

Name Mon Tue Wed Thu Fri
N1 ......X
N2 ..............X
N3 ......X
N4 .................................X
N5 ......X
N6 ......X
N7 ..................................X
N8 ......X
deleted_user
Not applicable
Matt,
for some reasons this forum doesn't allow me to type certain characters so I am sending you my question again.
How do I identify Nslots in my problem? for ex if there are N person and d days then whether Nslots will be N or a permutation and combination of N AN D?
2) Let say I assume Nslots to be a constant for all the weekdays, so how can I write the following equation in sparse format( I got an error while running LP proc)
Var MAXslots >=0 <= Nslots
Var MinSlots >= 0 <= Nslots
3) Also when writing the constraint , is Minslots same for all days or is it different for each day Ex:When you wrote condition Sum(Person Slot) for all weekdays >= Minslots, whether this condition should be for Minslots(D) (weekdays ) ? Can you also explain me how to implement this in sparse format?
Cynthia_sas
SAS Super FREQ
if you want to type the less-than character, type &-lt-; -- that's ampersand-LT-semi-colon -- but type without the dashes:
[pre]
<
&-lt-; produced the above less than sign (without the dashes in the string)

>
&-gt-; produced the greater than sign (without the dashes in the string)
[/pre]

In order to have your program code line up correctly, type
[pre]
[-pre-] (no dashes in the string)
square bracket pre square bracket at the beginning of code and

square bracket /pre square bracket at the end of the code
[-/pre-] (no dashes in the string)

** Notice how this code is in a "preformatted" font;
proc whatever data=mydata;
run;

[/pre]
by square bracket, I mean the [ character at the beginning of pre and the ] as the square bracket after the pre.

cynthia
deleted_user
Not applicable
Cynthia,
Thanks for your message !! It really helped me a lot ..

Is there any way to upload my data to this forum so that Matt and other people can easily understand my probem.

For All : I am really sorry for my previous messages which might have created confusion because of lot of typos in it.

Matt: Below is the code which I am writing in the data model step,please help me in resolving this problem in Lp procedure

[pre]

DATA Model;
set raw end=eof; /* My Raw data is slightly in different format */
length _row_ $ 20 _col_ $ 16 _type_ $ 8;
keep _type_ _col_ _row_ _coef_;
/*objective function and other constraints are not written here */

/* Below is the code which I am trying to incorporate in my model data */
if eof then do;
_row_='Maxslots';
_type_='ge';
_col_='_RHS_';
_coef_=0;
output;
_row_='Maxslots';
_type_='Le';
_col_='_RHS_';
_coef_=1965; /* Nslots = 1965 I have assumed this to be equal to number of person (N)*/
output;
_row_='MINslots';
_type_='ge';
_col_='_RHS_';
_coef_=0;
output;
_row_='MINslots';
_type_='Le';
_col_='_RHS_';
_coef_=1965; /*NSlots = 1965*/
output;
end;

run;


[/pre]
deleted_user
Not applicable
Matt,
Finally, I was able to write code and run proc LP optimization problem. Thanks for all your help.

Even though the optimization ran smoothly I have encountered some of the issues while running it and I was not sure if those issues were caused due to LP proc or because of my constraints formulation , So I thought I will post my issues on this forum to get some feedback from all of the group.

1) One of my constraints checks condition where X GE O.5 Y and though the optimization problem gave me expected result but I think it took lot of iterations to converge. My hypothesis is that it might be caused because of numerical precision as 0.49999999999999999999999 and 0.5 are different when SAS is making arithmetic calculations. Do you think the same way?

2) I started with 1989 unique observations and end up with 1994 unique observations. Is this happening because of rounding error?
Please advice.
Matthew_Galati
SAS Employee
Hello. I have been out of town.

For any of the optimization solvers, you should expect a certain amount of round-off error. This occurs because the underlying calculations use finite-precision arithmetic. There are several tolerance switches that can be changed (see options).

In general, 0.49999999999999999999999 and 0.5 are considered the same. Typically, you will see precision of 1.0e-6, no more.

As for (2), I am not sure what you are referring to with 1989 vs 1994 unique observations. Do you mean you are seeing 1994 observations in the solution set? And you expect 1989?

If you want me to look at this more carefully, please send me the code and data offline. You can contact me at matthew.galati@sas.com.

Thanks,
Matt

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

Multiple Linear Regression in SAS

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.

Discussion stats
  • 20 replies
  • 1636 views
  • 0 likes
  • 3 in conversation