Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #11882 > unrolled thread

maximization with array of constraints

Started byFelipe <felipe.benguria@gmail.com>
First post2012-09-27 07:12 +0000
Last post2012-09-28 03:05 +0000
Articles 3 — 3 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  maximization with array of constraints Felipe <felipe.benguria@gmail.com> - 2012-09-27 07:12 +0000
    Re: maximization with array of constraints Ray Koopman <koopman@sfu.ca> - 2012-09-28 03:02 +0000
    Re: maximization with array of constraints Frank K <fkampas@gmail.com> - 2012-09-28 03:05 +0000

#11882 — maximization with array of constraints

FromFelipe <felipe.benguria@gmail.com>
Date2012-09-27 07:12 +0000
Subjectmaximization with array of constraints
Message-ID<k40u9c$j5l$1@smc.vnet.net>
Hi, 

      I am trying to maximize a function using NMaximize and I have a large list of constraints that I would like to write with a loop or as an array. 

It looks like the following: 

NMaximize[{myfunction[x,y] ,  x*mydata[[1,row,1]] + y*mydata[[1,row,2]] >0 }]

and I want the restriction to be valid for the numbers in each row of the "mydata" array. That is, if mydata is an array with two columns and 100 rows, I would have 100 constraints, which are too many to enter manually.  
Can I write a loop for the constraints inside NMaximize ? Do you have some suggestion on how to write this? I was not able to find it in earlier posts.

Thank you very much for your help
Felipe

[toc] | [next] | [standalone]


#11887

FromRay Koopman <koopman@sfu.ca>
Date2012-09-28 03:02 +0000
Message-ID<k4340n$nc1$1@smc.vnet.net>
In reply to#11882
On Sep 27, 12:14 am, Felipe <felipe.bengu...@gmail.com> wrote:
> Hi,
>
>       I am trying to maximize a function using NMaximize and I have a large list of constraints that I would like to write with a loop or as an array.
>
> It looks like the following:
>
> NMaximize[{myfunction[x,y] ,  x*mydata[[1,row,1]] + y*mydata[[1,row,2]] >0 }]
>
> and I want the restriction to be valid for the numbers in each row of the "mydata" array. That is, if mydata is an array with two columns and 100 rows, I would have 100 constraints, which are too many to enter manually.
> Can I write a loop for the constraints inside NMaximize ? Do you have some suggestion on how to write this? I was not able to find it in earlier posts.
>
> Thank you very much for your help
> Felipe

NMaximize[{myfunction[x,y], And@@Positive[mydata[[1]].{x,y}]}, {x,y}]

[toc] | [prev] | [next] | [standalone]


#11893

FromFrank K <fkampas@gmail.com>
Date2012-09-28 03:05 +0000
Message-ID<k4346i$ncu$1@smc.vnet.net>
In reply to#11882
You could construct a list of the constraints using Table[]

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web