Topic
• 14 replies
• Latest Post - ‏2013-08-12T12:48:35Z by student-Deutschland
Ebisa
7 Posts

# Pinned topic c0000005 EXCEPTION_ACCESS_VIOLATION

‏2012-09-17T17:25:46Z |
Dear all,

I wrote a CP optimization model, and after running it I receive an error that says "c0000005 EXCEPTION_ACCESS_VIOLATION". I do not understand what it means. Can somebody help please?

I am using CPLEX studio academic research 12.2.

I have herewith attached the .mod and .data files I tried to run:

.mod file:
===========================
/*********************************************
* OPL 12.2 Model
*********************************************/
using CP;

int numb_nodes = ...;
range houses = 1 ..numb_nodes;
range houses1 = 1 ..numb_nodes+1;
int large_numb = ...;
int MAX_HOP = ...;

dvar int distancehouseshouses1;
dvar boolean visitedhouseshouses1;
dvar int minimahouses1;

dvar int max_hop;
dvar int cost;

minimize cost;

subject to
{

forall(i,j in houses)
{
};

visitednumb_nodes[1] == 1;
minima[1] == 0;
distancenumb_nodes[1] == 0;

forall(i in 1.. (numb_nodes - MAX_HOP - 1))
{
distance[i][1] == numb_nodes-i;
visited[i][1] == 0;
};

forall(i in (numb_nodes- MAX_HOP).. (numb_nodes-1))
{
distance[i][1] == numb_nodes-i;
visited[i][1] == 0;
};
forall(k in 2.. numb_nodes+1)
{
forall(i in 1.. numb_nodes)
{
distance[i][k] == (visited[i]k-1==1)*distance[i]k-1 +

};
minima[k] == min(j in 1.. numb_nodes) (large_numb*(1-visited[j]k-1==0) + distance[j][k]);
added[k] == max(j in 1.. numb_nodes)(j*(visited[j]k-1 == 0)*(minima[k] == distance[j][k]));

forall(i in 1.. numb_nodes)
{
};
};

max_hop == max(i in 1.. numb_nodes) distance[i]numb_nodes+1;
max_hop <= MAX_HOP;

};

=================================================
.dat file
==============================================
/*********************************************
* OPL 12.2 Data
*********************************************/

numb_nodes = 10;
large_numb = 10;
MAX_HOP = 4;

link_cost = [0, 10, 20, 30, 40, 50, 60, 70, 80, 90
,10, 0, 10, 20, 30, 40, 50, 60, 70, 80
,20, 10, 0, 10, 20, 30, 40, 50, 60, 70
,30, 20, 10, 0, 10, 20, 30, 40, 50, 60
,40, 30, 20, 10, 0, 10, 20, 30, 40, 50
,50, 40, 30, 20, 10, 0, 10, 20, 30, 40
,60, 50, 40, 30, 20, 10, 0, 10, 20, 30
,70, 60, 50, 40, 30, 20, 10, 0, 10, 20
,80, 70, 60, 50, 40, 30, 20, 10, 0, 10
,90, 80, 70, 60, 50, 40, 30, 20, 10, 0
];

original_links = [0, 1, 0, 0, 0, 0, 0, 0, 0, 0
,1, 0, 1, 0, 0, 0, 0, 0, 0, 0
,0, 1, 0, 1, 0, 0, 0, 0, 0, 0
,0, 0, 1, 0, 1, 0, 0, 0, 0, 0
,0, 0, 0, 1, 0, 1, 0, 0, 0, 0
,0, 0, 0, 0, 1, 0, 1, 0, 0, 0
,0, 0, 0, 0, 0, 1, 0, 1, 0, 0
,0, 0, 0, 0, 0, 0, 1, 0, 1, 0
,0, 0, 0, 0, 0, 0, 0, 1, 0, 1
,0, 0, 0, 0, 0, 0, 0, 0, 1, 0
];
===============================================

Looking foreward to hearing from you.
Best!
Updated on 2012-09-24T07:28:04Z at 2012-09-24T07:28:04Z by Ebisa
• GGR
73 Posts

#### Re: c0000005 EXCEPTION_ACCESS_VIOLATION

‏2012-09-18T08:42:12Z
Hi

That is a bug that has been corrected in the 12.4 version of IBM ILOG CPlax Studio. I invite you to update to the latest version.

Hope That helps
• Ebisa
7 Posts

#### Re: c0000005 EXCEPTION_ACCESS_VIOLATION

‏2012-09-20T16:37:54Z
• GGR
• ‏2012-09-18T08:42:12Z
Hi

That is a bug that has been corrected in the 12.4 version of IBM ILOG CPlax Studio. I invite you to update to the latest version.

Hope That helps
Dear GG, thanks for the helpful information.

I have now installed the 12.4 version and it works fine now on Windows machine. However, I want to run the program on a linux based server machine. After installing the 12.4 linux version on the server, I get an error that is listed below:

==================================================================================================
Native code library failed to load: ensure the appropriate library (opl<VERSION>.dll/.so) is in your path.

