MATLAB Examples

Create an initial point for an optimization problem that has named index variables. For named index variables, often the easiest way to specify an initial point is to use the findindex

Optimization variables can use names for indexing elements. You can give the names when you create a variable or afterward. For example, give the names while creating the variable.

You can create and debug some problems easily by using named index variables. For example, consider the variable x that is indexed by the names in vars :

Set up and solve a mixed-integer linear programming problem. The problem is to find the optimal production and distribution levels among a set of factories, warehouses, and sales outlets.

Solve a Sudoku puzzle using binary integer programming. For the problem-based approach, see Solve Sudoku Puzzles Via Integer Programming: Problem-Based .

Solve an assignment problem by binary integer programming using the intlinprog function. For the problem-based approach to this problem, see Office Assignments by Binary Integer

Solve a Mixed-Integer Quadratic Programming (MIQP) portfolio optimization problem using the intlinprog Mixed-Integer Linear Programming (MILP) solver. The idea is to iteratively

Solve a cutting stock problem using linear programming with an integer linear programming subroutine. The example uses the solver-based approach. For the problem-based approach, see

Use the linprog solver in Optimization Toolbox® to solve an investment problem with deterministic returns over a fixed number of years T . The problem is to allocate your money over available

Schedule two gas-fired electric generators optimally, meaning to get the most revenue minus cost. While the example is not entirely realistic, it does show how to take into account costs

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

Contact your local office