help-glpk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-glpk] Error detected in file glplib10.c at line 109


From: Antonello Lobianco
Subject: [Help-glpk] Error detected in file glplib10.c at line 109
Date: Thu, 19 Nov 2009 16:45:27 +0100

Hello..
    I am trying to parallelise the Qt/C++ code of  multi agent model representing farmers.
For the time being I'm using only 1 thread as I got from this list that glpk is, at the present time, not  re-entrant.
The funny(!) side is that when I use the new code (see down), even if it use only **1** working threads, the unpatched version of glpk crash.
I used then the doc example and I was able to receive the following error message when crashing:
Assertion failed: xlcmp(env->t_last, t) <= 0
Error detected in file glplib10.c at line 109

Is it a glpk bug or something I am doing seriously very wrong ??

Regards,
   Antonello

Glpk wrapper code:

void
Manager_agents::aFunction(){
    int nThreads = 1; // nThreads = 1, as for now glpk in not reendrant
    for (int i=0; i < nThreads; i++){
        ThreadClass* wThread = new ThreadClass;
        wThreads.push_back(wThread);
    }
    vector<double> outputs (agents.size(), ((double)0));
    for (uint y=0;y<agents.size();y++){
        volatile bool assigned = false;
        while(!assigned) {
            for (uint z=0;z<wThreads.size();z++){
                if (!wThreads[z]->isRunning()){
                    wThreads[z]->assignJob(agents[y]); // this is run serialised in the main working thread !
                    wThreads[z]->start(); // parallel threads
                    assigned = true;
                }
            }
        }
    }

    // Be sure that all threads have ended their last job before continue..
    for (int z=0; z <wThreads.size(); z++){
        wThreads[z]->wait();
    }
    for ( int z=0; z< agents.size(); z++){
        outputs[z] = agents->getOutput();
    }
}

Manager_farmers_threads::Manager_farmers_threads(){

}

void
Manager_farmers_threads::run(){
    agent->solve(); // -> call the PDF documentation example (content of the main function)
}

void
Manager_farmers_threads::assignJob(Agent_space* agent_h){
    agent =  agent_h;
    agent -> cachedOutput = 0;
}

model output:
[...]
z = 733.333; x1 = 33.3333; x2 = 66.6667; x3 = 0
*     0: obj =   0.000000000e+00  infeas =  0.000e+00 (0)
*     2: obj =   7.333333333e+02  infeas =  0.000e+00 (0)
OPTIMAL SOLUTION FOUND

z = 733.333; x1 = 33.3333; x2 = 66.6667; x3 = 0
*     0: obj =   0.000000000e+00  infeas =  0.000e+00 (0)
*     2: obj =   7.333333333e+02  infeas =  0.000e+00 (0)
OPTIMAL SOLUTION FOUND

z = 733.333; x1 = 33.3333; x2 = 66.6667; x3 = 0
*     0: obj =   0.000000000e+00  infeas =  0.000e+00 (0)
*     2: obj =   7.333333333e+02  infeas =  0.000e+00 (0)
OPTIMAL SOLUTION FOUND

z = 733.333; x1 = 33.3333; x2 = 66.6667; x3 = 0
*     0: obj =   0.000000000e+00  infeas =  0.000e+00 (0)
*     2: obj =   7.333333333e+02  infeas =  0.000e+00 (0)
OPTIMAL SOLUTION FOUND

z = 733.333; x1 = 33.3333; x2 = 66.6667; x3 = 0
Assertion failed: xlcmp(env->t_last, t) <= 0
Error detected in file glplib10.c at line 109


--
Antonello Lobianco
Assegnista di Ricerca
Dipartimento di Economia, Università Politecnica delle Marche
Progetto "RegMAS per il Piceno" (Fondazione CARISAP)
Tel: +39.071.2207116
Email: address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]