at ilog.concert.cppimpl.concert_wrap.setDebugWrappers(concert_wrap.java:34)

at ilog.opl.IloOplFactory.setDebugMode(IloOplFactory.java:152)

at topology_dijkstra_124.Topology_dijkstra_124.main(Topology_dijkstra_124.java:49)

Caused by: java.lang.RuntimeException:
Native code library failed to load:
ensure the appropriate library (opl<VERSION>.dll/.so) is in your path.

at ilog.concert.cppimpl.concert_wrapJNI.<clinit>(concert_wrapJNI.java:15)

... 3 more
==============================================================================================

I have correctly specified the path to the library. You can see the .sh file that contains my script to run the .jar file below:

#!/bin/bash
#=================== eb.sh =====================

#PBS -l mem=1000mb,nodes=1:ppn=1,walltime=999:30:00
#PBS -m abe -M user@tudelft.nl
#PBS -o eb_\${PBS_JOBID}.o
#PBS -e eb_\${PBS_JOBID}.e
#PBS -V

cd \${PBS_O_WORKDIR}
LD_LIBRARY_PATH=/home/enegeri/data/opt/ibm/ILOG/CPLEX_Studio124/opl/bin/x86-64_sles10_4.1
export LD_LIBRARY_PATH

java -Djava.library.path=/home/enegeri/data/opt/ibm/ILOG/CPLEX_Studio124/opl/bin/x86-64_sles10_4.1 -jar /home/enegeri/data/topology_dijkstra_124.jar
#================================================

The path specified in the LD_LIBRARY_PATH above is exactly where the libopl124.so is located. But it complains that it could not find it. Can some one help me why this is happening, and how to solve it?

my server runs centos 5.6 verion of linux
and the java version is 1.6.0_22

Ebisa
554 Posts

#### Re: c0000005 EXCEPTION_ACCESS_VIOLATION

‏2012-09-20T16:57:10Z
• Ebisa
• ‏2012-09-20T16:37:54Z
Dear GG, thanks for the helpful information.

I have now installed the 12.4 version and it works fine now on Windows machine. However, I want to run the program on a linux based server machine. After installing the 12.4 linux version on the server, I get an error that is listed below:

==================================================================================================
Native code library failed to load: ensure the appropriate library (opl<VERSION>.dll/.so) is in your path.

at ilog.concert.cppimpl.concert_wrap.setDebugWrappers(concert_wrap.java:34)

at ilog.opl.IloOplFactory.setDebugMode(IloOplFactory.java:152)

at topology_dijkstra_124.Topology_dijkstra_124.main(Topology_dijkstra_124.java:49)

Caused by: java.lang.RuntimeException:
Native code library failed to load:
ensure the appropriate library (opl<VERSION>.dll/.so) is in your path.

at ilog.concert.cppimpl.concert_wrapJNI.<clinit>(concert_wrapJNI.java:15)

... 3 more
==============================================================================================

I have correctly specified the path to the library. You can see the .sh file that contains my script to run the .jar file below:

#!/bin/bash
#=================== eb.sh =====================

#PBS -l mem=1000mb,nodes=1:ppn=1,walltime=999:30:00
#PBS -m abe -M user@tudelft.nl
#PBS -o eb_\${PBS_JOBID}.o
#PBS -e eb_\${PBS_JOBID}.e
#PBS -V

cd \${PBS_O_WORKDIR}
LD_LIBRARY_PATH=/home/enegeri/data/opt/ibm/ILOG/CPLEX_Studio124/opl/bin/x86-64_sles10_4.1
export LD_LIBRARY_PATH

java -Djava.library.path=/home/enegeri/data/opt/ibm/ILOG/CPLEX_Studio124/opl/bin/x86-64_sles10_4.1 -jar /home/enegeri/data/topology_dijkstra_124.jar
#================================================

The path specified in the LD_LIBRARY_PATH above is exactly where the libopl124.so is located. But it complains that it could not find it. Can some one help me why this is happening, and how to solve it?

my server runs centos 5.6 verion of linux
and the java version is 1.6.0_22

Ebisa
554 Posts

#### Re: c0000005 EXCEPTION_ACCESS_VIOLATION

‏2012-09-20T17:27:11Z
• Ebisa
• ‏2012-09-20T16:37:54Z
Dear GG, thanks for the helpful information.

I have now installed the 12.4 version and it works fine now on Windows machine. However, I want to run the program on a linux based server machine. After installing the 12.4 linux version on the server, I get an error that is listed below:

==================================================================================================
Native code library failed to load: ensure the appropriate library (opl<VERSION>.dll/.so) is in your path.

at ilog.concert.cppimpl.concert_wrap.setDebugWrappers(concert_wrap.java:34)

at ilog.opl.IloOplFactory.setDebugMode(IloOplFactory.java:152)

at topology_dijkstra_124.Topology_dijkstra_124.main(Topology_dijkstra_124.java:49)

