Writing an objective function for MILP and GA
    7 views (last 30 days)
  
       Show older comments
    
Hi
I have the following objective function for an optimization problem.

Xij, Yjk, Zj are my decision variables and the other terms are constants where their values are located in an Excel Spread sheet. I have also 7 other constraints and this problem is a MILP one. I was successfully able to use * xlsread* to import the data for objective function and constraints values to solve this problem using _ intlinprog_.
at the moment, i am trying to solve this problem using GA, however, since this is a Mixed integer problem, i was not able to use the built-in GA algorithm in the optimization toolbox nor _ ga_ so now i have to write the ga code from scratch.
my questions are: 1) I am trying to rewrite the objective function without using xlsread (i.e. i want to call the values from excel, and provide indices for Xij, Yjk and Zi, however this seems tedious since the total number of decision variables is 2180. even if i attempt a for-loop i am not sure how to link the constants (pulled from Excel or a matrix) to their corresponding decision variable.
2)What are my options for writing the constraints other than a penalty function?
thank you so much for the help.
1 Comment
  sibabalo noludwwe
 on 14 Apr 2020
				hi, may please share with me how you solved your intlinprog problem.
Answers (2)
  Alan Weiss
    
      
 on 9 Oct 2018
        I strongly suggest that you use intlinprog for your problem and do not attempt to use ga, as the mixed-integer nonlinear programming solver in ga is intended for problems having fewer than 100 variables. Seriously, you are doing yourself a disservice by considering ga for this kind or problem. You have a linear objective and I would bet that your constraints (whatever they are) can be linearized, perhaps along the lines of this example.
As for speeding things up, you should never have xlsread inside an objective function. Use it once to get variables into the MATLAB workspace, then use the MATLAB variables in further computations.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
0 Comments
  Khaled Waleed
 on 11 Oct 2018
        1 Comment
  Alan Weiss
    
      
 on 11 Oct 2018
				Once you have the variables in the MATLAB workspace, you can pass them to your functions as extra parameters, along the lines suggested by Passing Extra Parameters.
It pains me to think of you trying to solve an MILP using a genetic algorithm. This is not a productive use of your time.
Alan Weiss
MATLAB mathematical toolbox documentation
See Also
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!

