Minizinc on node.js with minizinc npm - 不在 CLI 中时如何定义解决方案选项?

Minizinc on node.js with minizinc npm - how to define solution options when not in the CLI?

我正在使用以下 npm 包 https://www.npmjs.com/package/minizinc 但文档没有说明如何输入 cli strings/options 其中 model 可能会更改功能而不是仅返回默认第一个解决方案。

如果你打算努力创建一个 npm 包,为什么要停止在如何实际使用它的说明中投入 0 精力?没看懂。

m.solve(model).then((result) => {
  console.log(result);
});

model字符串只是字面上的模型,还是可以带其他参数?也许 Minizinc 手册或教程没有明确说明模型本身可以说明涵盖 Windows IDE 提供的功能的选项,例如说明在停止之前要显示多少解决方案?

谢谢!

MiniZinc 的节点包可能没有开发到应有的水平,但它确实提供了一些文档。

solve 的参数可以包含参数以及模型实例:

solve(paramsOrCode: string | IModelParams, data?: IDataObject | string, options?: Partial<IMiniZincSolveOptions>): Promise<IResult>;

您似乎想要使用 IModelParams 变体,它可以包含您要搜索多少个解决方案的选项:

export interface IModelParams {
  model: string;
  solver?: string;

  random_seed?: number;
  all_solutions?: boolean;
  free_search?: boolean;
  processes?: number;
  nr_solutions?: number;
}