Optimization Results | |||
---|---|---|---|

Parameter Estimates | |||

N | Parameter | Estimate | Gradient Objective Function |

1 | X1 | 6.250000 | 1.125000 |

2 | X2 | 3.750000 | 1.125000 |

SAS Optimization, and SAS Simulation Studio

turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

10-22-2016 06:32 PM

Hi,

I want to solve a linear programming problem in SAS. I am using proc optmodel.

The relation between objective var and input var is not lineal and the procedure doesn't work in that kind of relationship.

This is my code, can anybody help me?. Any advice will be greatly appreciated

/* I want to know the mix pub1 + pub2 thar maximaces sales */

proc optmodel;

/* declare variables */

var pub1 >= 0, pub2 >= 0;

/* maximize objective function */

maximize sale = 3*pub1 - 0.15*pub1*pub1 + 1.5*pub2 - 0.05*pub2*pub2;

/* subject to constraints */

con process1: pub1 + pub2 = 10;

/* solve LP using primal simplex solver */

solve with milp / presolver=none;

/* display solution */

print pub1 pub2;

quit;

Accepted Solutions

Solution

10-22-2016
07:01 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

10-22-2016 06:45 PM

First note that your SOLVE statement invokes the MILP solver, not the LP solver. But both MILP and LP require a linear objective. For your problem with a quadratic objective and linear constraints, use instead the QP solver:

SOLVE WITH QP;

or just:

SOLVE;

The optimal objective value turns out to be 17.8125, with optimal solution:

pub1 | pub2 |
---|---|

6.25 | 3.75 |

All Replies

Solution

10-22-2016
07:01 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

10-22-2016 06:45 PM

First note that your SOLVE statement invokes the MILP solver, not the LP solver. But both MILP and LP require a linear objective. For your problem with a quadratic objective and linear constraints, use instead the QP solver:

SOLVE WITH QP;

or just:

SOLVE;

The optimal objective value turns out to be 17.8125, with optimal solution:

pub1 | pub2 |
---|---|

6.25 | 3.75 |

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

10-22-2016 07:05 PM

Thank you very much for your help Rob.

I have another question I have a table with two vars, that have a non-linear relation, it is a polinomic relation like this:

y = a.x + b.x2 + cx3 + ....

is there anyway to obtain that model?, something simllar to proc reg but with polinomic relattonship??

Thanks

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

10-22-2016 07:47 PM

Check out this example for polynomial regression with LP:

http://support.sas.com/documentation/cdl/en/ormpex/68157/HTML/default/viewer.htm#ormpex_ex11_toc.htm

You can also do least-squares by using a quadratic objective instead.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

10-22-2016 11:59 PM

IML can do that. Check IML forum. There is already an example in there.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

10-22-2016 11:57 PM

It is not called Linear Programming. your variable is countinuous , not discrete .

It is called Nonlinear Optimization, Check IML documentation.

```
proc iml;
start function(x);
sale=3#x[1]-0.15#x[1]#x[1]+1.5#x[2]-0.05#x[2]#x[2];
return (sale);
finish;
con={0 0 . .,
. . . .,
1 1 0 10};
optn={1 2};
x={0.5 0.5};
call nlpnra(rc,xres,'function',x,optn,con);
quit;
```

OUTPUT:

GCONV convergence criterion satisfied. |

Optimization Results | |||
---|---|---|---|

Parameter Estimates | |||

N | Parameter | Estimate | Gradient Objective Function |

1 | X1 | 6.250000 | 1.125000 |

2 | X2 | 3.750000 | 1.125000 |

Value of Objective Function = 17.8125