Hello!
I have a IloNumVar v which can get only a certain set of values like: v \in {v_1, ..., v_n}.
Is it possible to make v as decision variable? What is the best way of modeling v (fractional but having discrete values) in CP Optimizer?
Best regards
Topic

Re: fractional variable having discrete values
20121206T10:29:33ZThis is the accepted answer. This is the accepted answer.Hello,
You could use as decision variable an index of the values of v and use an element expression Val[x] to get the value:
float Val[i in 1..n] = ...; // Val[i]=v_i dvar int+ x in 1..n; dexpr float v = Val[x];
Of course, if there is a more direct link between index i and value v_i, you can use a specific expression. Example if v \in { 0.1, 0.2, 0.3, 0.4, ..., 0.9, 1.0 }:
dvar int+ x in 1..10; dexpr float v = x/10.0;
Philippe 
Re: fractional variable having discrete values
20121208T21:01:30ZThis is the accepted answer. This is the accepted answer. SystemAdmin
 20121206T10:29:33Z
Hello,
You could use as decision variable an index of the values of v and use an element expression Val[x] to get the value:
<pre class="jivepre">float Val[i in 1..n] = ...; // Val[i]=v_i dvar int+ x in 1..n; dexpr float v = Val[x];
</pre>
Of course, if there is a more direct link between index i and value v_i, you can use a specific expression. Example if v \in { 0.1, 0.2, 0.3, 0.4, ..., 0.9, 1.0 }:
<pre class="jivepre">dvar int+ x in 1..10; dexpr float v = x/10.0;
</pre>
Philippe