cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

Minimize and Maximize functions with variable number of parameters to be optimized

gfryns
1-Newbie

Minimize and Maximize functions with variable number of parameters to be optimized

 

Hi Helpers,

The attached Mathcad Worksheet computes correct results.  It might appear long/complex.  However, the questions relate to the simple input of two variables at the very top of the worksheet and the simple 3-line Given-Minimize Block at the end of the program.

 

At the top of the program, the D and t arrays are parameterized with parameter OD1, OD2, and WT1, WT2, respectively.  Specific values of these parameters to minimize the function “weight” are sought in the Given-Minimize block at the end of the program.

 

Here are the questions:

  1. All parameters (i.e., OD1,…,WT2) must be provided explicitly in the minimize function of the Given-Minimize block. Array of parameters are not allowed. Could you please confirm and comment?

  2. All parameters (i.e., OD1,…,WT2) must be provided explicitly in all embedded subroutine calls in order to be optimized.  (e.g., Ao, which compute the gross section area at the top of the worksheet.)  Could you please confirm and comment?

  3. The row number of arrays, D and t, is actually not fixed: the number of rows could change depending on the application.  If each parameter OD1, OD2, ODX … and WT1, WT2, WTX … must be specifically passed in all subroutines, then the program will have to be modified 'by hand' with each application depending on the number of parameters.  Do you see a ‘nice’ solution using arrays that would avoid any modification of the program each time the number of rows is modified?

Notes:

 

  1. The application purpose is to minimize the weight of a structure by applying the stiffness method and taking advantage of Mathcad non-linear programming.
  2. The worksheet is presented as a single text region. Text regions greatly simplify the transfer to word processor programs for reporting purposes.  There are two downsides: (1) Ctrl-Shift-A is required every time an equation is entered and (2) Internal Error occurs from time to time, which require cutting and pasting the region to get rid of the Internal Error.

  

Thank you for your interest, review and comments.

Gery

 

4 REPLIES 4

Gery Fryns написал(а):

 

 

Here are the questions:

  1. All parameters (i.e., OD1,…,WT2) must be provided explicitly in the minimize function of the Given-Minimize block. Array of parameters are not allowed. Could you please confirm and comment?

  

Thank you for your interest, review and comments.

Gery

 

We can use a vector as an argument of the Minimize function

Wee please

1-PE.png

RichardJ
19-Tanzanite
(To:gfryns)

1) Yes, array parameters are allowed

2) Yes, the parameters to be optimized must in every sub-function, and they must be arguments to those functions.

3: Just do this:

gfryns
1-Newbie
(To:gfryns)

 

All three questions answered in less than 24 hours. Worksheet updated and working.

 

First time on the forum and very impressed.  I should have taken advantage of the forum way back then!

 

Thank you to both Valery and Richard for your instrumental help.

 

Gery

 

RichardJ
19-Tanzanite
(To:gfryns)

Could you please mark whichever answer you thought was the most helpful as correct. It will help others find the answer in the future.

Top Tags