[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Constrained Nonlinear Optimization problem
From: |
Ben Abbott |
Subject: |
Re: Constrained Nonlinear Optimization problem |
Date: |
Fri, 02 May 2014 20:47:34 -0400 |
On May 2, 2014, at 8:33 PM, Ether Jones <address@hidden> wrote:
> On Fri, May 2, 2014 at 8:10 PM, Ben Abbott <address@hidden> wrote:
>> On May 2, 2014, at 7:40 PM, Ether Jones <address@hidden> wrote:
>>
>> >
>> > Could someone please show me how to set up this problem in Octave?
>> >
>> > Maximize (x + y)
>> >
>> > Subject to constraints:
>> >
>> > 0 <= x <= 75
>> >
>> > 0 <= y <= 75
>> >
>> > 29.5 - sqrt(0.184*(x+y)^2 + x^2) >= 0.0
>> >
>> > 45.5 - sqrt(0.184*(x+y)^2 + y^2) >= 0.0
>> >
>> >
>> > I have solved it with Maxima, Python, AMPL, and Excel and get the
>> > following answer:
>> >
>> > x = 17.2
>> >
>> > y = 38.7
>> >
>> > But I'm having trouble setting it up in Octave
>> >
>> > Thank you.
>>
>> I'd use the sqp() function. The documentation is at the link below.
>>
>> https://www.gnu.org/software/octave/doc/interpreter/Nonlinear-Programming.html
>>
>> You'll need to convert to a minimization problem.
>>
>> Ben
>
> My fault for not being clearer in my original post.
>
> I'm aware of Octave's sqp() function. I have read the sqp() entry in the
> manual. I am having difficulty figuring out how to convert/transform/setup
> my problem so that I can use the sqp() function.
>
> Can you help with that?
>
> Thank you.
Please don't reply above (called top-posting), Instead reply at the bottom
(bottom-posting) so that those who arrive later can follow along. Also be sure
to "reply-all" so that the entire conversation makes it into the archive.
The only tricky part is converting your maximization function into a
minimization function. "maximize f([x,y])" is equivalent to "minimize
-f([x,y])".
If you have difficulty with Octave's syntax, please be specific about what
you're having difficulty with.
Ben