There's no conversion function in CPLEX that I'm aware of. When working with binary variables (in the Java API), I usually loop through them with the logic "if x < 0.5 then y = 0 else y = 1" rather than using the rounding function. I haven't checked to see which is faster, since it typically doesn't matter: the time extracting the solution is negligible compared to the time finding the solution.
------------------------------
Paul Rubin
Professor Emeritus
Michigan State University
------------------------------
Original Message:
Sent: Wed March 27, 2024 05:30 AM
From: Samuele Viaro
Subject: Copy 4D dvar into 4D parameter
Thank you for the quick response...
I did think about that...I was hoping there would be a function for Int2Int... ;)
------------------------------
Samuele Viaro
Original Message:
Sent: Tue March 26, 2024 02:03 PM
From: Paul Rubin
Subject: Copy 4D dvar into 4D parameter
Loop through the returned array of doubles, rounding each entry and then casting it to int.
------------------------------
Paul Rubin
Professor Emeritus
Michigan State University
Original Message:
Sent: Tue March 26, 2024 12:26 PM
From: Samuele Viaro
Subject: Copy 4D dvar into 4D parameter
Hello,
I need to copy a 4D matrix solution dvar boolean
into a 4D int
in C++, and then solve again.
I found the getValues
functions in IloCplex
that might work, but there is no case where both members of the functions are Integer Arrays...
any suggestions?
Thank you in advance! :)
Sam
------------------------------
Samuele Viaro
------------------------------