nonlinear-optimization

In R, how to do nonlinear least square optimization which involves solving differential equations?

ε祈祈猫儿з 提交于 2019-12-18 17:27:14
问题 Update with reproducible examples to illustrate my problem My original question was "Implementation of trust-region-reflective optimization algorithm in R". However, on the way of producing a reproducible example(thanks @Ben for his advice), I realize that my problem is that in Matlab, one function lsqnonlin is good(meaning no need to choose a good starting value, fast) enough for most cases I have, while in R, there is not such a one-for-all function. Different optmization algorithm works

Why do IPOPT and Scipy bring different results using the same inputs, constraints and objective function?

微笑、不失礼 提交于 2019-12-13 03:13:53
问题 I’m pretty new to optimization field, so forgive me if my question is too simple. I ran an optimization using Scipy (method SLSQP) and another one using Pyomo (IPOPT solver). Pyomo runs in less than one minute and Scipy takes 4 hours. Both have the same inputs, constraints and objective function. However, I got different results and my final results are 3% lower in Pyomo. There is no constraint violation, so I wonder if there is anything that happens under the hood to justify this difference?

Parameter Estimation of Kinetic model

廉价感情. 提交于 2019-12-13 00:28:28
问题 I have a chemical kinetic model (2-Tissue compartment Model) with Constrained K3(where K3 is rate constant) I have modelled plasma function along with Chemical kinetic model in order to plot the output characteristics I would like to estimate the Rate Constant k3 from the Code below function c_t = output_function_constrainedK3(t, a1, a2, a3,b1,b2,b3,td, tmax,k1,k2,k3) DV_free= k1/(k2+k3); K3 = k3*((k1/k2)/DV_free); K_1 = (k1*k2)/(k2+K3); K_2 = (k1*K3)/(k2+K3); c_t = zeros(size(t)); ind = (t >

Using PATH AMPL solver with Pyomo on Intel Mac OS X

柔情痞子 提交于 2019-12-12 21:15:30
问题 I'm trying to use the PATH solver (http://pages.cs.wisc.edu/~ferris/path.html) together with Pyomo on Mac OS X (10.11, Intel). I'm using the most recent Anaconda install with Python 3.5. Pyomo can make use of AMPL libraries. From http://prod.sandia.gov/techlib/access-control.cgi/2015/155584.pdf I'm trying to run the following example: `# file munson1.py from pyomo.environ import * from pyomo.mpec import * model = ConcreteModel() model.x1 = Var() model.x2 = Var() model.x3 = Var() model.f1 =

Solve non linear equation numpy.

烂漫一生 提交于 2019-12-11 15:44:16
问题 Edit: Everything is good :) This is a code which works with small values of t=20 and TR=([[30,20,12,23..],[...]]) but when I put higher values it is shown "Expect x to be a 1-D sorted array_like.". Do you know how to solve this problem?? import matplotlib.pylab as plt from scipy.special import erfc from scipy import sqrt from scipy import exp import numpy as np from scipy.interpolate import interp1d # The function to inverse: t = 100 alfa = 1.1*10**(-7) k = 0.18 T1 = 20 Tpow = 180 def F(h): p

How to code a program for optimization if a variable depends on optimization variables?

笑着哭i 提交于 2019-12-11 14:58:16
问题 I have a question in matlab when doing optimization. Suppose I want to to do an optimization problem on a vector of x min_x f(x,c) such that sum(x)=1 . For each fixed x , c is a constant, say for example (x.*a+c).^(1./alpha)+(x.*b+c).^(1./alpha)=1 where a,b,alpha are known. The algorithm is for each fixed x such that sum(x)=1 , we need to find c from (x.*a+c).^(1./alpha)+(x.*b+c).^(1./alpha)=1 and compute f(x,c) , then we update a new x . Is it possible to use fmincon in matlab to solve the

How to solve an overdetermined set of equations using non-linear lest squares in Matlab

坚强是说给别人听的谎言 提交于 2019-12-11 12:58:58
问题 A11 = cos(x)*cos(y) (1) A12 = cos(x)*sin(y) (2) A13 = -sin(y) (3) A21 = sin(z)*sin(x)*cos(y) - cos(z)*sin(y) (4) A22 = sin(z)*sin(y)*sin(x) + cos(z)*cos(y) (5) A23 = cos(x)*sin(z) (6) A31 = cos(z)*sin(x)*cos(z) + sin(z)*sin(x) (7) A32 = cos(z)*sin(x)*sin(y) - sin(z)*cos(y) (8) A33 = cos(x)*cos(z) (9) I have a set of nine equations and only three unknowns. The unknowns are x, y and z. I know the values of A11, A12, A13 ....... A33. But these values might have some noise and therefore I will

Pyomo and conditional objective function

╄→гoц情女王★ 提交于 2019-12-11 08:08:05
问题 Is it possible (and if so how) to use an objective function that has a conditional expression? Changing the example from the docs, I would like an expression like: def objective_function(model): return model.x[0] if model.x[1] < const else model.x[2] model.Obj = Objective(rule=objective_function, sense=maximize) Can this be modelled directly like this or do I have to consider some sort of transformation (and if so how would this look like)? Just executing the above gives an error message like

IBM Optimization Studio OPL, why constraint is not respected?

不羁的心 提交于 2019-12-11 06:46:39
问题 Here is a description of the optimization problem I need to solve, but with a small twist. I need to add two constraints: The first constraint: From each group we want to choose only one product, which means that we can't allow two products from the same group to be in the same basket(i.e. Product11 and Product12 should never be in the same basket ) The second constraint: In the user basket we only want products from the categories that the user is interested in. i.e if user is interested in

initial guess using scipy.optimize in python

↘锁芯ラ 提交于 2019-12-11 05:07:39
问题 I have the following problem to code using python : I have 7 parameters: x, y, z, t, HF, M1F, and M2F. The user should input any of these 3 and the program should calculate the rest. The relations that I have are: HF = -xyt M1F = -2xzt + 4yzt - xyt + 4tz^2 M2F = 2yzt - xyt 1 = -2xt + 2yt + 4zt Attempt to solve the problem: I have 7 parameters and the user should input 3 => I will be left with 4 parameters. So it's all about solving a system of 4 nonlinear equations with 4 unknowns . I read