Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
21
Task/Count-the-coins/SAS/count-the-coins.sas
Normal file
21
Task/Count-the-coins/SAS/count-the-coins.sas
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
/* call OPTMODEL procedure in SAS/OR */
|
||||
proc optmodel;
|
||||
/* declare set and names of coins */
|
||||
set COINS = {1,5,10,25};
|
||||
str name {COINS} = ['penny','nickel','dime','quarter'];
|
||||
|
||||
/* declare variables and constraint */
|
||||
var NumCoins {COINS} >= 0 integer;
|
||||
con Dollar:
|
||||
sum {i in COINS} i * NumCoins[i] = 100;
|
||||
|
||||
/* call CLP solver */
|
||||
solve with CLP / findallsolns;
|
||||
|
||||
/* write solutions to SAS data set */
|
||||
create data sols(drop=s) from [s]=(1.._NSOL_) {i in COINS} <col(name[i])=NumCoins[i].sol[s]>;
|
||||
quit;
|
||||
|
||||
/* print all solutions */
|
||||
proc print data=sols;
|
||||
run;
|
||||
Loading…
Add table
Add a link
Reference in a new issue