MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: maximization with array of constraints


The row is the first index not the second. Depending upon what you
actually want, the constraints would be something like

cons = #[[1, 1]]*x + #[[1, 2]]*y > 0 & /@ mydata;

The syntax for NMaximize includes the variables

NMaximize[{myfunction[x, y], cons}, {x, y}]


Bob Hanlon


On Thu, Sep 27, 2012 at 3:07 AM, Felipe <felipe.benguria at 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
>



  • Prev by Date: Reduce command Mathematica
  • Next by Date: Re: maximization with array of constraints
  • Previous by thread: maximization with array of constraints
  • Next by thread: Re: maximization with array of constraints