Originally posted by: SystemAdmin
Hey
I am a new user for Cplex,
I started writing my first code using OPL but the result is no value
the following is my code:
/*********************************************
* OPL 12.5 Model
* Author: mimo
* Creation Date: Mar 5, 2013 at 11:59:33 PM
*********************************************/
using CP;
{string} jobs =...;
{string} links =...;
{string} wavelengths=... ;
{string} paths =...;
int a
jobs,paths=... ;
int b
links,paths=... ;
int d
jobs=... ;
int h =...;
int X
jobs,paths,wavelengths;
int Y
jobs,jobs;
int J =... ;
int r
jobs=...;
//int val;
//dvar float+ S
jobs;
//dvar float+
dvar int St
jobs ;
//dvar int r
jobs;
constraint c1 ;
constraint c2 ;
constraint c3 ;
constraint c4 ;
constraint c5 ;
constraint c6 ;
constraint c7;
constraint c8;
constraint c9;
constraint c10;
constraint c11;
constraint c12;
constraint c13;
constraint c14;
execute {
cp.param.SearchType = "DepthFirst";
}
minimize
sum (j in jobs) (St[j]-r[j]) ;
subject to {
forall (j in jobs)
c1=
{
St[j]>=r[j] ;
}
forall(j in jobs)
c2=
{
forall ( k in jobs:k!=j)
{
c3=
(Y
j,k + Y
k,j) == 1;
}
}
forall(j in jobs)
c4=
{
sum (p in paths) sum(w in wavelengths) (X
j,p,w*a
j,p) ==1;
}
// put constraints for below for's
forall (j in jobs)
c5=
{
forall(p in paths)
{ c6=
forall(w in wavelengths)
{ c7=
0<=X
j,p,w<=1;
}
}
}
forall(j in jobs,k in jobs:k!=j)
c8=
{
forall(k in jobs:k!=j)
{ c9=
0<= Y
j,k <=1;
}
}
forall(j in jobs)
c10=
{
St[j]>=0;
r[j]>=0;
}
forall(j in jobs)
c11 =
{
forall(k in jobs:k!=j)
{ c12=
forall(l in links)
{ c13=
forall(w in wavelengths)
{ c14=
((sum ( p in paths)(d[j]*b
l,p*X
j,p,w + h*b
l,p*X
j,p,w+h*b
l,p*X
k,p,w))
+ St[j] - St[k] + h*Y
j,k) <=3*h;
}
}
}
}
}
main{
thisOplModel.generate();
cp.startNewSearch();
while(cp.next() )
{
thisOplModel.postProcess();
}
}
please can anybody help me,
thanks
#DecisionOptimization#OPLusingCPOptimizer