Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

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

Search the Archive

Re: maximization with array of constraints

  • To: mathgroup at smc.vnet.net
  • Subject: [mg128230] Re: maximization with array of constraints
  • From: Ray Koopman <koopman at sfu.ca>
  • Date: Thu, 27 Sep 2012 22:47:07 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net
  • References: <k40u9c$j5l$1@smc.vnet.net>

On Sep 27, 12:14 am, Felipe <felipe.bengu... 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

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



  • Prev by Date: Re: sudoku solver
  • Next by Date: Re: Crashing every other launch?
  • Previous by thread: Re: maximization with array of constraints
  • Next by thread: Re: maximization with array of constraints