max z = 3x[1] + 3x[2]
s.t. x[1] + x[2] <=1;
All x[i] =>0
What would the general code be?
Yeah. Post it at OR forum. @RobPratt is there .
proc optmodel;
var x1>=0 ,x2>=0;
max z=3*x1+3*x2;
con a:x1+x2<=1;
solve with lp;
print x1 x2;
quit;
Welcome to the SAS Forum!
Finding ONE optimal solution can be done with proc optmodel (part of SAS/OR, which requires a separate licence) using the SOLVE WITH LP statement, see example here. Adding some other constraint (such as x[1] and x[2] integers) would be required to make the set of ALL optimal solutions finite, in which case you would use SOLVE WITH CLP to find all solutions.
Posting your questions to the OR Community would reach experts in those procs.
In SAS Optimization 8.4 to be released soon, you can also find all optimal solutions with the MILP solver, which allows both integer and non-integer variables. For that purpose, two solutions are considered distinct if they differ for some integer variable.
Yeah. Post it at OR forum. @RobPratt is there .
proc optmodel;
var x1>=0 ,x2>=0;
max z=3*x1+3*x2;
con a:x1+x2<=1;
solve with lp;
print x1 x2;
quit;
@Ksharp's code looks good for finding one optimal solution. For LP, the number of optimal solutions can be 0, 1, or infinite. In your example, the entire line segment from (x1,x2) = (1,0) to (0,1) is optimal. The LP solver returns only one of these solutions.
Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.