-1

I am using the following npm package https://www.npmjs.com/package/minizinc but the documentation doesn't state how to enter cli strings/options where model is that might change the functionality instead of only returning the default first solved solution.

If you're going to make the effort to create an npm package, why stop at putting 0 effort into the instructions in how to actually use it? I don't get it.

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

Is the model string literally only the model, or can it take other parameters? Maybe the Minizinc manual or tutorials missed making it clear that the model itself can state options that cover the functionality that the Windows IDE provides, eg stating how many solutions to show before stopping?

Thanks!

MikeyB
  • 460
  • 1
  • 6
  • 22

1 Answers1

2

The node package of MiniZinc is maybe not as developed as it could be, but it does provide some documentation.

The arguments to solve can contain parameters as well as just the model instance:

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

It seems you would want to use the IModelParams variant which can include the option of how many solutions you are searching for:

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

  random_seed?: number;
  all_solutions?: boolean;
  free_search?: boolean;
  processes?: number;
  nr_solutions?: number;
}
Dekker1
  • 5,565
  • 25
  • 33