Topic
  • 1 reply
  • Latest Post - ‏2012-10-16T16:50:48Z by ChrisBr
anshu.iitv
anshu.iitv
3 Posts

Pinned topic getting values of decision variable at time of aborting the run

‏2012-10-16T15:12:58Z |
I am using CP model of OPL.This is the program that I have written
using CP;
int n=...;
range R=1..n;
dvar int x[R] in 1..n*n;

minimize x10;

subject to
{
forall(i in 1..n)
forall(j in i..n)
forall(k in j+1..n)
x[k]-x[j]-x[i]!=0;
forall(i in 1..n)
forall(j in i+1..n)
forall(k in j..n)
forall(l in k+1..n)
x[l]+x[i]-x[j]-x[k]!=0;
forall(i in 1..n)
forall(j in i..n)
forall(k in j..n)
forall(l in k+1..n)
x[l]-x[i]-x[j]-x[k]!=0;

forall(i in 1..n-1)
{
0<x[i];
x[i]<xi+1;
xi+1<=n*n;

}
}
for n=10 it does not produces its optimal value in more than 10 hours.So if I want to get the values of decision variable at a particular time after aborting the execution of program. what should I do?Please help me.
I have working on COP a problem that has multiple solution for obtaining multiple solution I am doing it by converting it to a CSP problem and getting the value.After running the program it produces identical solution of many sets. What should I do to avoid this. I am using CP model in OPL.
Updated on 2012-10-16T16:50:48Z at 2012-10-16T16:50:48Z by ChrisBr
  • ChrisBr
    ChrisBr
    18 Posts

    Re: getting values of decision variable at time of aborting the run

    ‏2012-10-16T16:50:48Z  
    Hello,

    Try to set a time limit.
    For example:
    
    execute 
    { cp.param.timeLimit = 5*60*60; 
    }
    


    You can notice also, that because you have defined the domain of your variables
    
    dvar 
    
    int x[R] in 1..n*n;
    

    it is not necessary to set the following constraints:
    
    forall(i in 1..n-1) 
    { 0<x[i]; x[i+1]<=n*n; 
    }
    


    I hope this helps,

    Chris.