Merge pull request #724 from nabenabe0928/bug-fix/fix-sort-in-rank-plot-for-inf-values

[bug] Fix an error caused by infinity in trial.values
This commit is contained in:
c-bata
2023-12-07 13:39:35 +09:00
committed by GitHub
+9 -1
View File
@@ -152,13 +152,21 @@ const getRankPlotInfo = (
const zValues: number[] = []
const isFeasible: boolean[] = []
const hovertext: string[] = []
const convertTrialValueToNumber = (value: TrialValueNumber): number => {
// TrialValueNumber takes `number`, "inf", or "-inf".
return typeof value === "number"
? value
: value.includes("-")
? -Infinity
: Infinity
}
filteredTrials.forEach((trial, i) => {
const xValue = xAxis.values[i]
const yValue = yAxis.values[i]
if (xValue && yValue && trial.values) {
xValues.push(xValue)
yValues.push(yValue)
const zValue = Number(trial.values[objectiveId])
const zValue = convertTrialValueToNumber(trial.values[objectiveId])
zValues.push(zValue)
const feasibility = trial.constraints.every((c) => c <= 0)
isFeasible.push(feasibility)