Question about environment

Recently,I am subject to a problem like this:
I have a package “MyPackage” depending on the “CBLS.jl” which in turn depends on JuMP@v0.21.5, but I also need “MyPackage” to depend on JuMP@v1.22.2. When I upgraded all the package in the present activated environment, the “CBLS” does not work at all, vice verse. I do not want to reload “CBLS” to adapt to the latest version of JuMP@v1.22.2, since it is tedious to revise the codes. How can you deal with such a situation?

1 Like

You cannot have two versions of the same package.

In this case, you cannot use JuMP v1 and CBLS at the same time.

But it also looks like v0.2 of CBLS supports JuMP v1?

2 Likes

Ah, @Azzaare hasn’t made a release yet.

Do

] add CBLS#main

to install the latest greatest version.

1 Like

the latest CBLS@0.2.0 seems not to work with the latest MathOptInterface. The package even can not pass the basic tests.

The package even can not pass the basic tests.

Then I assume @Azzaare hasn’t finished updating it, which is why there isn’t a new release :smile:

1 Like

I have been working on it the last couple of days (also on the documentation).

It should be finished soon (I will update the post here once it is done).

That being said, we’re working hard on all the CBLS ecosystem at the moment, so we will have a lot of changes in the coming months.

2 Likes

@lionisxn

As I released CBLSv0.2.0 yesterday, it might just be a question of timing with the different servers hosting the Julia General registry, but I have no issue with the latest versions of JuMP, MathOptInterface and CBLS.

I was not planning to tag it in the repo before I fix some doc issues, but I will try to make it available today or tomorrow. Will update here again!

3 Likes

Looking forward to the new features!

Hi, @Azzaare, could you please help me test the following code in your environment?

Pkg.generate(“D:/testCBLS”)>
Pkg.activate(“D:/testCBLS”)>
[Pkg.add(x) for x in [“CBLS”, “LocalSearchSolvers”, “JuMP”]]

using CBLS, LocalSearchSolvers, JuMP

n = 3>
N = n^2>
m = JuMP.Model(CBLS.Optimizer)>
@variable(m, X[1:N, 1:N], DiscreteSet(1:N))>
for i in 1:N>
@constraint(m, X[i,:] in AllDifferent()) # All variables on the same row must be different>
@constraint(m, X[:,i] in AllDifferent()) # All variables on the same column must be different

end

for i in 0:(n-1), j in 0:(n-1)>
@constraint(m, vec(X[(in+1):(n(i+1)), (jn+1):(n(j+1))]) in AllDifferent()) # All variables on the same block must be different>
end

@objective(m, Min, ScalarFunction(x → x[1,1]))

My machine (windows 11) throws that

Interesting. I went through your example and it seems to be a printing issue. I did not see it in the basic CBLS tests as I don’t print the model once the objective is added.

It seems I still have many things to update for JuMP v1 !

Thank you, I will also try to fix this asap.

1 Like

Appreciate your support! Looking forward to your great news!

2 Likes

Hey @lionisxn,

I’ve just released CBLS v0.2.1 that addresses your issue. It took me some time as I made sure to update the tests to the latest version of MathOptInterface.

Although it is still a draft, we are tackling the documentation for JuliaConstraints this summer. You can access it at https://juliaconstraints.github.io/

I understand if you prefer to wait for a while before using CBLS as we are still building it, but in the event you play around with and find some issues, or if you have some features that you want us to make a priority, please ask.

(For instance, one can use continuous variable in our CBLS framework, but we haven’t implemented yet an efficient LocalSearch for these domains. We will do that during July. If you have some use case in mind, we can target related features, as it is mainlya questino of sorting our priorities)

Wonderful! I’ll try the new release later, and report you issues, if any.

Hi, Azzaare, is there a way to turn off the distributed computation mode of “LocalSearchSolvers”?

Currently, you can control the maximum number of threads t (the value is currently shared, so you can have t threads per process).

If I recall the syntax should be:
set_attribute(model, MOI.NumberOfThreads(), t)

By default, CBLS will use all processes (and their associated threads) available.

Having a process-thread dictionary PT = Dict{Int, Int}() defined as a MathOptInterface’s solver attribute is definitely possible. I can probably do it tomorrow. (I need to if I want a finer control on my own local cluster anyway)

Let me know if you have specific needs regarding threads/processes. CBLS interface is based on the LocalSearchSolvers framework in Julia, so the parallel computing capabilities (and limitations) are similar.

As a side note, GPU CBLS is in the queue for this summer.

1 Like

@odow would it make sense to add a solver attribute for MOI/JuMP that provides a collection of pairs process_id => threads. So maybe something along the lines of MOI.ProcessThreads ?
Local Search Solvers can leverage that easily, but I am not sure for classical optimization.

I think such a solution might be much better since many packages do not support distributed computation very well, the keywords like “remotecall” “@threads” are expected to be able to be bypassed according to users’ preference

Hi @lionisxn

Sorry to get back to you so late. I stumble upon an issue with Distributed and I was not sure on how to handle it.

I finally settled on making your request working first. With CBLS v0.2.2 (registration ongoing, so it should be less than half an hour), you can do:

# To set the number of threads on the first process
set_optimizer_attribute(model, "threads", 2)
get_optimizer_attribute(model, "threads") == 2 # should return true

# To set a threads per process mapping, 2 threads on process 1, etc.
T = Dict(1 => 2, 2 => 3, 3 => 1)
set_optimizer_attribute(model, "process_threads_map", T)
get_optimizer_attribute(model, "process_threads_map") == T # should return true

I plan to release a finer control later on during summer, but that should let you handle your current issue.

If you find some odd behavior regarding the resources used, please let me know (my tests were not extensive at all)

Next update should be about logs (files and console).