Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  TSP - subtour elimination constraints

    Posted 05/23/12 09:01 AM

    Originally posted by: Stefano_TUE


    Hello,

    I have a problem for the input data to the following problem:

    http://pic.dhe.ibm.com/infocenter/oplinfoc/v6r3/topic/ilog.odms.ide.help/examples/html/opl/models/TravelingSalesmanProblem/tsp.mod.html

    It is a TSP formulation from the OPL samples.

    My doubt is how the data of the instance should be written for the tuple:

    034: tuple Subtour { int size; int subtourCities; }
    035: {Subtour} subtours = ...;

    This tuple is related to the subtour elimination constraints.

    If you have any TSP.dat, it would be very useful.

    Thanks
    Stefano
    #DecisionOptimization
    #MathematicalProgramming-General


  • 2.  Re: TSP - subtour elimination constraints

    Posted 05/25/12 12:50 PM

    Originally posted by: davidoff


    Hello

    In the sample, the subtours are initially set to an empty collection in the params.dat file. Then subtours are detected in the postProcess and we keep the smallest subtour and resolves the model.

    You can display the last subtour added to the MIP
    
    dat.subtours.add(opl.newSubtourSize, opl.newSubtour); writeln(
    "Last subtour added : ",Opl.last(dat.subtours));
    //add this to display the last subtour
    


    For instance, the first subtour is
    
    <3 [0 0 14 0 0 0 0 0 0 0 0 0 0 15 3 0 0]>
    


    which means that we have found a subtour of 3 cities, namely cities 3 (with successor 14) ,14 (with successor 15) and 15 (with successor 3)

    If you want to add initial known subtours, you can set additional sets in params.dat

    David
    #DecisionOptimization
    #MathematicalProgramming-General


  • 3.  Re: TSP - subtour elimination constraints

    Posted 12/24/12 03:06 AM

    Originally posted by: SystemAdmin


    forall (s in subtours)
    sum (i in Cities : s.subtour[i] != 0)
    x[<minl(i, s.subtour[i]), maxl(i, s.subtouri])>
    <= s.size-1;
    excuse me, i have some questions obout the code obve. Could you some explainnation about how the constraints make effects on the TSP problem.
    I would aprreciate your help very much.
    #DecisionOptimization
    #MathematicalProgramming-General


  • 4.  Re: TSP - subtour elimination constraints

    Posted 01/13/15 04:39 PM

    Originally posted by: max__x


    Hello, David

    I have the same problems as Stefano,  

    does this what you mean here ?

     tuple subtour { int size; 
                    int subtour[cities]; }
     {Subtour} subtours = ...;
    dat.subtours.add(opl.newSubtourSize, opl.newSubtour); writeln(
    "Last subtour added : ",Opl.last(dat.subtours));

    and set the initial subset to be empty?

    Is the code used in CPLEX?

    because there still some mistake in the code. such as the unexpected "." after dat  and writeln I bold.

     

     

     


    #DecisionOptimization
    #MathematicalProgramming-General


  • 5.  Re: TSP - subtour elimination constraints