Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #11882 > unrolled thread
| Started by | Felipe <felipe.benguria@gmail.com> |
|---|---|
| First post | 2012-09-27 07:12 +0000 |
| Last post | 2012-09-28 03:05 +0000 |
| Articles | 3 — 3 participants |
Back to article view | Back to comp.soft-sys.math.mathematica
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
| From | Felipe <felipe.benguria@gmail.com> |
|---|---|
| Date | 2012-09-27 07:12 +0000 |
| Subject | maximization 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]
| From | Ray Koopman <koopman@sfu.ca> |
|---|---|
| Date | 2012-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]
| From | Frank K <fkampas@gmail.com> |
|---|---|
| Date | 2012-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