예제 #1
0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from les import backend_solvers
from les.executors import dummy_executor
from les.executors import executor_base
from les.mp_model import mp_model_builder
from les.utils import unittest
from les.pipeline import Pipeline


DEFAULT_BACKEND_SOLVER_ID = backend_solvers.get_default_solver_id()


@unittest.skip_if(DEFAULT_BACKEND_SOLVER_ID is None, 'no backend solvers')
class DummyExecutorTest(unittest.TestCase):

  def setup(self):
    self.pipeline = Pipeline()
    self.executor = dummy_executor.DummyExecutor(self.pipeline)

  def test_execute_task(self):
    model = mp_model_builder.MPModelBuilder.build_from(
      [8, 2, 5, 5, 8, 3, 9, 7, 6],
      [[2, 3, 4, 1, 0, 0, 0, 0, 0],
       [1, 2, 3, 2, 0, 0, 0, 0, 0],
       [0, 0, 1, 4, 3, 4, 2, 0, 0],
예제 #2
0
 def __init__(self):
   self._proto = mp_model_pb2.OptimizationParameters()
   self.driver.default_backend_solver = backend_solvers.get_default_solver_id()