# Optimization Toolbox - Choosing a Solver

6 views (last 30 days)
Norbert on 23 May 2012
I have a problem finding the correct solver for my optimization problem.
I have a vector called dayload, with dimension 1440x1, representing the electrical load profile of a household of one day (24h*60min/h=1440min). I also have a price profile for that day called price with dimension 1440x1. Furthermore there is a profile for a specific device with dimensions 120x1 (device is on 120min) and a startindex of 850 (refering to dayload). Now I want to shift device from the startindex 850 within the following bounds:
-200 <= shift <= 200 (which means the device can be shifted 200min backwards or forwards at most)
The new dayload including the shifted device would now be:
So I want to optimize shift, so that the costs are a minimum: costs = price.*(dayload_new) (costs represents a 1440x1 vector. Therefore I guess I'll have to sum up all the elements of costs and minimize sum(costs) to achieve minimizing the costs-function)

Seth DeLand on 23 May 2012
Hi Norbert, Since your decision variable shift will need to be an integer (it's being used as an index), you would need to use a solver that can constrain variables to be integers. GA from the Global Optimization Toolbox is the only solver with built-in support for constraining variables to be integers.
Since the calculation of "costs" should be pretty quick, I would recommend just looping through all possible values of shift -200:200, and see which one gave the lowest cost.
Norbert on 23 May 2012
What about bintprog? Or using other solver like fmincon with using the fix function on the shift-variable, which gives me integer values.
fix(shift)
By saying looping through all possibilities, do you mean I should try to find lowest costs by building my own function instead of using one of the optimization solvers?

### Categories

Find more on Get Started with Optimization Toolbox in Help Center and File Exchange

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!