<div style='font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10pt; color: #000000'><span style="color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-size: medium; background-color: rgb(255, 255, 255); ">Michaël</span><span style="color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-size: medium; background-color: rgb(255, 255, 255); "> ,</span><div style="color: rgb(0, 0, 0); "><br></div><div>I really appreciate your reply!! It helped me a lot.</div><div><br></div><div>Tkx!</div><div>Iwein<br><br><hr id="zwchr" style="color: rgb(0, 0, 0); font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10pt; "><div style="color: rgb(0, 0, 0); font-family: Helvetica, Arial, sans-serif; font-size: 12pt; font-weight: normal; font-style: normal; text-decoration: none; "><b>Van: </b>"michael.baudin [via Scilab / Xcos - Mailing Lists Archives]" <<a href="/user/SendEmail.jtp?type=node&node=4024684&i=0" target="_top" rel="nofollow" link="external">[hidden email]</a>><br><b>Aan: </b>"ivran" <<a href="/user/SendEmail.jtp?type=node&node=4024684&i=1" target="_top" rel="nofollow" link="external">[hidden email]</a>><br><b>Verzonden: </b>Dinsdag 7 augustus 2012 10:18:53<br><b>Onderwerp: </b>Re: constrained optimalisation with f(x,y) polynomals<br><br>

         Hi,
