Writing Optimization Code in Matlab - Resource Guide

  • Context: MATLAB 
  • Thread starter Thread starter physicsCU
  • Start date Start date
  • Tags Tags
    Code Optimization
Click For Summary

Discussion Overview

The discussion revolves around writing optimization code in Matlab to determine the best mission for an airplane among two options. The focus is on resource recommendations and technical guidance for implementing optimization functions, particularly in the context of minimizing weight and maximizing scores based on specific mission criteria.

Discussion Character

  • Technical explanation
  • Homework-related
  • Exploratory

Main Points Raised

  • One participant expresses a need for resources to start writing optimization code in Matlab, indicating a lack of experience in this area.
  • Another participant suggests that defining parameters, variables, and criteria is essential for clarity, questioning whether the problem resembles a Traveling Salesman Problem or Hamiltonian cycles.
  • A participant outlines the specifics of the two missions, detailing the scoring systems and constraints related to weight and capacity for each mission.
  • One participant mentions the existence of a built-in optimization function in Matlab, advising on the need to define a goal function for minimization.
  • There is a query about whether the function fminsearch is part of standard Matlab or requires a toolbox.
  • Another participant clarifies that fminsearch is a standard function for unconstrained nonlinear optimization and is included in the optimization toolbox.
  • A participant acknowledges the potential need for the optimization toolbox due to time constraints for completing the code.
  • One participant notes that the optimization toolbox may be necessary depending on the complexity of constraints and nonlinearity involved in the problem.

Areas of Agreement / Disagreement

Participants generally agree on the importance of defining parameters and utilizing Matlab's optimization functions, but there is no consensus on the specific approach or method to be used for the optimization task.

Contextual Notes

Participants have not fully defined the constraints or the specific optimization criteria, and there are unresolved aspects regarding the complexity of the missions and the potential need for additional tools.

physicsCU
Messages
198
Reaction score
1
OK, here is the situation.

I am supposed to write optimization code in Matlab to determine which of two missions an airplane should perform. There are three total, but one of them has been decided on. So I need to determine which of the other two I should do.

The problem is that I have never written this type of code before, so I have no clue what to do.

Could someone give me a good resource I can use as a starting point to writing this code?
 
Physics news on Phys.org
um i think you need to put parameters/variables/criterion that your using so that people can be more descriptive. ie is it a airplane path like TSP/Hcycles problem?
 
ok, I need to minimize the weight as much as i can.

one mission involved flying up to 10 liters of water, and is scored by number of laps completed ^2, ie 5 laps = 25 for score

the other is carry 96 tennis balls for 2 minutes, and this can be any number, as long as all 96 fly. scored by 1/RAC where RAC = airframe + battery weight.

The plane already will carry 48 tennis balls and 4 liters of water.
 
There is an optimization function built in.

What you want to do is define a goal function. The MATLAB function will
minimize that goal function (If you want to maximize it, put a minus sign in front
of it.)

Then there are some number of unknowns. You goal function is a function of the
unknowns and MATLAB will find particular values for the unknowns so that the
goal function is a minimum.


Try "help fminsearch"
 
thanks!

is fminsearch in standard MATLAB or is it in a toolbox?
 
... if you have the optimization toolbox then you've a number of great tools available. Fminsearch is for unconstrained nonlinear optimization and is a standard function.
 
ok thanks.

sounds like i may want to consider using the optimization toolbox, especially because i need this code done in two weeks.
 
... and depending on the degree of nonlinearity and in case you've 'complex' constraints you may have to implement, the optimization toolbox rules.
 

Similar threads

  • · Replies 32 ·
2
Replies
32
Views
4K
  • · Replies 4 ·
Replies
4
Views
11K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
3
Views
4K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 17 ·
Replies
17
Views
5K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 18 ·
Replies
18
Views
7K
Replies
2
Views
3K