Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merging multiple parameter files #374

Open
ott2 opened this issue Jul 24, 2017 · 6 comments
Open

merging multiple parameter files #374

ott2 opened this issue Jul 24, 2017 · 6 comments

Comments

@ott2
Copy link
Collaborator

ott2 commented Jul 24, 2017

In many graph problems there are at least two graphs, a pattern H and a target graph G. Typically the idea is to try an Essence model for all combinations of G and H.

Currently one has to separately generate a parameter file for each pair of G,H to be investigated. This requires something like a script in which calls to Conjure are prefaced with a merging together of the two parameter files into a single file for Conjure to process.

Currently, if Conjure is passed multiple parameter files then it will run Savile Row with each parameter file in turn. It would be helpful if Conjure were to also support merging multiple parameter files into a single intermediate parameter file, and then using that intermediate parameter file when calling Savile Row or retrieving solutions.

(This assumes that Conjure is intended to be the top level tool in the toolchain.)

@ott2
Copy link
Collaborator Author

ott2 commented Jul 24, 2017

A workaround is to call Conjure via a shell script something like the following:

#!/bin/sh
t=conjure-output/inter.param
cp /dev/null $t
while [ "x$1" = 'x-p' ]; do
  shift
  cat $1 >> $t
  q=`basename $1 .param`
  if [ "x$p" = 'x' ]; then
    p="$q"
  else
    p="$p-$q"
  fi
  shift
done
p="conjure-output/$p.param"
mv $t "$p"
conjure solve -ac $* "$p"

Invocation: csp -p 1.param -p 2.param -p 3.param model.essence

(This assumes a basename implementation that supports specifying a suffix to remove, such as the BSD-derived one in MacOS.)

@ozgurakgun
Copy link
Collaborator

If we wanted to change the meaning of conjure solve model.essence *.param to "concatenate the param files" that would be trivial to implement.

I guess we would have to decide whether we allow overriding of values or not. I'd like to err on the side of no overrides at a first glance, since depending on the order of param files would be fragile.

Would that be better @ott2? What do you think?

@ott2
Copy link
Collaborator Author

ott2 commented Jul 24, 2017

I'm not sure whether the current behaviour should be supplanted.

The non-trivial part of the concatenate semantics is to generate a reasonable name for the intermediate parameter file. It also seems reasonable to require the parameter files to be disjoint at this stage. At a later stage it might be worth supporting mapping names to other names, so that a graph can be defined in terms of N and G but for the second parameter file name N is mapped to n and name G is mapped to H.

@ozgurakgun
Copy link
Collaborator

The non-trivial part of the concatenate semantics is to generate a reasonable name for the intermediate parameter file.

Of course we don't actually need to create an intermediate parameter file, right?

@ott2
Copy link
Collaborator Author

ott2 commented Aug 3, 2017

No, as long as we have the provenance in the name.

@ozgurakgun
Copy link
Collaborator

@cls00 and @JoanEspasa want this as well, we will remove the parallel one and implement a concatenation one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants