You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some users need to extract zero values from a CPLEX solution file.
Expected Behavior
Given a CPLEX solution file, the otoole results cplex csv... command should write out a folder of CSV files, and those CSV files should contain zero-valued rows.
Steps To Reproduce
No response
Log output
No response
Operating System
MacOS
What version of otoole are you running?
v1.1.2
Possible Solution
Replace the ReadCPLEX class with the following
classReadCplex(ReadWideResults):
"""Read a CPLEX solution file into memory"""def_convert_to_dataframe(self, file_path: Union[str, TextIO]) ->pd.DataFrame:
"""Reads a Cplex solution file into a pandas DataFrame Arguments --------- user_config : Dict[str, Dict] file_path : Union[str, TextIO] """df=pd.read_xml(file_path, xpath=".//variable", parser="etree")
df[["Variable", "Index"]] =df["name"].str.split("(", expand=True)
df["Index"] =df["Index"].str.replace(")", "", regex=False)
LOGGER.debug(df)
df=df.reset_index().rename(columns={"value": "Value"})
returndf[["Variable", "Index", "Value"]].astype({"Value": float})
Anything else?
No response
The text was updated successfully, but these errors were encountered:
The Issue
Some users need to extract zero values from a CPLEX solution file.
Expected Behavior
Given a CPLEX solution file, the
otoole results cplex csv...
command should write out a folder of CSV files, and those CSV files should contain zero-valued rows.Steps To Reproduce
No response
Log output
No response
Operating System
MacOS
What version of otoole are you running?
v1.1.2
Possible Solution
Replace the ReadCPLEX class with the following
Anything else?
No response
The text was updated successfully, but these errors were encountered: