@kortexya/reasoninglayer 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +20 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +20 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -109,7 +109,7 @@ type JsonValue$1 = string | number | boolean | null | JsonValue$1[] | object;
|
|
|
109
109
|
* This is the single source of truth for the version constant.
|
|
110
110
|
* The `scripts/release.sh` script updates this value alongside `package.json`.
|
|
111
111
|
*/
|
|
112
|
-
declare const SDK_VERSION = "0.2.
|
|
112
|
+
declare const SDK_VERSION = "0.2.3";
|
|
113
113
|
/**
|
|
114
114
|
* Configuration for the Reasoning Layer client.
|
|
115
115
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -109,7 +109,7 @@ type JsonValue$1 = string | number | boolean | null | JsonValue$1[] | object;
|
|
|
109
109
|
* This is the single source of truth for the version constant.
|
|
110
110
|
* The `scripts/release.sh` script updates this value alongside `package.json`.
|
|
111
111
|
*/
|
|
112
|
-
declare const SDK_VERSION = "0.2.
|
|
112
|
+
declare const SDK_VERSION = "0.2.3";
|
|
113
113
|
/**
|
|
114
114
|
* Configuration for the Reasoning Layer client.
|
|
115
115
|
*
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/config.ts
|
|
2
|
-
var SDK_VERSION = "0.2.
|
|
2
|
+
var SDK_VERSION = "0.2.3";
|
|
3
3
|
function resolveConfig(config) {
|
|
4
4
|
if (!config.baseUrl) {
|
|
5
5
|
throw new Error("ClientConfig.baseUrl is required");
|
|
@@ -12547,6 +12547,12 @@ var RagClient = class {
|
|
|
12547
12547
|
};
|
|
12548
12548
|
|
|
12549
12549
|
// src/builders/lp.ts
|
|
12550
|
+
function numericTerm(n) {
|
|
12551
|
+
return {
|
|
12552
|
+
sort_name: Number.isInteger(n) ? "integer_type" : "real_type",
|
|
12553
|
+
features: { value: n }
|
|
12554
|
+
};
|
|
12555
|
+
}
|
|
12550
12556
|
var LP = {
|
|
12551
12557
|
/**
|
|
12552
12558
|
* Create a maximization objective.
|
|
@@ -12666,8 +12672,8 @@ function compileLP(problem, solutionSortName) {
|
|
|
12666
12672
|
sort_name: "real_between_constraint",
|
|
12667
12673
|
features: {
|
|
12668
12674
|
var: ref,
|
|
12669
|
-
lower: bounds.min,
|
|
12670
|
-
upper: bounds.max
|
|
12675
|
+
lower: numericTerm(bounds.min),
|
|
12676
|
+
upper: numericTerm(bounds.max)
|
|
12671
12677
|
}
|
|
12672
12678
|
});
|
|
12673
12679
|
} else {
|
|
@@ -12676,7 +12682,7 @@ function compileLP(problem, solutionSortName) {
|
|
|
12676
12682
|
sort_name: "real_ge_constraint",
|
|
12677
12683
|
features: {
|
|
12678
12684
|
left: ref,
|
|
12679
|
-
right: bounds.min
|
|
12685
|
+
right: numericTerm(bounds.min)
|
|
12680
12686
|
}
|
|
12681
12687
|
});
|
|
12682
12688
|
}
|
|
@@ -12685,7 +12691,7 @@ function compileLP(problem, solutionSortName) {
|
|
|
12685
12691
|
sort_name: "real_le_constraint",
|
|
12686
12692
|
features: {
|
|
12687
12693
|
left: ref,
|
|
12688
|
-
right: bounds.max
|
|
12694
|
+
right: numericTerm(bounds.max)
|
|
12689
12695
|
}
|
|
12690
12696
|
});
|
|
12691
12697
|
}
|
|
@@ -12700,7 +12706,7 @@ function compileLP(problem, solutionSortName) {
|
|
|
12700
12706
|
sort_name: sortName,
|
|
12701
12707
|
features: {
|
|
12702
12708
|
left: compiled.resultRef,
|
|
12703
|
-
right: constraint.rhs
|
|
12709
|
+
right: numericTerm(constraint.rhs)
|
|
12704
12710
|
}
|
|
12705
12711
|
});
|
|
12706
12712
|
}
|
|
@@ -12717,7 +12723,7 @@ function compileLP(problem, solutionSortName) {
|
|
|
12717
12723
|
sort_name: "real_eq_constraint",
|
|
12718
12724
|
features: {
|
|
12719
12725
|
left: objVar,
|
|
12720
|
-
right: objectiveRef
|
|
12726
|
+
right: numericTerm(objectiveRef)
|
|
12721
12727
|
}
|
|
12722
12728
|
});
|
|
12723
12729
|
objectiveRef = objVar;
|
|
@@ -12781,7 +12787,7 @@ function compileLinearExpression(expression, varRefs, nextVar) {
|
|
|
12781
12787
|
antecedents.push({
|
|
12782
12788
|
sort_name: "real_times_constraint",
|
|
12783
12789
|
features: {
|
|
12784
|
-
coefficient,
|
|
12790
|
+
coefficient: numericTerm(coefficient),
|
|
12785
12791
|
variable: varRef,
|
|
12786
12792
|
result: resultVar
|
|
12787
12793
|
}
|
|
@@ -12790,7 +12796,7 @@ function compileLinearExpression(expression, varRefs, nextVar) {
|
|
|
12790
12796
|
}
|
|
12791
12797
|
}
|
|
12792
12798
|
if (termResults.length === 0) {
|
|
12793
|
-
return { antecedents, resultRef: 0 };
|
|
12799
|
+
return { antecedents, resultRef: numericTerm(0) };
|
|
12794
12800
|
}
|
|
12795
12801
|
if (termResults.length === 1) {
|
|
12796
12802
|
return { antecedents, resultRef: termResults[0] };
|
|
@@ -12907,18 +12913,19 @@ var OptimizeClient = class {
|
|
|
12907
12913
|
}
|
|
12908
12914
|
const solution = bcResponse.data.solutions[0];
|
|
12909
12915
|
const variables = {};
|
|
12910
|
-
let objectiveValue = 0;
|
|
12911
12916
|
for (const binding of solution.substitution.bindings) {
|
|
12912
12917
|
const varName = binding.variable_name;
|
|
12913
12918
|
if (!varName) continue;
|
|
12914
12919
|
const value = parseFloat(binding.bound_to_display);
|
|
12915
12920
|
if (isNaN(value)) continue;
|
|
12916
|
-
if (varName
|
|
12917
|
-
objectiveValue = value;
|
|
12918
|
-
} else if (varName.startsWith("?") && !varName.startsWith("?_lp_")) {
|
|
12921
|
+
if (varName.startsWith("?") && !varName.startsWith("?_lp_")) {
|
|
12919
12922
|
variables[varName.slice(1)] = value;
|
|
12920
12923
|
}
|
|
12921
12924
|
}
|
|
12925
|
+
let objectiveValue = 0;
|
|
12926
|
+
for (const [varName, coeff] of Object.entries(problem.objective.coefficients)) {
|
|
12927
|
+
objectiveValue += coeff * (variables[varName] ?? 0);
|
|
12928
|
+
}
|
|
12922
12929
|
return {
|
|
12923
12930
|
status: "optimal",
|
|
12924
12931
|
variables,
|