title: Variables annotations in CPLEX for Automatic Benders decomposition Java API
body: <p>I am trying to implement the automatic benders decomposition to my problem using CPLEX version 20.10. I want to use USER strategy where CPLEX attempts to decompose the model according to my annotations.</p>
  <p>So first I initialize the strategy of benders algorithm and cplex.newLongAnnotation to specify cpxBendersPartition of variables.</p>
  <pre><code>cplex.setParam(IloCplex.Param.Benders.Strategy, IloCplex.BendersStrategy.User);     
  IloCplex.LongAnnotation benders = cplex.newLongAnnotation(&quot;cpxBendersPartition&quot;);
  </code></pre>
  <p>Then after initializing the integer variable $x \in X$</p>
  <pre><code>IloIntVar [] x  = new IloIntVar[NumofX]; //integer 
  </code></pre>
  <p>I tried to annotate it as following and add it to the master problem (value = 0)</p>
  <pre><code>for(int k=0; k &lt; x.length; k++) {       
      x[k] = cplex.intVar(0,UB,&quot;x_&quot;+k);
      cplex.setAnnotation(benders, x[k], 0);  
  }
  </code></pre>
  <p>However at this point I got this following error:</p>
  <blockquote>
  <p>ilog.cplex.IloCplex$UnknownObjectException: CPLEX Error: object is unknown to IloCplex <br>
  at ilog.cplex.IloCplex.getIndexOrException(IloCplex.java:11470) <br>
  at ilog.cplex.IloCplex.access$7400(IloCplex.java:453) <br>
  at ilog.cplex.IloCplex$AnnotationList.getIndexAndType(IloCplex.java:22273) <br>
  at ilog.cplex.IloCplex$AnnotationList.setAnnotation(IloCplex.java:22302)<br>
  at ilog.cplex.IloCplex.setAnnotation(IloCplex.java:22851)<br></p>
  </blockquote>
  <p>So my questions are why am I getting this error ? and how to annotate the variables to use in an annotated decomposition for Benders algorithm?</p>
  <p>Is there a way to export the .LP files of the master and the sub-problem(s) ?</p>
  <p>Thank you so much in advance.</p>