[AMPL 2826] Ratios and exponetial

View: New views
3 Messages — Rating Filter:   Alert me  

[AMPL 2826] Ratios and exponetial

by Keng Cher Soh :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi

I'm trying to set a new constraint that as such:

X = (A + B)/(A + B + C)

but the problem is all my variables are in the form of the log of A,
B, C, etc.

I was wondering if there's a way to still implement such a constraint?

Thanks!

best rgds

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To post to this group, send email to ampl@...
To unsubscribe from this group, send email to ampl+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/ampl?hl=en
-~----------~----~----~----~------~----~------~--~---


[AMPL 2829] Re: Ratios and exponetial

by 俊生 王 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

maybe you can have a try x=10^ln(A), which is also x=A...
I'm not sure whether I'm right~~
Wish it is helpful for you!

2009/9/16 keng <kengcher@...>

Hi

I'm trying to set a new constraint that as such:

X = (A + B)/(A + B + C)

but the problem is all my variables are in the form of the log of A,
B, C, etc.

I was wondering if there's a way to still implement such a constraint?

Thanks!

best rgds



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To post to this group, send email to ampl@...
To unsubscribe from this group, send email to ampl+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/ampl?hl=en
-~----------~----~----~----~------~----~------~--~---


[AMPL 2841] Re: Ratios and exponential

by Robert Fourer-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



Do you mean that you want to say

   X = (log(A) + log(B))/(log(A) + log(B) + log(C)) ?

You are free to use the log function anywhere in constraints, though then
you need to send the problem to a solver that can deal with nonlinear
constraints; many such solvers are listed at www.ampl.com/solvers.html.  Of
if you do a change of variables A -> e^A, etc. you could move the
nonlinearity to some other part of the problem, perhaps into the objective.

There are actually two log functions in AMPL, log() for the natural
logarithm and log10() for the logarithm base 10.

Bob Fourer
4er@...


> -----Original Message-----
> From: ampl@... [mailto:ampl@...]
> On Behalf Of keng [kengcher@...]
> Sent: Wednesday, September 16, 2009 10:13 AM
> To: AMPL Modeling Language
> Subject: [AMPL 2826] Ratios and exponential
>
> Hi
>
> I'm trying to set a new constraint that as such:
>
> X = (A + B)/(A + B + C)
>
> but the problem is all my variables are in the form of the log of A,
> B, C, etc.
>
> I was wondering if there's a way to still implement such a constraint?
>
> Thanks!
>
> best rgds
>



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To post to this group, send email to ampl@...
To unsubscribe from this group, send email to ampl+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/ampl?hl=en
-~----------~----~----~----~------~----~------~--~---