Caused by: java.lang.RuntimeException:
Native code library failed to load:
ensure the appropriate library (opl<VERSION>.dll/.so) is in your path.

at ilog.concert.cppimpl.concert_wrapJNI.<clinit>(concert_wrapJNI.java:15)

... 3 more
==============================================================================================

I have correctly specified the path to the library. You can see the .sh file that contains my script to run the .jar file below:

#!/bin/bash
#=================== eb.sh =====================

#PBS -l mem=1000mb,nodes=1:ppn=1,walltime=999:30:00
#PBS -m abe -M user@tudelft.nl
#PBS -o eb_\${PBS_JOBID}.o
#PBS -e eb_\${PBS_JOBID}.e
#PBS -V

cd \${PBS_O_WORKDIR}
LD_LIBRARY_PATH=/home/enegeri/data/opt/ibm/ILOG/CPLEX_Studio124/opl/bin/x86-64_sles10_4.1
export LD_LIBRARY_PATH

java -Djava.library.path=/home/enegeri/data/opt/ibm/ILOG/CPLEX_Studio124/opl/bin/x86-64_sles10_4.1 -jar /home/enegeri/data/topology_dijkstra_124.jar
#================================================

The path specified in the LD_LIBRARY_PATH above is exactly where the libopl124.so is located. But it complains that it could not find it. Can some one help me why this is happening, and how to solve it?

my server runs centos 5.6 verion of linux
and the java version is 1.6.0_22

Ebisa
Couple of things to check:
• You are using 64-bit OPL so, make sure that you are using 64-bit JVM
• Try "ldd libopl124.so" and make sure all dependent shared libraries are found

Regards,
Faisal
• Ebisa
7 Posts

#### Re: c0000005 EXCEPTION_ACCESS_VIOLATION

‏2012-09-21T08:22:10Z
Couple of things to check:
• You are using 64-bit OPL so, make sure that you are using 64-bit JVM
• Try "ldd libopl124.so" and make sure all dependent shared libraries are found

Regards,
Faisal
Dear Faisal,

Thank you for the suggestions.

