GeCode包括权限被拒绝

时间:2014-09-17 06:29:02

标签: c++ linux gecode

我是GeCode lib(和g ++编译器......)的新手,遇到了编译问题。环境和错误信息如下:

Environment: x86_64-linux
GeCode version: gecode-4.2.0  in <../lib/gecode-4.2.0/>
g++ version: 4.7.2 (Debian 4.7.2-5)

gecode-4.2.0 /:

下的内容
./       libgecodedriver.so@         libgecodeminimodel.so.35@
../      libgecodedriver.so.35@      libgecodeminimodel.so.35.0*
cd       libgecodedriver.so.35.0*    libgecodesearch.so@
changelog.in     libgecodeflatzinc.so@       libgecodesearch.so.35@
CMakeLists.txt*  libgecodeflatzinc.so.35@    libgecodesearch.so.35.0*
config.log   libgecodeflatzinc.so.35.0*  libgecodeset.so@
config.status*   libgecodefloat.so@      libgecodeset.so.35@
configure*   libgecodefloat.so.35@       libgecodeset.so.35.0*
configure.ac     libgecodefloat.so.35.0*     libgecodesupport.so@
configure.ac.in  libgecodegist.so@       libgecodesupport.so.35@
contribs/    libgecodegist.so.35@        libgecodesupport.so.35.0*
doxygen/     libgecodegist.so.35.0*      LICENSE*
doxygen.conf     libgecodeint.so@        Makefile
doxygen.hh   libgecodeint.so.35@         Makefile.contribs
examples/    libgecodeint.so.35.0*       Makefile.dep
gecode/      libgecodekernel.so@         Makefile.in
gecode.m4    libgecodekernel.so.35@      misc/
gistqt.gz1HZm/   libgecodekernel.so.35.0*    test/
install-sh*  libgecodeminimodel.so@      tools/

../doc/目录下,我需要编译sendmory.cpp

/* ------------------------------------------------------------

Problem Description
-------------------

     S E N D
 +   M O R E
-------------
   M O N E Y 

------------------------------------------------------------ */
#include <ilsolver/ilosolverint.h>
ILOSTLBEGIN

int main() {

  IloEnv env;

  try {

    IloModel model(env);

    // Variables and Domains 
    IloIntVar S(env, 1, 9, "S"); IloIntVar M(env, 1, 9, "M");
    IloIntVar E(env, 0, 9, "E"); IloIntVar O(env, 0, 9, "O");
    IloIntVar N(env, 0, 9, "N"); IloIntVar R(env, 0, 9, "R"); 
    IloIntVar D(env, 0, 9, "D"); IloIntVar Y(env, 0, 9, "Y");

    // The SEND+MORE=MONEY constraint
    IloExpr SEND(env), MORE(env), MONEY(env);
    SEND = ( 1000*S + 100*E + 10*N + D );
    MORE = ( 1000*M + 100*O + 10*R + E );
    MONEY = ( 10000*M + 1000*O + 100*N + 10*E + Y );

    IloConstraint puzzle;
    puzzle = ( SEND + MORE == MONEY );

    model.add(puzzle);
    SEND.end(); MORE.end(); MONEY.end();

    // !! Alternative: post the SEND+MORE=MONEY constraint directly
    // model.add(               1000*S + 100*E + 10*N + D 
    //                        + 1000*M + 100*O + 10*R + E
    //             == 10000*M + 1000*O + 100*N + 10*E + Y );  

    // Use an array to collect the variables
    IloInt numVars = 8;
    IloIntVarArray vars( env, numVars );
    vars[0] = S; vars[1] = E; vars[2] = N; vars[3] = D;
    vars[4] = M; vars[5] = O; vars[6] = R; vars[7] = Y;

    // The disequality constraints using double for loop
    IloInt i,j;
    for ( i=0; i < numVars - 1; i++ ) {
      for ( j=i+1; j < numVars; j++ ) {
    model.add( vars[i] != vars[j] );
      } //endfor
    } //endfor

    // !! Alternative: a single all_different constraints
    // model.add(IloAllDiff(env, vars));

    // Pass the model to ILOG Solver
    IloSolver solver(model);

    if ( solver.solve() ) {
      // Print the Solution
      solver.out() << "Solution: ";
      solver.out() << " S=" << (IloInt) solver.getValue(S);
      solver.out() << " E=" << (IloInt) solver.getValue(E);
      solver.out() << " N=" << (IloInt) solver.getValue(N);
      solver.out() << " D=" << (IloInt) solver.getValue(D);
      solver.out() << " M=" << (IloInt) solver.getValue(M);
      solver.out() << " O=" << (IloInt) solver.getValue(O);
      solver.out() << " R=" << (IloInt) solver.getValue(R);
      solver.out() << " Y=" << (IloInt) solver.getValue(Y);
      solver.out() << endl;
    } // endif

  } // endtry
  catch (IloException& ex) {
    cout << "Error: " << ex << endl;
  } // endcatch

  env.end();
  return 0;
}
/*

Solution: S=9 E=5 N=6 D=7 M=1 O=0 R=8 Y=2

*/

编译命令:

g++ -I < ../lib/gecode-4.2.0 > /include -c sendmory.cpp

错误:

/include: Permission denied.

有人可以帮忙吗?感谢。

0 个答案:

没有答案