Assignment 4
Assignment 4
The code begins by setting the ideal objective function value and the starting values for the decision
variables. Next, it enters a nested loop that iteratively explores every conceivable combination of the
decision variables within their constraints. The code generates the constraints and objective function for
the LP problem and solves it with the linprog () function for each possible value. If the objective function
value of the current solution is smaller than the ideal objective function value, then the code updates
the optimal solution.
%%%objective function
f= [2; -6; 3; 4; 7; 3; 2];
% Display Results
disp('Solution');
disp(['x1 = ', num2str(x1)]);
disp(['x2 = ', num2str(x2)]);
disp(['x3 = ', num2str(x3)]);
disp(['x4= ', num2str(x4)]);
disp(['x5= ', num2str(x5)]);
disp(['x6= ', num2str(x6)]);
disp(['x7= ', num2str(x7)]);
disp(['optimal value ', num2str(fval)]);
Root Solver for question 1
Question 2
• The challenge's end goal is to cut down on the cross-sectional area. The design parameters
and techniques to compute them, including bending moment and axial load, are specified.
Total number of partial nodes = 3^4=81
• The smallest possible cross-sectional area requires the calculation of four separate variables in
this issue.
• The preceding first problem, limitless quantity, is comparable to this one in that both the
definition of discrete variables and the definition of f1 as an are identical.
• Next, we use a for loop on all variables to collect every possible value for them.
• At this stage, we use the appropriate equations to determine the values of the design variables
and the desired outcome.
disp('Optimal solution:');
disp(['x1 = ', num2str(x1)]);
disp(['x2 = ', num2str(x2)]);
disp(['x3 = ', num2str(x3)]);
disp(['x4= ', num2str(x4)]);
disp(['fstar ', num2str(fstar)]);
Node