I verified that we are using 64-bit versions of the JDK (I got the same error using both OpenJDK and Oracle's JDK).

All libraries are found according to ldd libopl124.so.

A colleague tried loading libopl124.so using dlopen and found that it failed due to the missing symbol _ZN17IloReportAbsItemI8setValueEPKcd. Running this name through c++filt renders the method name IloReportAbsItemI::setValue(char const*, double). The method appears to be from CPLEX, due to the Ilo prefix.

Do you think that I am missing a native library or that the system linker is messing things up?

Regards,
Ebisa
554 Posts

#### Re: c0000005 EXCEPTION_ACCESS_VIOLATION

‏2012-09-21T21:15:13Z
• Ebisa
• ‏2012-09-21T08:22:10Z
Dear Faisal,

Thank you for the suggestions.

I verified that we are using 64-bit versions of the JDK (I got the same error using both OpenJDK and Oracle's JDK).

All libraries are found according to ldd libopl124.so.

A colleague tried loading libopl124.so using dlopen and found that it failed due to the missing symbol _ZN17IloReportAbsItemI8setValueEPKcd. Running this name through c++filt renders the method name IloReportAbsItemI::setValue(char const*, double). The method appears to be from CPLEX, due to the Ilo prefix.

Do you think that I am missing a native library or that the system linker is messing things up?

Regards,
Ebisa
Could you try setting LD_LIBRARY_PATH as below:
LD_LIBRARY_PATH=/home/enegeri/data/opt/ibm/ILOG/CPLEX_Studio124/opl/bin/x86-64_sles10_4.1:\$LD_LIBRARY_PATH
export LD_LIBRARY_PATH

Also, try running standard example that comes with distribution such as "carseq" example from <CPLEX_Studio124>/opl/examples/opl_intrfaces/java? If that works, might want to make sure you are not mixing CPLEX/CP JARs with oplall.jar when running your application.

Also, try removing "-Djava.library.path" setting and just use LD_LIBRARY_PATH setting in your script. On some platforms I have seen issues of dependent libraries not getting loaded when shared library directory is specified through "-Djava.library.path" and when all dependent libraries are not in same directory.

Regards,
Faisal
• Ebisa
7 Posts

#### Re: c0000005 EXCEPTION_ACCESS_VIOLATION

‏2012-09-24T07:28:04Z
Could you try setting LD_LIBRARY_PATH as below:
LD_LIBRARY_PATH=/home/enegeri/data/opt/ibm/ILOG/CPLEX_Studio124/opl/bin/x86-64_sles10_4.1:\$LD_LIBRARY_PATH
export LD_LIBRARY_PATH

Also, try running standard example that comes with distribution such as "carseq" example from <CPLEX_Studio124>/opl/examples/opl_intrfaces/java? If that works, might want to make sure you are not mixing CPLEX/CP JARs with oplall.jar when running your application.

Also, try removing "-Djava.library.path" setting and just use LD_LIBRARY_PATH setting in your script. On some platforms I have seen issues of dependent libraries not getting loaded when shared library directory is specified through "-Djava.library.path" and when all dependent libraries are not in same directory.

Regards,
Faisal
Dear Faisal,

Thank you for the suggestions.
My problem is now resolved.

Regards,
Ebisa
• Hannaneh
1 Post

#### Re: c0000005 EXCEPTION_ACCESS_VIOLATION

‏2013-05-08T16:22:08Z
• GGR
• ‏2012-09-18T08:42:12Z
Hi

That is a bug that has been corrected in the 12.4 version of IBM ILOG CPlax Studio. I invite you to update to the latest version.

Hope That helps

Hello,

I am using version 12.5, and facing the same error. My model has plenty of big arraies, e.g. 250x30 size.

Cheers

• rdumeur
126 Posts

#### Re: c0000005 EXCEPTION_ACCESS_VIOLATION

‏2013-05-10T09:02:43Z
• Hannaneh
• ‏2013-05-08T16:22:08Z

Hello,

I am using version 12.5, and facing the same error. My model has plenty of big arraies, e.g. 250x30 size.

Cheers

Dear Hannaeh,

Is your problem related to the fact that dynamic library cannot be loaded from java or is it the original problem (c0000005 EXCEPTION_ACCESS_VIOLATION) ?

If it is the later, could you please provide a short model allowing us to reproduce the problem?

Cheers,

• parisamajlessi
2 Posts

#### Re: c0000005 EXCEPTION_ACCESS_VIOLATION

‏2013-07-12T13:10:30Z

I have the same error in 12.5. It seems to me that updating the data file causes the problem, though i am not sure at all.

I am including the /mod and .dat files :

/*********************************************
* OPL 12.5 Model
* Author: Velvet
* Creation Date: 11 juil. 2013 at 16:40:43
*********************************************/

{string} UGA = ... ;

tuple cpl_UGA{
string x;
string y;
};
{cpl_UGA} voisin with x,y in UGA= ... ;

tuple base{
ordered {string} parcours;
float cout;
};

ordered {base} chemins=...;

assert forall (t in chemins)
forall (u in t.parcours)
(u in UGA);

// pour le nouveau parcours-et 0 sinon. pour la première iteration il vaut 1 pour
// tous les arcs
int stat[voisin]=...;

int xpos[UGA]= ... ;
int ypos[UGA]= ... ;

int RV_min_UGA[UGA]= ... ;
int RV_max_UGA[UGA]= ... ;

//int RV_ecart_min=...;
//int RV_ecart_max=...;

int VM_disponibles_par_UGA[UGA]= ... ;

int RV_min_VM=...;
int RV_max_VM=...;

int benefices_par_UGA[UGA]= ... ;
float cout=sum(t in chemins) (t.cout);
float dist[voisin]=[<v.x,v.y>:sqrt((xpos[v.x]-xpos[v.y])^2+(ypos[v.x]-ypos[v.y])^2)|v in voisin];

//int max_benefices=sum(u in UGA) benefices_par_UGA[u];
//int min_benefices=min(u in UGA) benefices_par_UGA[u];

// définition des variables
dvar int+ VM_bouge[UGA];
dvar int+ VM_sur_place[UGA];
dvar int+ habite[chemins,UGA];
dvar int+ utiliser[chemins];
dvar int+ visite[chemins,UGA];
dvar int inc_numero[UGA];
dvar int+ inc_visite[UGA];
dvar boolean inc_habite[UGA];
dvar boolean inc_parcours;
dvar boolean transit[UGA];
dvar boolean flot[voisin];
dexpr float inc_cout=sum(v in voisin) dist[v]*flot[v];
dexpr int RV_par_UGA[u in UGA]= inc_visite[u] + RV_max_UGA[u] * VM_sur_place[u] + sum(t in chemins) visite[t,u];
dexpr float inc_cout_obj=sum(v in voisin) (dist[v]*flot[v])/benefices_par_UGA[v.x];

// la fonction objectif

maximize sum(u in UGA) benefices_par_UGA[u]*RV_par_UGA[u]- cout - inc_cout_obj /* - penalites */;

// les contraintes

subject to {

//les deux contraintes suivantes disent que si une UGA incluse dans le parcours,
// alors le nombre de visites dans chaque UGA de ce parcours est entre min et max
forall (u in UGA) C1 :
inc_visite[u] >= (RV_min_UGA[u]/*- RV_ecart_min*/)*transit[u];

forall (u in UGA) C1prime :
inc_visite[u] <= (RV_max_UGA[u] /*+ RV_ecart_max*/)*transit[u];

// dès qu'il y une UGA incluse dans le parcours, alors inc-parcours=1
forall ( u in UGA) C2 :
transit[u]<=inc_parcours;

// il n'y a qu'une seule UGA de départ
forall (u in UGA) C3:
sum(u in UGA) inc_habite[u]==inc_parcours;

// cette contrainte nous assure que l'UGA de départ est parmi les UGA du parcours
forall ( u in UGA) C4:
inc_habite[u]<=transit[u];

// les deux contraintes suivantes sont les conttraintes de loi de Kirchhoff
forall ( u in UGA) C5:
sum(v in voisin : v.y==u)flot[v]==transit[u];

forall ( u in UGA) C5prime:
sum(v in voisin : v.x==u)flot[v]==transit[u];

// les trois contraintes suivantes, ce sont les contraintes qyui assurent qu'on ait qu'un seul circuit
forall(u in UGA) C6:
inc_numero[u]<=transit[u]*card(UGA);

forall ( u in UGA) C6prime:
inc_numero[u]>=transit[u];

forall (<u,v> in voisin) C7:
inc_numero[v]>=inc_numero[u]+1-(1-flot[<u,v>]+inc_habite[v])*card(UGA);

forall (v in voisin) C8:
flot[v]<=stat[v];
/*
forall ( u in UGA) C9: // est-ce nécessaire cette contrainte ? (C10+C11)
sum(t in chemins)habite[t,u]<=VM_disponibles_par_UGA[u];
*/
forall ( u in UGA) C10:
VM_bouge[u] == sum( t in chemins: u in t.parcours) habite[t,u] + inc_habite[u];

forall ( u in UGA) C11:
VM_bouge[u] + VM_sur_place[u] <= VM_disponibles_par_UGA[u];

forall (t in chemins) C12:
utiliser[t]*RV_min_VM <= sum( u in t.parcours) habite[t,u];

forall (t in chemins) C12prime:
utiliser[t]*RV_max_VM >= sum( u in t.parcours) habite[t,u];

/*forall (t in chemins, u in t.parcours) C13:
utiliser[t]<=visite[t,u] ;
*/
forall (t in chemins) C14 :
utiliser[t]==sum(u in t.parcours) habite[t,u] ;

forall (u in UGA, t in chemins : u in t.parcours) C15 :
visite[t,u]>= (RV_min_UGA[u]/*- RV_ecart_min*/)*utiliser[t] ;

forall (u in UGA, t in chemins : u in t.parcours) C15prime :
visite[t,u] <= (RV_max_UGA[u]/* + RV_ecart_max*/)*utiliser[t] ;

forall (u in UGA: u!="start") C16:
RV_par_UGA[u]>=1;

forall (t in chemins: "start" in t.parcours) C17:
utiliser[t]==0;

forall ( u in UGA, t in chemins : u not in t.parcours)  C18:
visite[t,u]==0;

forall ( u in UGA, t in chemins : u not in t.parcours)  C19:
habite[t,u]==0;

forall (u in UGA: u=="start") C20:
inc_habite[u]==0;

forall (u in UGA: u=="start") C21:
inc_visite[u]==0;

forall (u in UGA: u=="start") C22:
inc_numero[u]==0;

forall (u in UGA: u=="start") C23:
VM_bouge[u]==0;

forall (u in UGA: u=="start") C24:
transit[u]==0;

} // fin subject to

// postprocessing

ordered {string} new_parcours;

execute {
if (inc_parcours==1){
for (var u in UGA){
} ;   // fin premier "for"
for ( var i=2;i<=Opl.card(UGA);i++){
for (var u in UGA){
if ( inc_numero[u]==i)
}
}
}
}

// le programme principal

main {

// defining the folder to contrain the solutions
var ofile= new IloOplOutputFile("UGA_prof_B_res.txt");

// defining and resolving the model

var mod = new IloOplModelSource("UGA_prof_B.mod");
//var cplex = new IloCplex();
var modef = new IloOplModelDefinition(mod);
var pb = new IloOplModel(modef,cplex);
var dat = new IloOplDataSource("UGA_prof_B.dat");
var n=1;

pb.generate();

cplex.solve();
while(pb.inc_parcours==1){

var pb= new IloOplModel(modef,cplex);
pb.generate();

if (cplex.solve()){
var obj=cplex.getObjValue()
pb.postProcess();
ofile.writeln();

ofile.writeln("the objective for iteration ",n," is : ",obj);
ofile.writeln("n=",n,", nouveau chemin : ",pb.new_parcours,pb.inc_cout);
ofile.writeln("n=",n,", inc_habite : ",pb.inc_habite);
ofile.writeln("n=",n,", inc_visite : ",pb.inc_visite);
ofile.writeln("n=",n,",     visite : ",pb.visite);
ofile.writeln();

var modef=pb.modelDefinition;
var dat=pb.dataElements;
for(var v in dat.voisin){
if (pb.flot[v]==1)
dat.stat[v]=0;
}
} // fin if
else {writeln("no solution for the iterating model");break;};
n++;
} // fin while
ofile.end();
}

• ol
81 Posts

#### Re: c0000005 EXCEPTION_ACCESS_VIOLATION

‏2013-07-15T16:17:35Z

I have the same error in 12.5. It seems to me that updating the data file causes the problem, though i am not sure at all.

I am including the /mod and .dat files :

/*********************************************
* OPL 12.5 Model
* Author: Velvet
* Creation Date: 11 juil. 2013 at 16:40:43
*********************************************/

{string} UGA = ... ;

tuple cpl_UGA{
string x;
string y;
};
{cpl_UGA} voisin with x,y in UGA= ... ;

tuple base{
ordered {string} parcours;
float cout;
};

ordered {base} chemins=...;

assert forall (t in chemins)
forall (u in t.parcours)
(u in UGA);

// pour le nouveau parcours-et 0 sinon. pour la première iteration il vaut 1 pour
// tous les arcs
int stat[voisin]=...;

int xpos[UGA]= ... ;
int ypos[UGA]= ... ;

int RV_min_UGA[UGA]= ... ;
int RV_max_UGA[UGA]= ... ;

//int RV_ecart_min=...;
//int RV_ecart_max=...;

int VM_disponibles_par_UGA[UGA]= ... ;

int RV_min_VM=...;
int RV_max_VM=...;

int benefices_par_UGA[UGA]= ... ;
float cout=sum(t in chemins) (t.cout);
float dist[voisin]=[<v.x,v.y>:sqrt((xpos[v.x]-xpos[v.y])^2+(ypos[v.x]-ypos[v.y])^2)|v in voisin];

//int max_benefices=sum(u in UGA) benefices_par_UGA[u];
//int min_benefices=min(u in UGA) benefices_par_UGA[u];

// définition des variables
dvar int+ VM_bouge[UGA];
dvar int+ VM_sur_place[UGA];
dvar int+ habite[chemins,UGA];
dvar int+ utiliser[chemins];
dvar int+ visite[chemins,UGA];
dvar int inc_numero[UGA];
dvar int+ inc_visite[UGA];
dvar boolean inc_habite[UGA];
dvar boolean inc_parcours;
dvar boolean transit[UGA];
dvar boolean flot[voisin];
dexpr float inc_cout=sum(v in voisin) dist[v]*flot[v];
dexpr int RV_par_UGA[u in UGA]= inc_visite[u] + RV_max_UGA[u] * VM_sur_place[u] + sum(t in chemins) visite[t,u];
dexpr float inc_cout_obj=sum(v in voisin) (dist[v]*flot[v])/benefices_par_UGA[v.x];

// la fonction objectif

maximize sum(u in UGA) benefices_par_UGA[u]*RV_par_UGA[u]- cout - inc_cout_obj /* - penalites */;

// les contraintes

subject to {

//les deux contraintes suivantes disent que si une UGA incluse dans le parcours,
// alors le nombre de visites dans chaque UGA de ce parcours est entre min et max
forall (u in UGA) C1 :
inc_visite[u] >= (RV_min_UGA[u]/*- RV_ecart_min*/)*transit[u];

forall (u in UGA) C1prime :
inc_visite[u] <= (RV_max_UGA[u] /*+ RV_ecart_max*/)*transit[u];

// dès qu'il y une UGA incluse dans le parcours, alors inc-parcours=1
forall ( u in UGA) C2 :
transit[u]<=inc_parcours;

// il n'y a qu'une seule UGA de départ
forall (u in UGA) C3:
sum(u in UGA) inc_habite[u]==inc_parcours;

// cette contrainte nous assure que l'UGA de départ est parmi les UGA du parcours
forall ( u in UGA) C4:
inc_habite[u]<=transit[u];

// les deux contraintes suivantes sont les conttraintes de loi de Kirchhoff
forall ( u in UGA) C5:
sum(v in voisin : v.y==u)flot[v]==transit[u];

forall ( u in UGA) C5prime:
sum(v in voisin : v.x==u)flot[v]==transit[u];

// les trois contraintes suivantes, ce sont les contraintes qyui assurent qu'on ait qu'un seul circuit
forall(u in UGA) C6:
inc_numero[u]<=transit[u]*card(UGA);

forall ( u in UGA) C6prime:
inc_numero[u]>=transit[u];

forall (<u,v> in voisin) C7:
inc_numero[v]>=inc_numero[u]+1-(1-flot[<u,v>]+inc_habite[v])*card(UGA);

forall (v in voisin) C8:
flot[v]<=stat[v];
/*
forall ( u in UGA) C9: // est-ce nécessaire cette contrainte ? (C10+C11)
sum(t in chemins)habite[t,u]<=VM_disponibles_par_UGA[u];
*/
forall ( u in UGA) C10:
VM_bouge[u] == sum( t in chemins: u in t.parcours) habite[t,u] + inc_habite[u];

forall ( u in UGA) C11:
VM_bouge[u] + VM_sur_place[u] <= VM_disponibles_par_UGA[u];

forall (t in chemins) C12:
utiliser[t]*RV_min_VM <= sum( u in t.parcours) habite[t,u];

forall (t in chemins) C12prime:
utiliser[t]*RV_max_VM >= sum( u in t.parcours) habite[t,u];

/*forall (t in chemins, u in t.parcours) C13:
utiliser[t]<=visite[t,u] ;
*/
forall (t in chemins) C14 :
utiliser[t]==sum(u in t.parcours) habite[t,u] ;

forall (u in UGA, t in chemins : u in t.parcours) C15 :
visite[t,u]>= (RV_min_UGA[u]/*- RV_ecart_min*/)*utiliser[t] ;

forall (u in UGA, t in chemins : u in t.parcours) C15prime :
visite[t,u] <= (RV_max_UGA[u]/* + RV_ecart_max*/)*utiliser[t] ;

forall (u in UGA: u!="start") C16:
RV_par_UGA[u]>=1;

forall (t in chemins: "start" in t.parcours) C17:
utiliser[t]==0;

forall ( u in UGA, t in chemins : u not in t.parcours)  C18:
visite[t,u]==0;

forall ( u in UGA, t in chemins : u not in t.parcours)  C19:
habite[t,u]==0;

forall (u in UGA: u=="start") C20:
inc_habite[u]==0;

forall (u in UGA: u=="start") C21:
inc_visite[u]==0;

forall (u in UGA: u=="start") C22:
inc_numero[u]==0;

forall (u in UGA: u=="start") C23:
VM_bouge[u]==0;

forall (u in UGA: u=="start") C24:
transit[u]==0;

} // fin subject to

// postprocessing

ordered {string} new_parcours;

execute {
if (inc_parcours==1){
for (var u in UGA){
} ;   // fin premier "for"
for ( var i=2;i<=Opl.card(UGA);i++){
for (var u in UGA){
if ( inc_numero[u]==i)
}
}
}
}

// le programme principal

main {

// defining the folder to contrain the solutions
var ofile= new IloOplOutputFile("UGA_prof_B_res.txt");

// defining and resolving the model

var mod = new IloOplModelSource("UGA_prof_B.mod");
//var cplex = new IloCplex();
var modef = new IloOplModelDefinition(mod);
var pb = new IloOplModel(modef,cplex);
var dat = new IloOplDataSource("UGA_prof_B.dat");
var n=1;

pb.generate();

cplex.solve();
while(pb.inc_parcours==1){

var pb= new IloOplModel(modef,cplex);
pb.generate();

if (cplex.solve()){
var obj=cplex.getObjValue()
pb.postProcess();
ofile.writeln();

ofile.writeln("the objective for iteration ",n," is : ",obj);
ofile.writeln("n=",n,", nouveau chemin : ",pb.new_parcours,pb.inc_cout);
ofile.writeln("n=",n,", inc_habite : ",pb.inc_habite);
ofile.writeln("n=",n,", inc_visite : ",pb.inc_visite);
ofile.writeln("n=",n,",     visite : ",pb.visite);
ofile.writeln();

var modef=pb.modelDefinition;
var dat=pb.dataElements;
for(var v in dat.voisin){
if (pb.flot[v]==1)
dat.stat[v]=0;
}
} // fin if
else {writeln("no solution for the iterating model");break;};
n++;
} // fin while
ofile.end();
}

Hello,

you should recreate the cplex at each iteration:

while(pb.inc_parcours==1){
cplex = new IloCplex(); //Here
var pb= new IloOplModel(modef,cplex);

you can also uncomment the creation of of the cplex.

var mod = new IloOplModelSource("UGA_prof_B.mod");
var cplex = new IloCplex();

Then, call close() instead of end() on ofile:

ofile.close();

Regards,

Olivier

• parisamajlessi
2 Posts

#### Re: c0000005 EXCEPTION_ACCESS_VIOLATION

‏2013-07-16T07:40:55Z
• ol
• ‏2013-07-15T16:17:35Z

Hello,

you should recreate the cplex at each iteration:

while(pb.inc_parcours==1){
cplex = new IloCplex(); //Here
var pb= new IloOplModel(modef,cplex);

you can also uncomment the creation of of the cplex.

var mod = new IloOplModelSource("UGA_prof_B.mod");
var cplex = new IloCplex();

Then, call close() instead of end() on ofile:

ofile.close();

Regards,

Olivier

thanks a million olivier, it works! i really can't thank you enough! I've been trying for a few days to find the problem. So thanks again and again

• Student-Germany
1 Post

#### Re: c0000005 EXCEPTION_ACCESS_VIOLATION

‏2013-08-10T15:43:35Z

thanks a million olivier, it works! i really can't thank you enough! I've been trying for a few days to find the problem. So thanks again and again

Hi,

I've got the same problem using IBM ILOG CPLEX Optimization Studio Version: 12.5.1.0.

My model is very big, so I am a bit afraid that the size is just to big ... Just to mention: I am novice using CPlex so my current knowledge is a bit limited

The Model:

/* Indexes*/
range A = 1..15;
range H = 1..35;
range I = 0..34;
range J = 1..5;
range K = 1..26;
range T = 1..30;

/* Declarations*/
/*Input*/
int I_Test[H][J] = ...;
int I_Dauer[I][J] = ...;
int    I_Start[J]= ...;
int I_Ende[J] = ...;

/*Parameter */
int Kapazitaet[K] = ...;
int V_Udauer[I] = ...;
int V_Reihenfolge[A][H] = ...;
int V_TM [K][I] = ...;

/*calculated Matrix */
dvar int K_Freigabe    [H][I][J];

dvar int K_Dauer[I][J];
dvar boolean K_TT[A][H][I];
dvar boolean K_KA[H][J];
dvar int K_TA[H][I][J];

/*Decisionvariable*/
dvar boolean Z_Periode[H][I][J][K][T];

minimize
sum (h in H) sum (i in I) sum (j in J) sum (k in K) sum (t in T) Z_Periode[h][i][j][k][t];

subject to {

/* Calculation of Matrix*/
forall (i in I, j in J) K_Dauer[i][j] == V_Udauer[i] + I_Dauer[i][j];
forall (a in A, h in H) K_TA [a][h][V_Reihenfolge[a][h]] == minl (1, V_Reihenfolge[a][h]);
forall (h in H, j in J) K_KA[h][j] == minl (1, I_Test[h][j]);
forall (h in H, i in I, j in J) K_TA[h][i][j] >= K_KA[h][j] * sum (a in A) K_TT[a][h][i];

/* Restrictions*/

/*Plan all tests */
forall (h in H, i in I, j in J) sum (k in K) sum (t in I_Start[j]..I_Ende[j]) Z_Periode[h][i][j][k][t] >= K_Dauer[i][j] * K_TA[h][i][j];

/*Capacity Restriction */
forall (k in K, t in T) sum (h in H, i in I, j in J) V_TM[i][k] * I_Test[h][j]*Z_Periode[h][i][j][k][t] <= Kapazitaet[k];
}

/*
execute
{
var ofile = new IloOplOutputFile("output.txt");
for (j in J) {
for (h in H) {
for (i in I) {
for (k in K) {
for (t in T) {
if (Z_Periode[h][i][j][k][t] >= 1) {
ofile.writeln("Auftrag " + j + ", Kategorie " + h + ", Test " + i + ", Maschine: " + k + ", Periode " + t);
}
}}}}}

}
*/

• student-Deutschland
1 Post

#### Re: c0000005 EXCEPTION_ACCESS_VIOLATION

‏2013-08-12T12:48:35Z

Hi,

I've got the same problem using IBM ILOG CPLEX Optimization Studio Version: 12.5.1.0.

My model is very big, so I am a bit afraid that the size is just to big ... Just to mention: I am novice using CPlex so my current knowledge is a bit limited

The Model:

/* Indexes*/
range A = 1..15;
range H = 1..35;
range I = 0..34;
range J = 1..5;
range K = 1..26;
range T = 1..30;

/* Declarations*/
/*Input*/
int I_Test[H][J] = ...;
int I_Dauer[I][J] = ...;
int    I_Start[J]= ...;
int I_Ende[J] = ...;

/*Parameter */
int Kapazitaet[K] = ...;
int V_Udauer[I] = ...;
int V_Reihenfolge[A][H] = ...;
int V_TM [K][I] = ...;

/*calculated Matrix */
dvar int K_Freigabe    [H][I][J];

dvar int K_Dauer[I][J];
dvar boolean K_TT[A][H][I];
dvar boolean K_KA[H][J];
dvar int K_TA[H][I][J];

/*Decisionvariable*/
dvar boolean Z_Periode[H][I][J][K][T];

minimize
sum (h in H) sum (i in I) sum (j in J) sum (k in K) sum (t in T) Z_Periode[h][i][j][k][t];

subject to {

/* Calculation of Matrix*/
forall (i in I, j in J) K_Dauer[i][j] == V_Udauer[i] + I_Dauer[i][j];
forall (a in A, h in H) K_TA [a][h][V_Reihenfolge[a][h]] == minl (1, V_Reihenfolge[a][h]);
forall (h in H, j in J) K_KA[h][j] == minl (1, I_Test[h][j]);
forall (h in H, i in I, j in J) K_TA[h][i][j] >= K_KA[h][j] * sum (a in A) K_TT[a][h][i];

/* Restrictions*/

/*Plan all tests */
forall (h in H, i in I, j in J) sum (k in K) sum (t in I_Start[j]..I_Ende[j]) Z_Periode[h][i][j][k][t] >= K_Dauer[i][j] * K_TA[h][i][j];

/*Capacity Restriction */
forall (k in K, t in T) sum (h in H, i in I, j in J) V_TM[i][k] * I_Test[h][j]*Z_Periode[h][i][j][k][t] <= Kapazitaet[k];
}

/*
execute
{
var ofile = new IloOplOutputFile("output.txt");
for (j in J) {
for (h in H) {
for (i in I) {
for (k in K) {
for (t in T) {
if (Z_Periode[h][i][j][k][t] >= 1) {
ofile.writeln("Auftrag " + j + ", Kategorie " + h + ", Test " + i + ", Maschine: " + k + ", Periode " + t);
}
}}}}}

}
*/

The same problem occurs even if I reduce the dimensions of my matrix ..