![]() ![]() In your problem, the whole game is finding the one feasible point (if it even exists)?! If the feasible set is a single point, there's no feasible direction. Your feasible set may be a single point! Digression: many optimization algorithms start with a feasible point and take a step in a feasible direction. You have 5*N+13 variables and 5*N+13 non-linear equality constraints. I've spotted several errors just glancing at the code, and I'd be concerned there are more if I actually understood the problem. I don't know the original problem, but this feels to me that you're going about numerically solving it in a haphazard, screwy way. Entering them as non-linear constraints will make fmincon's job harder. Is this what you intend? This error suggests to me there might be other errors in the way you've written myfoctest.Ī number of these constraints are linear constraints. In your function, myfoctest Why is Ceq(2*N)=x(5*N+12)-x(5*N+11)-x(4*N+2) in the for loop? You're assigning the value of x(32)- x(31) - x(18) to Ceq(8) four separate times (i.e. Instead of minimize 0 subject to f(x)=0, it appears you intend to solve problem minimize norm(f(x)) subject to f(x)=0? I don't understand the purpose of constraint f(x)=0 in this context. Your objective funciton norm(myfoctest(x)) will always return 0 because myfoctest returns the empty array as its first argument, and in Matlab, norm() is defined as 0. See my further comment at the end, and I'd advise talking to fellow students, fellow students in your lab, and/or the prof. How you solve a problem numerically is related but rather different to how you would solve a problem analytically, writing out equations by hand. Peeling back the onion, it appears to me your question doesn't address your real problem, and you're going about solving your problem numerically in somewhat the wrong way. it continues, until the output optimal answer of fmincon get closed enough to my desired answer. as I mentioned in my question I need to test my problem with an initial N, then if the Xoutput of fmincon could'nt meet the constrained, it needs to increase the number of descritization. based on Lagrange optimization technique, for finding optimal solution, gradient of scalar function(Lagrangian) should be added to system. actually my nonlinear constrained equations are some dynamic governing equations which are discreticized in time coordinate. besides my cost function is minimum time problem. I have some set of nonlinear algebraic equations so that I need to work with NLP (nonlinear programming) solvers. Tnx for your innovative idea.let's give you more details about what I wanna do. ![]() When the while condition can't be satisfied, the number of nonlinear equality equations should be increased to 23 ( ceq(1). Suppose I initially have 18 nonlinear equality equations ( ceq(1). Each time fmincon can't satisfy a specific condition (e.g., x(N)-7.6=Tol), the number N of nonlinear constraints should be updated (increased). I am trying to use fmincon in a while loop such that until the while condition is not satisfied, fmincon must be executed. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |