Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  multidimensional decisionvariables from matlab to cplex

    Posted 01/04/18 10:37 AM

    Originally posted by: finnm


    I started using Cplex solver with MATLAB and i was wondering if there is a way to handle problems with multidimensional decisionvariables. As an exampl: If I try to solve a TSP while using Cplex for MATLAB the solution should be 2 dimensional, yet i cant find a example of Cplex for MATLAB with 2 dimensional decisionvariables. In the documenation it says that the objective function ('f') has to be a vector, which would indicate that it isnt possible, yet it is not proofen.

    If it is not possible to handle it directly an alternaitve would be that there is already some sort of function, which transforms your multidimensional data from MATLAB to a vector and the reconstructs it after it is solved. So my questions are:

    Does anyone know if it is possible to hand a problem with multidimensional decionvariables direclty from MATLAB to Cplex? And if there is no direct way, is there already a function which can transfrom the data?

    Thank you 


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: multidimensional decisionvariables from matlab to cplex

    Posted 01/04/18 11:09 AM

    Hi,

    I recommend the example foodmanu.m in

    CPLEX_Studio128\cplex\examples\src\matlab

    regards


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: multidimensional decisionvariables from matlab to cplex

    Posted 01/10/18 11:30 AM

    Originally posted by: finnm


    Thanks, I will take a look at it


    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: multidimensional decisionvariables from matlab to cplex

    Posted 01/05/18 01:01 AM

    Multidimensional decision variables are just notational convenience. Under the hood a multi-dimensional variable like

    x11 x12 x13 x14
    x21 x22 x23 x24

    will always be "flattened" to something like

    x11 x12 x13 x14 x21 x22 x23 x24

    You can write any multi-dimensional decision variable as a flat vector and that is exactly what you have to do in the CPLEX matlab APIs.


    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: multidimensional decisionvariables from matlab to cplex

    Posted 01/10/18 11:29 AM

    Originally posted by: finnm


    Thank you! I was hoping there would have been a built-in function for that and i didnt want to start to write my own before being sure, but now i will do it


    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: multidimensional decisionvariables from matlab to cplex

    Posted 01/14/18 09:43 AM

    No, there is no built-in function to do that, sorry.

    Depending on your application it may be better to do things the other way around:

    1. Define decision variables as a flat array
    2. Have a function that gives a two-dimensional view on this flat array, like
        function idx = map(location, product)
          idx = location * number_of_producs + product

      and then instead of addressing x[l, p] address
          x[map(l, p)]

     


    #CPLEXOptimizers
    #DecisionOptimization