-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Following code from referred textbook #1
Comments
Hi, As mentioned in the reference book, the Generalized Reduced Gradient method is used to solve nonlinear equality-constrained optimization problems, which are of the form 'Minimize f(x), subject to h_k(x) = 0, k = 1, 2, 3..., K' In the code, f(x) is defined on line 12 (fx = 4 * x1 - x2 ** 2 + x3 ** 2 - 12) and the equality constraints are defined as hxs on line 13 (hxs = [20 - x1 ** 2 - x2 ** 2, x1 + x3 - 7] ). Here the two constraints are 20 - x1^2 - x2^2 = 0 and x1 + x3 - 7 = 0. Hope this helps! |
Heya! Thanks for your reply!
I was trying to refer to an equality constraint such as the one x_i^(l)<x_i<x_i^(u) (7.82 in the book), but then I suppose that is just covered by the hxs you have...does there need to be two constraints for hxs? I'm not sure whether the GRG method allows for this or how to implement that change in the code if the GRG does allow for only constraint.
Thank you for being so helpful!
…________________________________
From: Ishank Arora <[email protected]>
Sent: Saturday, August 11, 2018 1:19 PM
To: ishank011/grgdescent
Cc: michellebieger; Author
Subject: Re: [ishank011/grgdescent] Following code from referred textbook (#1)
Hi,
As mentioned in the reference book, the Generalized Reduced Gradient method is used to solve nonlinear equality-constrained optimization problems, which are of the form 'Minimize f(x), subject to h_k(x) = 0, k = 1, 2, 3..., K'
In the code, f(x) is defined on line 12 (fx = 4 * x1 - x2 ** 2 + x3 ** 2 - 12) and the equality constraints are defined as hxs on line 13 (hxs = [20 - x1 ** 2 - x2 ** 2, x1 + x3 - 7] ). Here the two constraints are 20 - x1^2 - x2^2 = 0 and x1 + x3 - 7 = 0.
Hope this helps!
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#1 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AcU7oU6M1jUUdFFL1AyEkdqk-r_ufziMks5uPxIQgaJpZM4V4YRD>.
|
Hi, The code would work for as many constraints as possible. For only a single constraint, just update hxs as a single-member list, for example, hxs = [20 - x1 ** 2 - x2 ** 2]. You can add more than two constraints as well. |
Heya,
Ah okay...when I tried just one constraint it didn't iterate more than the once and didn't go through more alpha values though I did not change the alpha value or iteration numbers, so I thought perhaps that was because of the constraint?
…________________________________
From: Ishank Arora <[email protected]>
Sent: Saturday, August 18, 2018 6:02 AM
To: ishank011/grgdescent
Cc: michellebieger; Author
Subject: Re: [ishank011/grgdescent] Following code from referred textbook (#1)
Hi,
The code would work for as many constraints as possible. For only a single constraint, just update hxs as a single-member list, for example, hxs = [20 - x1 ** 2 - x2 ** 2]. You can add more than two constraints as well.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#1 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AcU7ofc63LMbbZ1INog-0sROqZsSRFB0ks5uR-ZHgaJpZM4V4YRD>.
|
That might be due to the fact that it may have attained its optimum value in one iteration itself, or may be that the hyperparameter values, i.e., alpha, gamma, in this case, need to be tuned for the optimization iterations to proceed. |
Ah okay, I'll try that.
Thanks so much for continuing to reply and help!
…________________________________
From: Ishank Arora <[email protected]>
Sent: Thursday, August 23, 2018 9:41 AM
To: ishank011/grgdescent
Cc: michellebieger; Author
Subject: Re: [ishank011/grgdescent] Following code from referred textbook (#1)
That might be due to the fact that it may have attained its optimum value in one iteration itself, or may be that the hyperparameter values, i.e., alpha, gamma, in this case, need to be tuned for the optimization iterations to proceed.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#1 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AcU7oWsTldKrVqkmBHap1Ki51I_ihTrnks5uTrEhgaJpZM4V4YRD>.
|
Hi, I have attached a csv file showing sample data and my goal it to calculate the Optimized Hldg in col J (in the attached Sample.zip) using your code. Would you be able to kindly assist? PS: Im a business analyst and am way out of my depth here. Am really seeking a black box solution to feed inputs and get outputs that match the current Excel Solver Add-in. Thank you |
Heya, thanks for creating your GRG and making it available!
I'm curious; in your constraint you have two equations rather than an equation and an equality. If I follow the referred textbook correctly, problems with a constraint in the form of an equation and an equality should be able to be solved with the GRG method, too. Did you have an equality constraint in your original problem to go with the equations you have in code, and where did you express that?
The text was updated successfully, but these errors were encountered: