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

2 weeks ago - last edited 2 weeks ago

i know how i can to min / max a function with proc optmodel

(example here)

```
proc optmodel;
var x,y;
number z=-3;
number res=8;
min f1 = y+x**3 + z*y**3;
con c1: x*y = res;
solve with nlp;
quit;
```

but i want to minimize and maximize in the same proc optmodel. I know i can do two proc optmodel like this:

```
proc optmodel;
var x,y;
number z=-3;
number res=8;
min f1 = y+x**3 + z*y**3;
con c1: x*y = res;
solve with nlp;
quit;
proc optmodel;
var x,y;
number z=-3;
number res=8;
max f1 = y+x**3 + z*y**3;
con c1: x*y = res;
solve with nlp;
quit;
```

is it possible?

thanks

Accepted Solutions

Solution

2 weeks ago

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

Posted in reply to dali74

2 weeks ago

Yes, here's one way:

```
proc optmodel;
var x,y;
number z=-3;
number res=8;
min f1 = y+x**3 + z*y**3;
con c1: x*y = res;
solve with nlp;
max f2 = y+x**3 + z*y**3;
solve with nlp;
quit;
```

In general, you can make any model changes you want and call the same solver or different solvers as many times as you want in the same PROC OPTMODEL call.

Several of the examples in this book illustrate this functionality.

All Replies

Solution

2 weeks ago

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

Posted in reply to dali74

2 weeks ago

Yes, here's one way:

```
proc optmodel;
var x,y;
number z=-3;
number res=8;
min f1 = y+x**3 + z*y**3;
con c1: x*y = res;
solve with nlp;
max f2 = y+x**3 + z*y**3;
solve with nlp;
quit;
```

In general, you can make any model changes you want and call the same solver or different solvers as many times as you want in the same PROC OPTMODEL call.

Several of the examples in this book illustrate this functionality.