<br><br> There is no multivariate polynomial in Scilab, so you cannot
<br> create a 2-variable polynomial by adding to single-variable
<br> polynomials.
<br><br> With neldermead, it is relatively simple to find the minimum
<br> of a 2-variable function, with nonlinear constraints.
<br> The script below prints the following output (in Scilab 5.3.3):
<br><br>  xopt
<br> 
<br>     10.239741
<br>     99.999999
<br> 
<br>  fopt
<br> 
<br>   - 870129.52
<br> 
<br>  copt
<br> 
<br>     1023.974
<br><br> This is not very accurate, but might be sufficient, depending
<br> on your goals.
<br> If you need a more accurate computation, you may use the fmincon
<br> toolbox :
<br><br> <a href="http://atoms.scilab.org/toolboxes/fmincon" target="_blank" rel="nofollow" link="external">http://atoms.scilab.org/toolboxes/fmincon</a><br><br> or ipopt:
<br><br> <a href="http://atoms.scilab.org/toolboxes/sci_ipopt" target="_blank" rel="nofollow" link="external">http://atoms.scilab.org/toolboxes/sci_ipopt</a><br><br> But this might be more complicated, because these two tools
<br> are still in alpha stage.
<br><br> Best regards,
<br><br> Michaël
<br><br> PS
<br><br> // Optimize an additive 2D polynomial with neldermead.
<br> function [f, c, index]=my2dpolynomial(x, index)
<br>     f = []
<br>     c = []
<br>     if ( index==2 | index==6 ) then
<br>         p1 = 1. - 2*x(1) + 3*x(1)^2 + 0.4*x(1)^3
<br>         p2 = 5. - 6*x(2) + 7*x(2)^2 + 0.8*x(2)^3
<br>         f = -p1 - p2
<br>     end
<br>     if ( index==5 | index==6 ) then
<br>         c1 = x(1) * x(2)
<br>         c2 = 1024 - c1
<br>         c = [c1 c2]
<br>     end
<br> endfunction
<br><br> rand("seed" , 0);
<br> x0 = [1. 1.].';
<br> // Compute f(x0)
<br> fx0 = my2dpolynomial ( x0 , 2 )
<br> // Compute the constraints:
<br> [ fx0 , cx0, index ] = my2dpolynomial ( x0 , 6 )
<br> // Setup optimization
<br> nm = neldermead_new ();
<br> nm = neldermead_configure(nm,"-numberofvariables",2);
<br> nm = neldermead_configure(nm,"-function",my2dpolynomial);
<br> nm = neldermead_configure(nm,"-x0",x0);
<br> nm = neldermead_configure(nm,"-method","box");
<br> nm = neldermead_configure(nm,"-nbineqconst",2);
<br> nm = neldermead_configure(nm,"-simplex0method","randbounds");
<br> nm = neldermead_configure(nm,"-boundsmin",[0.0 0.0]);
<br> nm = neldermead_configure(nm,"-boundsmax",[100.0 100.0]);
<br> // Check that the cost function is correctly connected.
<br> [ nm , result ] = neldermead_function ( nm , x0 );
<br> //
<br> // Perform optimization
<br> nm = neldermead_search(nm);
<br> xopt = neldermead_get(nm,"-xopt");
<br> disp("xopt")
<br> disp(xopt)
<br> fopt = neldermead_get(nm,"-fopt")
<br> disp("fopt")
<br> disp(fopt)
<br> nm = neldermead_destroy(nm);
<br> disp("copt")
<br> disp(xopt(1)*xopt(2))
<br><br><br> On Mon, 6 Aug 2012 13:43:51 -0700 (PDT), ivran <<a target="_top" rel="nofollow" link="external">[hidden email]</a>>
<br> wrote:
<div class="shrinkable-quote"><div class='shrinkable-quote'><br>> hi guys,
<br>>
<br>> I'm having a big problem using scilab and some basic math. I would
<br>> really
<br>> appreciate some help with it 'cause i'm stuck - Consider the
<br>> following
<br>> problem:
<br>>
<br>> 2 polynomials, each describing a coordinate on its own. Together they
<br>> form a
<br>> 2D - f(x1,x2) surface which can have 2 - or more - maximums on a
<br>> certain
<br>> spot.
<br>>
<br>> f(x1) = p1 =                                         2             3
<br>>
<br>> 4             5             6
<br>>     55.044419 - 1.3570362x1 + 0.0162766x1 - 0.0001039x1 + 0.0000004x1
<br>> -
<br>> 4.592D-10x1 + 1.854D-13x1
<br>>
<br>> f(x2) = p2 =                        2             3             4
<br>> 5             6
<br>>     560.98702 - 23.76471x2 + 0.2962816x2 - 0.0009662x2 + 0.0000013x2
<br>> -
<br>> 8.576D-10x2 + 2.074D-13x2
<br>>
<br>> I have two problems here:
<br>>
<br>> 1) Does anyone know how to combine these 1D polynomials to a 2D
<br>> polynomial?
<br>> f(x1, x2) = px1x2 = p1 + p2
<br>> ...won't work. How can I solve this without overloading the '+'
<br>> method?
<br>>
<br>> 2) suppose I *could* combine these 2 functions:
<br>> f(x1, x2) = ...x1 + ...x2 + ...x1^n + ..x2^n
<br>> how can I find the maximum values of this function?, given the
<br>> following
<br>> constraints:
<br>> x1.x2 <= 1024
<br>> x1.x2 >= 0
<br>>
<br>> I'm (a little) familiar with Lagrange and the scilab procedures
<br>> regarding
<br>> this topic... but it would be very helpful if someone could post me a
<br>> example of this (or something close related) 2D constrained
<br>> optimization
<br>> problem.
<br>>
<br>> I'm really stuck at this... could you point me in the right
<br>> direction? ..tkx
<br>> in advance!!
<br>>
<br>> Iwein
<br>>
<br>>
<br>>
<br>>
<br>>
<br>>
<br>> --
<br>> View this message in context:
<br>>
<br>> <a href="http://mailinglists.scilab.org/constrained-optimalisation-with-f-x-y-polynomals-tp4024673.html" target="_blank" rel="nofollow" link="external">http://mailinglists.scilab.org/constrained-optimalisation-with-f-x-y-polynomals-tp4024673.html</a><br>> Sent from the Scilab users - Mailing Lists Archives mailing list
<br>> archive at Nabble.com.
<br>>
<br>> --
<br>> To unsubscribe from this mailing-list, please send an empty mail to
<br>> <a target="_top" rel="nofollow" link="external">[hidden email]</a>
<br>> To check the archives of this mailing list, see
<br>> <a href="http://mailinglists.scilab.org/" target="_blank" rel="nofollow" link="external">http://mailinglists.scilab.org/</a></div></div>--
<br>To unsubscribe from this mailing-list, please send an empty mail to
<br><a target="_top" rel="nofollow" link="external">[hidden email]</a>
<br>To check the archives of this mailing list, see
<br><a href="http://mailinglists.scilab.org/" target="_blank" rel="nofollow" link="external">http://mailinglists.scilab.org/</a><br><br>

        
        
        
        <br>
        <br>
        <hr noshade="noshade" size="1">
        <div style="color:#444; font: 12px tahoma,geneva,helvetica,arial,sans-serif;">
                <div style="font-weight:bold">If you reply to this email, your message will be added to the discussion below:</div>
                <a href="http://mailinglists.scilab.org/constrained-optimalisation-with-f-x-y-polynomals-tp4024673p4024676.html" target="_blank" rel="nofollow" link="external">http://mailinglists.scilab.org/constrained-optimalisation-with-f-x-y-polynomals-tp4024673p4024676.html</a>
        </div>
        <div style="color:#666; font: 11px tahoma,geneva,helvetica,arial,sans-serif;margin-top:.4em;line-height:1.5em">
                
                To unsubscribe from constrained optimalisation with f(x,y) polynomals, <a href="" target="_blank" rel="nofollow" link="external">click here</a>.<br>
                <a href="http://mailinglists.scilab.org/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml" rel="nofollow" style="font:9px serif" target="_blank" link="external">NAML</a>
        </div></div><br></div></div>

        
        
        
<br/><hr align="left" width="300" />
View this message in context: <a href="http://mailinglists.scilab.org/constrained-optimalisation-with-f-x-y-polynomals-tp4024673p4024684.html">Re: constrained optimalisation with f(x,y) polynomals</a><br/>
Sent from the <a href="http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html">Scilab users - Mailing Lists Archives mailing list archive</a> at Nabble.com.<br/>