Group Abstract Group Abstract

Message Boards Message Boards

Domain restrictions for Maximize

Posted 9 years ago
POSTED BY: Stephan Leitner
2 Replies

Perhaps an Or constraint would work.

For example:

dom = {1, 2, 6, 10};

In[7]:= NMaximize[{x, x <= 12, Or @@ Thread[x == dom]}, x]

Out[7]= {10., {x -> 10.}}
POSTED BY: Frank Kampas

Thank you very much for your help, that's exactly what I am looking for :)

POSTED BY: Stephan Leitner
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard